Mercurial > hg > nginx-quic
comparison src/http/v2/ngx_http_v2.c @ 6514:0aa07850922f
HTTP/2: refuse streams with data until SETTINGS is acknowledged.
A client is allowed to send requests before receiving and acknowledging
the SETTINGS frame. Such a client having a wrong idea about the stream's
could send the request body that nginx isn't ready to process.
The previous behavior was to send RST_STREAM with FLOW_CONTROL_ERROR in
such case, but it didn't allow retrying requests that have been rejected.
author | Valentin Bartenev <vbart@nginx.com> |
---|---|
date | Thu, 14 Apr 2016 15:14:15 +0300 |
parents | 80ba811112ed |
children | 8df664ebe037 |
comparison
equal
deleted
inserted
replaced
6513:80ba811112ed | 6514:0aa07850922f |
---|---|
1056 | 1056 |
1057 status = NGX_HTTP_V2_REFUSED_STREAM; | 1057 status = NGX_HTTP_V2_REFUSED_STREAM; |
1058 goto rst_stream; | 1058 goto rst_stream; |
1059 } | 1059 } |
1060 | 1060 |
1061 if (!h2c->settings_ack && !(h2c->state.flags & NGX_HTTP_V2_END_STREAM_FLAG)) | |
1062 { | |
1063 status = NGX_HTTP_V2_REFUSED_STREAM; | |
1064 goto rst_stream; | |
1065 } | |
1066 | |
1061 node = ngx_http_v2_get_node_by_id(h2c, h2c->state.sid, 1); | 1067 node = ngx_http_v2_get_node_by_id(h2c, h2c->state.sid, 1); |
1062 | 1068 |
1063 if (node == NULL) { | 1069 if (node == NULL) { |
1064 return ngx_http_v2_connection_error(h2c, NGX_HTTP_V2_INTERNAL_ERROR); | 1070 return ngx_http_v2_connection_error(h2c, NGX_HTTP_V2_INTERNAL_ERROR); |
1065 } | 1071 } |
1876 "and nonzero length"); | 1882 "and nonzero length"); |
1877 | 1883 |
1878 return ngx_http_v2_connection_error(h2c, NGX_HTTP_V2_SIZE_ERROR); | 1884 return ngx_http_v2_connection_error(h2c, NGX_HTTP_V2_SIZE_ERROR); |
1879 } | 1885 } |
1880 | 1886 |
1881 /* TODO settings acknowledged */ | 1887 h2c->settings_ack = 1; |
1882 | 1888 |
1883 return ngx_http_v2_state_complete(h2c, pos, end); | 1889 return ngx_http_v2_state_complete(h2c, pos, end); |
1884 } | 1890 } |
1885 | 1891 |
1886 if (h2c->state.length % NGX_HTTP_V2_SETTINGS_PARAM_SIZE) { | 1892 if (h2c->state.length % NGX_HTTP_V2_SETTINGS_PARAM_SIZE) { |