[nginx] Fixed response line formatting with empty reason phrase.

Sergey Kandaurov pluknet at nginx.com
Wed Sep 18 14:57:38 UTC 2013


details:   http://hg.nginx.org/nginx/rev/e8d24b6d7f73
branches:  
changeset: 5382:e8d24b6d7f73
user:      Sergey Kandaurov <pluknet at nginx.com>
date:      Wed Sep 18 18:53:26 2013 +0400
description:
Fixed response line formatting with empty reason phrase.

As per RFC 2616 sec 6.1 the response status code is always followed by SP.

diffstat:

 src/http/ngx_http_header_filter_module.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r 3adbd23bf79e -r e8d24b6d7f73 src/http/ngx_http_header_filter_module.c
--- a/src/http/ngx_http_header_filter_module.c	Wed Sep 18 18:53:24 2013 +0400
+++ b/src/http/ngx_http_header_filter_module.c	Wed Sep 18 18:53:26 2013 +0400
@@ -264,13 +264,13 @@ ngx_http_header_filter(ngx_http_request_
             len += ngx_http_status_lines[status].len;
 
         } else {
-            len += NGX_INT_T_LEN;
+            len += NGX_INT_T_LEN + 1 /* SP */;
             status_line = NULL;
         }
 
         if (status_line && status_line->len == 0) {
             status = r->headers_out.status;
-            len += NGX_INT_T_LEN;
+            len += NGX_INT_T_LEN + 1 /* SP */;
             status_line = NULL;
         }
     }
@@ -451,7 +451,7 @@ ngx_http_header_filter(ngx_http_request_
         b->last = ngx_copy(b->last, status_line->data, status_line->len);
 
     } else {
-        b->last = ngx_sprintf(b->last, "%03ui", status);
+        b->last = ngx_sprintf(b->last, "%03ui ", status);
     }
     *b->last++ = CR; *b->last++ = LF;
 



More information about the nginx-devel mailing list