[BUG] Wrong Content-Length shared between main request and subrequests in http proxy module

Maxim Dounin mdounin at mdounin.ru
Sat May 11 17:28:50 UTC 2013


On Fri, May 03, 2013 at 11:20:46AM +0800, lanshun zhou wrote:

> Nginx uses a variable "$proxy_internal_body_length" for the
> "Content-Length" header in http proxy module, which is cacheable and shared
> between the main request and all subrequests by default.
> Although ctx->internal_body_length is calculated for each
> request/subrequest, the string format is cached after the first generation,
> and this may be wrong for other subrequests.
> The following simple config can reproduce the problem, where xxxxx is a
> place that can receive post data. curl --data-binary "xxxxxxxxxxxxxxx"
> localhost/test.html will cause the client hang.
>       location = /test.html {
>         add_after_body /vpost;
>         proxy_pass http://xxxxx;
>       }
>       location /vpost {
>         proxy_set_body "in vpost";
>         proxy_pass http://xxxxx;
>       }

Patch committed, thanks.  Added tests, too.


Maxim Dounin

More information about the nginx-devel mailing list