yield 499 while reading client body and client prematurely closed connection
tokers
zchao1995 at gmail.com
Tue Jan 16 05:59:53 UTC 2018
# 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>
diff -r 93abb5a855d6 -r 9ca5af970d22 src/http/ngx_http_request_body.c
--- a/src/http/ngx_http_request_body.c Thu Jan 11 21:43:49 2018 +0300
+++ b/src/http/ngx_http_request_body.c Tue Jan 16 13:10:40 2018 +0800
@@ -342,14 +342,17 @@
break;
}
- if (n == 0) {
+ if (n == 0 || n == NGX_ERROR) {
+ c->error = 1;
+
+ if (n == 0) {
+ return NGX_HTTP_BAD_REQUEST;
+ }
+
ngx_log_error(NGX_LOG_INFO, c->log, 0,
"client prematurely closed connection");
- }
- if (n == 0 || n == NGX_ERROR) {
- c->error = 1;
- return NGX_HTTP_BAD_REQUEST;
+ return NGX_HTTP_CLIENT_CLOSED_REQUEST;
}
rb->buf->last += n;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20180115/4176d5c8/attachment.html>
More information about the nginx-devel
mailing list