]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Merge of r1769596,1769600,1770395,1770998 from trunk
authorStefan Eissing <icing@apache.org>
Wed, 23 Nov 2016 16:32:59 +0000 (16:32 +0000)
committerStefan Eissing <icing@apache.org>
Wed, 23 Nov 2016 16:32:59 +0000 (16:32 +0000)
mod_http2: PUSH triggers only on GET
mod_proxy_http2: 1xx responses not forwarded unconditionally on HTTP/1.x connections

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1771000 13f79535-47bb-0310-9956-ffa450edef68

modules/http2/h2_h2.c
modules/http2/h2_proxy_session.c
modules/http2/h2_proxy_session.h
modules/http2/h2_session.c
modules/http2/h2_version.h
modules/http2/mod_proxy_http2.c

index 8ca8ccb55f01404febcded9e15021b4618dc50ae..d1743386f8d1ddf5dd71b2e5190621d2ca76a417 100644 (file)
@@ -684,7 +684,8 @@ static int h2_h2_pre_close_conn(conn_rec *c)
 static void check_push(request_rec *r, const char *tag)
 {
     const h2_config *conf = h2_config_rget(r);
-    if (conf && conf->push_list && conf->push_list->nelts > 0) {
+    if (!r->expecting_100 
+        && conf && conf->push_list && conf->push_list->nelts > 0) {
         int i, old_status;
         const char *old_line;
         ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, 
index b1929f70b015fbfd25949f03b02023ed2e7ac789..25d1eb3d181a39ff09b166edd953a853455ef82f 100644 (file)
@@ -160,10 +160,17 @@ static int on_frame_recv(nghttp2_session *ngh2, const nghttp2_frame *frame,
             }
             r = stream->r;
             if (r->status >= 100 && r->status < 200) {
-                ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, 
-                              "h2_proxy_session(%s): got interim HEADERS, status=%d",
-                              session->id, r->status);
+                /* By default, we will forward all interim responses when
+                 * we are sitting on a HTTP/2 connection to the client */
+                int forward = session->h2_front;
                 switch(r->status) {
+                    case 100:
+                        if (stream->waiting_on_100) {
+                            stream->waiting_on_100 = 0;
+                            r->status_line = ap_get_status_line(r->status);
+                            forward = 1;
+                        } 
+                        break;
                     case 103:
                         /* workaround until we get this into http protocol base
                          * parts. without this, unknown codes are converted to
@@ -174,9 +181,14 @@ static int on_frame_recv(nghttp2_session *ngh2, const nghttp2_frame *frame,
                         r->status_line = ap_get_status_line(r->status);
                         break;
                 }
-                ap_send_interim_response(r, 1);
+                ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(03487) 
+                              "h2_proxy_session(%s): got interim HEADERS, "
+                              "status=%d, will forward=%d",
+                              session->id, r->status, forward);
+                if (forward) {
+                    ap_send_interim_response(r, 1);
+                }
             }
-            stream->waiting_on_100 = 0;
             stream_resume(stream);
             break;
         case NGHTTP2_PING:
@@ -582,6 +594,7 @@ static int on_invalid_header_cb(nghttp2_session *ngh2,
 
 h2_proxy_session *h2_proxy_session_setup(const char *id, proxy_conn_rec *p_conn,
                                          proxy_server_conf *conf,
+                                         int h2_front, 
                                          unsigned char window_bits_connection,
                                          unsigned char window_bits_stream,
                                          h2_proxy_request_done *done)
@@ -602,6 +615,7 @@ h2_proxy_session *h2_proxy_session_setup(const char *id, proxy_conn_rec *p_conn,
         session->conf = conf;
         session->pool = p_conn->scpool;
         session->state = H2_PROXYS_ST_INIT;
+        session->h2_front = h2_front;
         session->window_bits_stream = window_bits_stream;
         session->window_bits_connection = window_bits_connection;
         session->streams = h2_proxy_ihash_create(pool, offsetof(h2_proxy_stream, id));
index 709fe4b0b7caa577b3f9f74816b2bfbcbd6f8bc8..c9820563f568e21423e654f5a6370c5aa3e03bba 100644 (file)
@@ -64,6 +64,7 @@ struct h2_proxy_session {
     
     unsigned int aborted : 1;
     unsigned int check_ping : 1;
+    unsigned int h2_front : 1; /* if front-end connection is HTTP/2 */
 
     h2_proxy_request_done *done;
     void *user_data;
@@ -86,6 +87,7 @@ struct h2_proxy_session {
 
 h2_proxy_session *h2_proxy_session_setup(const char *id, proxy_conn_rec *p_conn,
                                          proxy_server_conf *conf,
+                                         int h2_front, 
                                          unsigned char window_bits_connection,
                                          unsigned char window_bits_stream,
                                          h2_proxy_request_done *done);
index 5cb63d00b4dabed0564227f0220fe22b96ca66ae..7225201bfcea4412e4de5f3a664e8746a52c2edb 100644 (file)
@@ -1473,6 +1473,8 @@ static apr_status_t on_stream_headers(h2_session *session, h2_stream *stream,
          */
         if (!stream->initiated_on
             && !stream->has_response
+            && stream->request && stream->request->method
+            && !strcmp("GET", stream->request->method)
             && (headers->status < 400)
             && (headers->status != 304)
             && h2_session_push_enabled(session)) {
index ef185663a42baa6088a93cc1d70b7e2ed536683e..27a298b3b9d084d1a453e5990101060994213774 100644 (file)
@@ -26,7 +26,7 @@
  * @macro
  * Version number of the http2 module as c string
  */
-#define MOD_HTTP2_VERSION "1.8.0"
+#define MOD_HTTP2_VERSION "1.8.1"
 
 /**
  * @macro
@@ -34,7 +34,7 @@
  * release. This is a 24 bit number with 8 bits for major number, 8 bits
  * for minor and 8 bits for patch. Version 1.2.3 becomes 0x010203.
  */
-#define MOD_HTTP2_VERSION_NUM 0x010800
+#define MOD_HTTP2_VERSION_NUM 0x010801
 
 
 #endif /* mod_h2_h2_version_h */
index bbce1fc7ae96e73971aa7dfaac6a7c4455057bf2..1e2affabe1d5960c8ba44942b9a3107b9b4dff53 100644 (file)
@@ -335,14 +335,17 @@ static apr_status_t next_request(h2_proxy_ctx *ctx, int before_leave)
 
 static apr_status_t proxy_engine_run(h2_proxy_ctx *ctx) {
     apr_status_t status = OK;
+    int h2_front;
     
     /* Step Four: Send the Request in a new HTTP/2 stream and
      * loop until we got the response or encounter errors.
      */
     ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, ctx->owner, 
                   "eng(%s): setup session", ctx->engine_id);
-    ctx->session = h2_proxy_session_setup(ctx->engine_id, ctx->p_conn, ctx->conf, 
-                                          30, h2_proxy_log2((int)ctx->req_buffer_size), 
+    h2_front = is_h2? is_h2(ctx->owner) : 0;
+    ctx->session = h2_proxy_session_setup(ctx->engine_id, ctx->p_conn, ctx->conf,
+                                          h2_front, 30, 
+                                          h2_proxy_log2((int)ctx->req_buffer_size), 
                                           request_done);
     if (!ctx->session) {
         ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, ctx->owner,