Skip to content

Commit

Permalink
SPDY: stop emitting multiple empty header values.
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
PiotrSikora committed Oct 27, 2014
1 parent 78dd8b5 commit 54606d4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/http/ngx_http_spdy_filter_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 54606d4

Please sign in to comment.