Mercurial > hg > nginx-quic
comparison src/http/modules/ngx_http_fastcgi_module.c @ 4616:b194fb640d3e
Fastcgi: fixed padding handling on fixed-size records.
Padding was incorrectly ignored on end request, empty stdout and stderr
fastcgi records. This resulted in protocol desynchronization if fastcgi
application used these records with padding for some reason.
Reported by Ilia Vinokurov.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Fri, 11 May 2012 13:14:58 +0000 |
parents | adcd60233817 |
children | 21d1e3bcb356 |
comparison
equal
deleted
inserted
replaced
4615:adcd60233817 | 4616:b194fb640d3e |
---|---|
1354 | 1354 |
1355 return NGX_AGAIN; | 1355 return NGX_AGAIN; |
1356 } | 1356 } |
1357 | 1357 |
1358 } else { | 1358 } else { |
1359 f->state = ngx_http_fastcgi_st_version; | 1359 if (f->padding) { |
1360 f->state = ngx_http_fastcgi_st_padding; | |
1361 } else { | |
1362 f->state = ngx_http_fastcgi_st_version; | |
1363 } | |
1360 } | 1364 } |
1361 | 1365 |
1362 continue; | 1366 continue; |
1363 } | 1367 } |
1364 | 1368 |
1687 if (rc == NGX_ERROR) { | 1691 if (rc == NGX_ERROR) { |
1688 return NGX_ERROR; | 1692 return NGX_ERROR; |
1689 } | 1693 } |
1690 | 1694 |
1691 if (f->type == NGX_HTTP_FASTCGI_STDOUT && f->length == 0) { | 1695 if (f->type == NGX_HTTP_FASTCGI_STDOUT && f->length == 0) { |
1692 f->state = ngx_http_fastcgi_st_version; | 1696 |
1697 if (f->padding) { | |
1698 f->state = ngx_http_fastcgi_st_padding; | |
1699 } else { | |
1700 f->state = ngx_http_fastcgi_st_version; | |
1701 } | |
1693 | 1702 |
1694 if (!flcf->keep_conn) { | 1703 if (!flcf->keep_conn) { |
1695 p->upstream_done = 1; | 1704 p->upstream_done = 1; |
1696 } | 1705 } |
1697 | 1706 |
1700 | 1709 |
1701 continue; | 1710 continue; |
1702 } | 1711 } |
1703 | 1712 |
1704 if (f->type == NGX_HTTP_FASTCGI_END_REQUEST) { | 1713 if (f->type == NGX_HTTP_FASTCGI_END_REQUEST) { |
1705 f->state = ngx_http_fastcgi_st_version; | 1714 |
1715 if (f->padding) { | |
1716 f->state = ngx_http_fastcgi_st_padding; | |
1717 } else { | |
1718 f->state = ngx_http_fastcgi_st_version; | |
1719 } | |
1720 | |
1706 p->upstream_done = 1; | 1721 p->upstream_done = 1; |
1707 | 1722 |
1708 if (flcf->keep_conn) { | 1723 if (flcf->keep_conn) { |
1709 r->upstream->keepalive = 1; | 1724 r->upstream->keepalive = 1; |
1710 } | 1725 } |
1773 if (f->pos == f->last) { | 1788 if (f->pos == f->last) { |
1774 break; | 1789 break; |
1775 } | 1790 } |
1776 | 1791 |
1777 } else { | 1792 } else { |
1778 f->state = ngx_http_fastcgi_st_version; | 1793 if (f->padding) { |
1794 f->state = ngx_http_fastcgi_st_padding; | |
1795 } else { | |
1796 f->state = ngx_http_fastcgi_st_version; | |
1797 } | |
1779 } | 1798 } |
1780 | 1799 |
1781 continue; | 1800 continue; |
1782 } | 1801 } |
1783 | 1802 |