[PATCH] Make ngx_http_upstream provide a way to expose errors after sending out the response header

agentzh agentzh at gmail.com
Mon Apr 8 19:05:31 UTC 2013


Hello!

On Sun, Apr 7, 2013 at 5:23 PM, Maxim Dounin wrote:
>
> This looks wrong.
>
> The u->length should be used/checked in case of non-buffered processing
> only, u->pipe->length - in case of buffered.  The patch seems to
> check both, and this is probably what causes your problems.
>

Thanks for the quick comment!

But the problem is that for HTTP 1.0 responses without a
Content-Length response header, the end of the body is indicated by
closing the connection.

And for HTTP 1.0 responses without Content-Length in non-buffered
mode, u->length is always -1. Also, for chunked HTTP 1.1 response in
non-buffered mode, u->length is also always -1. Simply checking
u->length == -1 for "good eof" for these two cases are not enough
because for the latter, data truncation cannot be detected at all. And
that's also why I check p->length == -1 at the same time.

Do you have any better way to do this?

Thanks!
-agentzh



More information about the nginx-devel mailing list