mirror of
https://github.com/nginx/nginx.git
synced 2025-06-16 16:51:05 +08:00
SPDY: better name for frame entries counter.
The "headers" is not a good term, since it is used not only to count name/value pairs in the HEADERS block but to count SETTINGS entries too. Moreover, one name/value pair in HEADERS can contain multiple http headers with the same name. No functional changes.
This commit is contained in:
parent
32bb39c48f
commit
406c0613f5
@ -862,14 +862,15 @@ ngx_http_spdy_state_headers(ngx_http_spdy_connection_t *sc, u_char *pos,
|
|||||||
ngx_http_spdy_state_headers);
|
ngx_http_spdy_state_headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
sc->headers = ngx_spdy_frame_parse_uint16(buf->pos);
|
sc->entries = ngx_spdy_frame_parse_uint16(buf->pos);
|
||||||
|
|
||||||
buf->pos += NGX_SPDY_NV_NUM_SIZE;
|
buf->pos += NGX_SPDY_NV_NUM_SIZE;
|
||||||
|
|
||||||
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
||||||
"spdy headers count: %ui", sc->headers);
|
"spdy HEADERS block consists of %ui entries",
|
||||||
|
sc->entries);
|
||||||
|
|
||||||
if (ngx_list_init(&r->headers_in.headers, r->pool, sc->headers + 3,
|
if (ngx_list_init(&r->headers_in.headers, r->pool, sc->entries + 3,
|
||||||
sizeof(ngx_table_elt_t))
|
sizeof(ngx_table_elt_t))
|
||||||
!= NGX_OK)
|
!= NGX_OK)
|
||||||
{
|
{
|
||||||
@ -888,14 +889,14 @@ ngx_http_spdy_state_headers(ngx_http_spdy_connection_t *sc, u_char *pos,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while (sc->headers) {
|
while (sc->entries) {
|
||||||
|
|
||||||
rc = ngx_http_spdy_parse_header(r);
|
rc = ngx_http_spdy_parse_header(r);
|
||||||
|
|
||||||
switch (rc) {
|
switch (rc) {
|
||||||
|
|
||||||
case NGX_DONE:
|
case NGX_DONE:
|
||||||
sc->headers--;
|
sc->entries--;
|
||||||
|
|
||||||
case NGX_OK:
|
case NGX_OK:
|
||||||
break;
|
break;
|
||||||
@ -1401,35 +1402,35 @@ ngx_http_spdy_state_settings(ngx_http_spdy_connection_t *sc, u_char *pos,
|
|||||||
ngx_uint_t v;
|
ngx_uint_t v;
|
||||||
ngx_http_spdy_srv_conf_t *sscf;
|
ngx_http_spdy_srv_conf_t *sscf;
|
||||||
|
|
||||||
if (sc->headers == 0) {
|
if (sc->entries == 0) {
|
||||||
|
|
||||||
if (end - pos < NGX_SPDY_SETTINGS_NUM_SIZE) {
|
if (end - pos < NGX_SPDY_SETTINGS_NUM_SIZE) {
|
||||||
return ngx_http_spdy_state_save(sc, pos, end,
|
return ngx_http_spdy_state_save(sc, pos, end,
|
||||||
ngx_http_spdy_state_settings);
|
ngx_http_spdy_state_settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
sc->headers = ngx_spdy_frame_parse_uint32(pos);
|
sc->entries = ngx_spdy_frame_parse_uint32(pos);
|
||||||
|
|
||||||
pos += NGX_SPDY_SETTINGS_NUM_SIZE;
|
pos += NGX_SPDY_SETTINGS_NUM_SIZE;
|
||||||
sc->length -= NGX_SPDY_SETTINGS_NUM_SIZE;
|
sc->length -= NGX_SPDY_SETTINGS_NUM_SIZE;
|
||||||
|
|
||||||
if (sc->length < sc->headers * NGX_SPDY_SETTINGS_PAIR_SIZE) {
|
if (sc->length < sc->entries * NGX_SPDY_SETTINGS_PAIR_SIZE) {
|
||||||
/* TODO logging */
|
/* TODO logging */
|
||||||
return ngx_http_spdy_state_protocol_error(sc);
|
return ngx_http_spdy_state_protocol_error(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0,
|
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0,
|
||||||
"spdy SETTINGS frame consists of %ui entries",
|
"spdy SETTINGS frame consists of %ui entries",
|
||||||
sc->headers);
|
sc->entries);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (sc->headers) {
|
while (sc->entries) {
|
||||||
if (end - pos < NGX_SPDY_SETTINGS_PAIR_SIZE) {
|
if (end - pos < NGX_SPDY_SETTINGS_PAIR_SIZE) {
|
||||||
return ngx_http_spdy_state_save(sc, pos, end,
|
return ngx_http_spdy_state_save(sc, pos, end,
|
||||||
ngx_http_spdy_state_settings);
|
ngx_http_spdy_state_settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
sc->headers--;
|
sc->entries--;
|
||||||
|
|
||||||
if (pos[0] != NGX_SPDY_SETTINGS_MAX_STREAMS) {
|
if (pos[0] != NGX_SPDY_SETTINGS_MAX_STREAMS) {
|
||||||
pos += NGX_SPDY_SETTINGS_PAIR_SIZE;
|
pos += NGX_SPDY_SETTINGS_PAIR_SIZE;
|
||||||
|
@ -100,7 +100,7 @@ struct ngx_http_spdy_connection_s {
|
|||||||
|
|
||||||
ngx_http_spdy_stream_t *stream;
|
ngx_http_spdy_stream_t *stream;
|
||||||
|
|
||||||
ngx_uint_t headers;
|
ngx_uint_t entries;
|
||||||
size_t length;
|
size_t length;
|
||||||
u_char flags;
|
u_char flags;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user