]> git.kaiwu.me - nginx.git/commitdiff
SPDY: stop emitting multiple empty header values.
authorPiotr Sikora <piotr@cloudflare.com>
Mon, 27 Oct 2014 21:25:56 +0000 (14:25 -0700)
committerPiotr Sikora <piotr@cloudflare.com>
Mon, 27 Oct 2014 21:25:56 +0000 (14:25 -0700)
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@cloudflare.com>
src/http/ngx_http_spdy_filter_module.c

index d1406a665b003c688885ca61ee7819a450d62ccd..377e935203f6c01db7ed0a436301924706c389a2 100644 (file)
@@ -493,9 +493,13 @@ ngx_http_spdy_header_filter(ngx_http_request_t *r)
                 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;
         }