[PATCH] SPDY: stop emitting empty header values

Piotr Sikora piotr at cloudflare.com
Mon Oct 27 21:33:15 UTC 2014


# HG changeset patch
# User Piotr Sikora <piotr at cloudflare.com>
# Date 1414445156 25200
#      Mon Oct 27 14:25:56 2014 -0700
# Node ID e590d484a7f9d2750e2cd45ea16c601ae01cb607
# Parent  ee9230cd4bda9f9e7e83f7baf37d66ad6bb9b0c1
SPDY: stop emitting empty header values.

Previously, nginx would emit empty values in a header with multiple,
NULL-separated values.

This is forbidden by the SPDY specification, which requires headers to
have either a single (possibly empty) value or multiple, NULL-separated
non-empty values.

Signed-off-by: Piotr Sikora <piotr at cloudflare.com>

diff -r ee9230cd4bda -r e590d484a7f9 src/http/ngx_http_spdy_filter_module.c
--- a/src/http/ngx_http_spdy_filter_module.c	Mon Oct 27 21:14:12 2014 +0300
+++ b/src/http/ngx_http_spdy_filter_module.c	Mon Oct 27 14:25:56 2014 -0700
@@ -493,9 +493,13 @@ ngx_http_spdy_header_filter(ngx_http_req
                 continue;
             }
 
-            *last++ = '\0';
+            if (h[j].value.len) {
+                if (last != p) {
+                    *last++ = '\0';
+                }
 
-            last = ngx_cpymem(last, h[j].value.data, h[j].value.len);
+                last = ngx_cpymem(last, h[j].value.data, h[j].value.len);
+            }
 
             h[j].hash = 2;
         }



More information about the nginx-devel mailing list