httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ic...@apache.org
Subject svn commit: r1718556 - /httpd/httpd/trunk/modules/http2/h2_session.c
Date Tue, 08 Dec 2015 10:59:30 GMT
Author: icing
Date: Tue Dec  8 10:59:30 2015
New Revision: 1718556

URL: http://svn.apache.org/viewvc?rev=1718556&view=rev
Log:
mod_http2: sending out push promises *before* the stream response to make client handling
of preload links easier

Modified:
    httpd/httpd/trunk/modules/http2/h2_session.c

Modified: httpd/httpd/trunk/modules/http2/h2_session.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_session.c?rev=1718556&r1=1718555&r2=1718556&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_session.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_session.c Tue Dec  8 10:59:30 2015
@@ -1230,23 +1230,14 @@ static apr_status_t submit_response(h2_s
                       "h2_stream(%ld-%d): submit response %d",
                       session->id, stream->id, response->http_status);
         
-        prio = h2_stream_get_priority(stream);
-        if (prio) {
-            h2_session_set_prio(session, stream, prio);
-            /* no showstopper if that fails for some reason */
-        }
-        
-        ngh = h2_util_ngheader_make_res(stream->pool, response->http_status, 
-                                        response->headers);
-        rv = nghttp2_submit_response(session->ngh2, response->stream_id,
-                                     ngh->nv, ngh->nvlen, &provider);
-        
-        /* If the submit worked,
-         * and this stream is not a pushed one itself,
+        /* If this stream is not a pushed one itself,
          * and HTTP/2 server push is enabled here,
          * and the response is in the range 200-299 *),
          * and the remote side has pushing enabled,
          * -> find and perform any pushes on this stream
+         *    *before* we submit the stream response itself.
+         *    This helps clients avoid opening new streams on Link
+         *    headers that get pushed right afterwards.
          * 
          * *) the response code is relevant, as we do not want to 
          *    make pushes on 401 or 403 codes, neiterh on 301/302
@@ -1254,14 +1245,25 @@ static apr_status_t submit_response(h2_s
          *    as the client, having this resource in its cache, might
          *    also have the pushed ones as well.
          */
-        if (!rv 
-            && !stream->initiated_on
+        if (!stream->initiated_on
             && h2_config_geti(session->config, H2_CONF_PUSH)
             && H2_HTTP_2XX(response->http_status)
             && h2_session_push_enabled(session)) {
             
             h2_stream_submit_pushes(stream);
         }
+        
+        prio = h2_stream_get_priority(stream);
+        if (prio) {
+            h2_session_set_prio(session, stream, prio);
+            /* no showstopper if that fails for some reason */
+        }
+        
+        ngh = h2_util_ngheader_make_res(stream->pool, response->http_status, 
+                                        response->headers);
+        rv = nghttp2_submit_response(session->ngh2, response->stream_id,
+                                     ngh->nv, ngh->nvlen, &provider);
+        
     }
     else {
         int err = H2_STREAM_RST(stream, H2_ERR_PROTOCOL_ERROR);



Mime
View raw message