yield 499 while reading client body and client prematurely closed connection
Maxim Dounin
mdounin at mdounin.ru
Tue Jan 16 12:23:00 UTC 2018
Hello!
On Mon, Jan 15, 2018 at 09:59:53PM -0800, tokers wrote:
> # HG changeset patch
> # User Alex Zhang <zchao1995 at gmail.com>
> # Date 1516079440 -28800
> # Tue Jan 16 13:10:40 2018 +0800
> # Node ID 9ca5af970d2296a02acefb3070237c5f52119708
> # Parent 93abb5a855d6534f0356882f45be49f8c6a95a8b
> yield 499 while reading client body and client prematurely closed
> connection.
>
> The function ngx_http_do_read_client_request_body returns
> NGX_HTTP_BAD_REQUEST (client prematurely closed connection),
> while the 400 status code cannot reflect that client closed connection
> prematurely. It should return code 499(NGX_HTTP_CLIENT_CLOSED_REQUEST)
> and it is helpful to troubleshoot some relevant problems.
>
> Signed-off-by: Alex Zhang <zchao1995 at gmail.com>
The 499 code means that client closed a request before nginx was
able to generate a response code and was waiting for something
external - for example, a response from an upstream server. It is
never meant to indicate a connection close by a client at some
arbitrary time.
If a client fails to provide full request with correct syntax,
this is indicated by 400 with appropriate error message logged at
the info level. For example, the same behaviour can be seen in
the ngx_http_read_request_header() function.
I don't think that changing the meaning of the code is a good
idea, especially given that suggested meaning as seen from the
patch is inconsistent across reading different parts of the
request.
--
Maxim Dounin
http://mdounin.ru/
More information about the nginx-devel
mailing list