# HG changeset patch # User Piotr Sikora <pi...@cloudflare.com> # Date 1413890111 25200 # Tue Oct 21 04:15:11 2014 -0700 # Node ID fbc2eb84bd266b64644b00a6454c4f79f241af5a # Parent 973fded4f461f3a397779b3a1dc80881b1b34974 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 <pi...@cloudflare.com> diff -r 973fded4f461 -r fbc2eb84bd26 src/http/ngx_http_spdy_filter_module.c --- a/src/http/ngx_http_spdy_filter_module.c Wed Oct 15 22:57:23 2014 +0400 +++ b/src/http/ngx_http_spdy_filter_module.c Tue Oct 21 04:15:11 2014 -0700 @@ -100,7 +100,7 @@ ngx_http_spdy_header_filter(ngx_http_req u_char *p, *buf, *last; ngx_buf_t *b; ngx_str_t host; - ngx_uint_t i, j, count, port; + ngx_uint_t i, j, count, port, sep; ngx_chain_t *cl; ngx_list_part_t *part, *pt; ngx_table_elt_t *header, *h; @@ -472,6 +472,7 @@ ngx_http_spdy_header_filter(ngx_http_req pt = part; h = header; + sep = header[i].value.len ? 1 : 0; for (j = i + 1; /* void */; j++) { @@ -493,9 +494,14 @@ ngx_http_spdy_header_filter(ngx_http_req continue; } - *last++ = '\0'; + if (h[j].value.len) { + if (sep) { + *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); + sep = 1; + } h[j].hash = 2; } _______________________________________________ nginx-devel mailing list nginx-devel@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-devel