Welcome! Log In Create A New Profile

Advanced

yield 499 while reading client body and client prematurely closed connection

January 16, 2018 01:12AM
# HG changeset patch
# User Alex Zhang <zchao1995@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@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;
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

yield 499 while reading client body and client prematurely closed connection

tokers 648 January 16, 2018 01:12AM

Re: yield 499 while reading client body and client prematurely closed connection

Piotr Sikora via nginx-devel 367 January 16, 2018 01:58AM

Re: yield 499 while reading client body and client prematurely closed connection

Maxim Dounin 674 January 16, 2018 07:24AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 233
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready