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

胡军伟(苍茫) junwei.hjw at alibaba-inc.com
Mon Apr 14 09:18:27 UTC 2014


# SPDY patch
# User Hu Junwei <junwei.hjw at 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.

diff -uNr a/src/http/ngx_http_spdy.c b/src/http/ngx_http_spdy.c
--- a/src/http/ngx_http_spdy.c	2014-04-12 10:58:44.444469431 +0800
+++ b/src/http/ngx_http_spdy.c	2014-04-14 11:27:39.304650193 +0800
@@ -940,10 +940,17 @@
     sscf = ngx_http_get_module_srv_conf(sc->http_connection->conf_ctx,
                                         ngx_http_spdy_module);
 
-    if (sc->processing >= sscf->concurrent_streams) {
-
-        ngx_log_error(NGX_LOG_INFO, sc->connection->log, 0,
-                      "spdy concurrent streams excessed %ui",
sc->processing);
+    if ((sid <= sc->last_sid) || (sc->processing >=
sscf->concurrent_streams)) {
+        if (sid <= sc->last_sid) {
+            ngx_log_error(NGX_LOG_INFO, sc->connection->log, 0,
+                          "spdy stream-ID does not increase monotonically.
"
+                          "(last=%ui, this=%ui)",
+                          sc->last_sid, sid);
+        } else {
+            ngx_log_error(NGX_LOG_INFO, sc->connection->log, 0,
+                          "spdy concurrent streams excessed %ui",
+                          sc->processing);
+        }
 
         if (ngx_http_spdy_send_rst_stream(sc, sid, NGX_SPDY_REFUSED_STREAM,
                                           prio)



More information about the nginx-devel mailing list