Welcome! Log In Create A New Profile

Advanced

[nginx] svn commit: r5029 - trunk/src/http/modules

Anonymous User
February 01, 2013 09:44AM
Author: mdounin
Date: 2013-02-01 14:41:50 +0000 (Fri, 01 Feb 2013)
New Revision: 5029
URL: http://trac.nginx.org/nginx/changeset/5029/nginx

Log:
FastCGI: proper handling of split fastcgi end request.

If fastcgi end request record was split between several network packets,
with fastcgi_keep_conn it was possible that connection was saved in incorrect
state (e.g. with padding bytes not yet read).


Modified:
trunk/src/http/modules/ngx_http_fastcgi_module.c

Modified: trunk/src/http/modules/ngx_http_fastcgi_module.c
===================================================================
--- trunk/src/http/modules/ngx_http_fastcgi_module.c 2013-02-01 14:41:07 UTC (rev 5028)
+++ trunk/src/http/modules/ngx_http_fastcgi_module.c 2013-02-01 14:41:50 UTC (rev 5029)
@@ -1701,17 +1701,15 @@
}

if (f->type == NGX_HTTP_FASTCGI_END_REQUEST) {
- f->state = ngx_http_fastcgi_st_padding;

- p->upstream_done = 1;
+ ngx_log_debug0(NGX_LOG_DEBUG_HTTP, p->log, 0,
+ "http fastcgi sent end request");

- if (flcf->keep_conn) {
- r->upstream->keepalive = 1;
+ if (!flcf->keep_conn) {
+ p->upstream_done = 1;
+ break;
}

- ngx_log_debug0(NGX_LOG_DEBUG_HTTP, p->log, 0,
- "http fastcgi sent end request");
-
continue;
}
}
@@ -1719,6 +1717,24 @@

if (f->state == ngx_http_fastcgi_st_padding) {

+ if (f->type == NGX_HTTP_FASTCGI_END_REQUEST) {
+
+ if (f->pos + f->padding < f->last) {
+ p->upstream_done = 1;
+ break;
+ }
+
+ if (f->pos + f->padding == f->last) {
+ p->upstream_done = 1;
+ r->upstream->keepalive = 1;
+ break;
+ }
+
+ f->padding -= f->last - f->pos;
+
+ break;
+ }
+
if (f->pos + f->padding < f->last) {
f->state = ngx_http_fastcgi_st_version;
f->pos += f->padding;
@@ -1777,7 +1793,21 @@
continue;
}

+ if (f->type == NGX_HTTP_FASTCGI_END_REQUEST) {

+ if (f->pos + f->length <= f->last) {
+ f->state = ngx_http_fastcgi_st_padding;
+ f->pos += f->length;
+
+ continue;
+ }
+
+ f->length -= f->last - f->pos;
+
+ break;
+ }
+
+
/* f->type == NGX_HTTP_FASTCGI_STDOUT */

if (f->pos == f->last) {

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] svn commit: r5029 - trunk/src/http/modules

Anonymous User 900 February 01, 2013 09:44AM



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

Online Users

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