Welcome! Log In Create A New Profile

Advanced

[PATCH] nginx does not close the connection for 412 responses under extreme conditions

agentzh
May 11, 2012 09:00AM
Hello!

I've just noticed that the "412 Precondition Failed page" for the
If-Unmodified-Since request header could lead to connection hang. That
is, when the 412 page cannot be sent out in a single run (seen EAGAIN
for example), then ngx_http_finalize_request will never close the
downstream connection due to the r->filter_finalize set by
ngx_http_filter_finalize_request.

This issue can be reproduced with the standard ngx_http_static_module
serving the sample index.html page.

Here attaches the patch for both nginx 1.0.15 to fix this (it should
also be applied to nginx 1.2.0, I think).

Comments welcome!

Thanks!
-agentzh

--- nginx-1.0.15/src/http/ngx_http_request.c 2012-03-05 20:49:32.000000000 +0800
+++ nginx-1.0.15-patched/src/http/ngx_http_request.c 2012-05-11
20:50:01.478111234 +0800
@@ -1900,6 +1900,7 @@

if (rc == NGX_OK && r->filter_finalize) {
c->error = 1;
+ ngx_http_finalize_connection(r);
return;
}
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH] nginx does not close the connection for 412 responses under extreme conditions Attachments

agentzh 1537 May 11, 2012 09:00AM

Re: [PATCH] nginx does not close the connection for 412 responses under extreme conditions

Maxim Dounin 539 May 12, 2012 04:52AM

Re: [PATCH] nginx does not close the connection for 412 responses under extreme conditions

agentzh 470 May 12, 2012 08:18AM

Re: [PATCH] nginx does not close the connection for 412 responses under extreme conditions

Maxim Dounin 499 May 12, 2012 08:50AM

Re: [PATCH] nginx does not close the connection for 412 responses under extreme conditions

agentzh 518 May 12, 2012 11:12AM

Re: [PATCH] nginx does not close the connection for 412 responses under extreme conditions

Maxim Dounin 571 May 12, 2012 01:14PM

Re: [PATCH] nginx does not close the connection for 412 responses under extreme conditions

Maxim Dounin 602 May 17, 2012 06:26AM

Re: [PATCH] nginx does not close the connection for 412 responses under extreme conditions

agentzh 530 May 17, 2012 06:50AM



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

Online Users

Guests: 297
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