Welcome! Log In Create A New Profile

Advanced

[PATCH] SPDY: stop emitting empty header values

Piotr Sikora
October 21, 2014 07:18AM
# HG changeset patch
# User Piotr Sikora <piotr@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 <piotr@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
Subject Author Views Posted

[PATCH] SPDY: stop emitting empty header values

Piotr Sikora 750 October 21, 2014 07:18AM

Re: [PATCH] SPDY: stop emitting empty header values

Valentin V. Bartenev 303 October 27, 2014 10:04AM

Re: [PATCH] SPDY: stop emitting empty header values

Piotr Sikora 342 October 27, 2014 05:34PM

[PATCH] SPDY: stop emitting empty header values

Piotr Sikora 347 October 27, 2014 05:34PM

Re: [PATCH] SPDY: stop emitting empty header values

Valentin V. Bartenev 350 October 28, 2014 09:40AM

Re: [PATCH] SPDY: stop emitting empty header values

Valentin V. Bartenev 368 October 28, 2014 03:06PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 160
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready