[nginx] Fixed ngx_http_parse_chunked() minimal length calculation.

Maxim Dounin mdounin at mdounin.ru
Fri Jun 28 10:24:04 UTC 2013


details:   http://hg.nginx.org/nginx/rev/b66ec10e901a
branches:  
changeset: 5256:b66ec10e901a
user:      Maxim Dounin <mdounin at mdounin.ru>
date:      Fri Jun 28 13:55:05 2013 +0400
description:
Fixed ngx_http_parse_chunked() minimal length calculation.

Minimal data length we expect for further calls was calculated incorrectly
if parsing stopped right after parsing chunk size.  This might in theory
affect clients and/or backends using LF instead of CRLF.

Patch by Dmitry Popov.

diffstat:

 src/http/ngx_http_parse.c |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (15 lines):

diff --git a/src/http/ngx_http_parse.c b/src/http/ngx_http_parse.c
--- a/src/http/ngx_http_parse.c
+++ b/src/http/ngx_http_parse.c
@@ -2180,8 +2180,9 @@ data:
         ctx->length = 3 /* "0" LF LF */;
         break;
     case sw_chunk_size:
-        ctx->length = 2 /* LF LF */
-                      + (ctx->size ? ctx->size + 4 /* LF "0" LF LF */ : 0);
+        ctx->length = 1 /* LF */
+                      + (ctx->size ? ctx->size + 4 /* LF "0" LF LF */
+                                   : 1 /* LF */);
         break;
     case sw_chunk_extension:
     case sw_chunk_extension_almost_done:



More information about the nginx-devel mailing list