]> granicus.if.org Git - apache/commitdiff
mod_proxy_http2: improved retry when encountering errored/shutdown connections
authorStefan Eissing <icing@apache.org>
Tue, 21 Jun 2016 13:37:38 +0000 (13:37 +0000)
committerStefan Eissing <icing@apache.org>
Tue, 21 Jun 2016 13:37:38 +0000 (13:37 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1749505 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
modules/http2/h2_proxy_session.c

diff --git a/CHANGES b/CHANGES
index 229e85f65184363f7e08f207a021e16c479651fc..c7e8d62f06fcc8a0bc1b4ffc51cc26413e26edb7 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.0
 
+  *) mod_proxy_http2: improved retry behaviour when encountering timed out
+     or shut down connections. [Stefan Eissing] 
+
   *) mod_sed: Fix 'x' command processing. [Christophe Jaillet]
 
   *) core: Drop an invalid Last-Modified header value coming
index b7dadca147d15dcc0acd82ccaad46c6755983c20..0cb5b1c342ce3d942a8413c17d301cd89ce6ea8c 100644 (file)
@@ -40,7 +40,9 @@ typedef struct h2_proxy_stream {
 
     h2_stream_state_t state;
     unsigned int suspended : 1;
+    unsigned int data_sent : 1;
     unsigned int data_received : 1;
+    uint32_t error_code;
 
     apr_bucket_brigade *input;
     apr_bucket_brigade *output;
@@ -384,10 +386,15 @@ static int on_stream_close(nghttp2_session *ngh2, int32_t stream_id,
                            uint32_t error_code, void *user_data) 
 {
     h2_proxy_session *session = user_data;
+    h2_proxy_stream *stream;
     if (!session->aborted) {
         ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, APLOGNO(03360)
                       "h2_proxy_session(%s): stream=%d, closed, err=%d", 
                       session->id, stream_id, error_code);
+        stream = h2_ihash_get(session->streams, stream_id);
+        if (stream) {
+            stream->error_code = error_code;
+        }
         dispatch_event(session, H2_PROXYS_EV_STREAM_DONE, stream_id, NULL);
     }
     return 0;
@@ -480,6 +487,7 @@ static ssize_t stream_data_read(nghttp2_session *ngh2, int32_t stream_id,
         ap_log_rerror(APLOG_MARK, APLOG_TRACE2, status, stream->r, 
                       "h2_proxy_stream(%d): request body read %ld bytes, flags=%d", 
                       stream->id, (long)readlen, (int)*data_flags);
+        stream->data_sent = 1;
         return readlen;
     }
     else if (APR_STATUS_IS_EAGAIN(status)) {
@@ -1069,7 +1077,10 @@ static void ev_stream_done(h2_proxy_session *session, int stream_id,
         h2_ihash_remove(session->streams, stream_id);
         h2_iq_remove(session->suspended, stream_id);
         if (session->done) {
-            session->done(session, stream->r, 1, 1);
+            int touched = (stream->data_sent || 
+                           stream_id <= session->last_stream_id);
+            int complete = (stream->error_code == 0);
+            session->done(session, stream->r, complete, touched);
         }
     }