Welcome! Log In Create A New Profile

Advanced

Re: [PATCH] SPDY: added stream-ID checking for SYN_STREAM.

Valentin V. Bartenev
April 14, 2014 06:02AM
On Monday 14 April 2014 17:18:27 胡军伟 wrote:
> # SPDY patch
> # User Hu Junwei <junwei.hjw@alibaba-inc.com>
> # Date 2014-04-14 11:27:39.304650193 +0800
> # Node ID
> # Parent
> SPDY: added stream-ID checking for SVN_STREAM.
>
> The stream-ID should be checked whether it increases monotonically.
>
[..]

While it would be good to have this check, but your patch doesn't
follow specification (not to mention other problems in it).

I already have a better one waiting in my patch queue:

# HG changeset patch
# User Valentin Bartenev <vbart@nginx.com>
# Date 1397147349 -14400
# Thu Apr 10 20:29:09 2014 +0400
# Node ID 2574215384c47374208fee3d36d5066f8f2d79b7
# Parent 3633957953840f8675511084d71eb28dcb3a1c5d
SPDY: Stream-ID restrictions according to specification.

diff -r 363395795384 -r 2574215384c4 src/http/ngx_http_spdy.c
--- a/src/http/ngx_http_spdy.c Wed Apr 09 18:15:32 2014 +0400
+++ b/src/http/ngx_http_spdy.c Thu Apr 10 20:29:09 2014 +0400
@@ -937,6 +937,27 @@ ngx_http_spdy_state_syn_stream(ngx_http_
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0,
"spdy SYN_STREAM frame sid:%ui prio:%ui", sid, prio);

+ if (sid % 2 == 0 || sid <= sc->last_sid) {
+ ngx_log_error(NGX_LOG_INFO, sc->connection->log, 0,
+ "client sent SYN_STREAM frame "
+ "with invalid Stream-ID %ui", sid);
+
+ stream = ngx_http_spdy_get_stream_by_id(sc, sid);
+
+ if (stream) {
+ if (ngx_http_spdy_terminate_stream(sc, stream,
+ NGX_SPDY_PROTOCOL_ERROR)
+ != NGX_OK)
+ {
+ return ngx_http_spdy_state_internal_error(sc);
+ }
+ }
+
+ return ngx_http_spdy_state_protocol_error(sc);
+ }
+
+ sc->last_sid = sid;
+
sscf = ngx_http_get_module_srv_conf(sc->http_connection->conf_ctx,
ngx_http_spdy_module);

@@ -968,8 +989,6 @@ ngx_http_spdy_state_syn_stream(ngx_http_

sc->stream = stream;

- sc->last_sid = sid;
-
return ngx_http_spdy_state_headers(sc, pos, end);
}


_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH] SPDY: added stream-ID checking for SYN_STREAM.

胡军伟(苍茫) 700 April 14, 2014 05:20AM

Re: [PATCH] SPDY: added stream-ID checking for SYN_STREAM.

Valentin V. Bartenev 333 April 14, 2014 06:02AM



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

Online Users

Guests: 167
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready