comparison src/http/ngx_http_spdy.c @ 5626:2411d4b5be2c

SPDY: better detect if headers block has wrong entries count. Previously, only one case was checked: if there's more data to parse in a r->header_in buffer, but the buffer can be filled to the end by the last parsed entry, so we also need to check that there's no more data to inflate.
author Valentin Bartenev <vbart@nginx.com>
date Wed, 26 Mar 2014 18:01:11 +0400
parents 372cc6e532a6
children d74889fbf06d
comparison
equal deleted inserted replaced
5625:372cc6e532a6 5626:2411d4b5be2c
1194 1194
1195 return ngx_http_spdy_state_headers_error(sc, pos, end); 1195 return ngx_http_spdy_state_headers_error(sc, pos, end);
1196 } 1196 }
1197 } 1197 }
1198 1198
1199 if (buf->pos != buf->last) { 1199 if (buf->pos != buf->last || sc->zstream_in.avail_in) {
1200 /* TODO: improve error message */ 1200 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
1201 ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, 1201 "client sent SYN_STREAM frame "
1202 "end %ui %p %p", complete, buf->pos, buf->last); 1202 "with invalid HEADERS block");
1203 ngx_http_spdy_close_stream(sc->stream, NGX_HTTP_BAD_REQUEST); 1203 ngx_http_spdy_close_stream(sc->stream, NGX_HTTP_BAD_REQUEST);
1204 return ngx_http_spdy_state_protocol_error(sc); 1204 return ngx_http_spdy_state_protocol_error(sc);
1205 } 1205 }
1206 1206
1207 if (!complete) { 1207 if (!complete) {