]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
*) mod_http2: when pollset signals output, resume a streams data
authorStefan Eissing <icing@apache.org>
Thu, 14 Oct 2021 10:18:17 +0000 (10:18 +0000)
committerStefan Eissing <icing@apache.org>
Thu, 14 Oct 2021 10:18:17 +0000 (10:18 +0000)
     in nghttp2 every time without checks that response body bytes
     are available. This resolves the situation that a stream may stall
     when 2 consecutive H2HEADER buckets are sent (e.g. 103+200).

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1894228 13f79535-47bb-0310-9956-ffa450edef68

modules/http2/h2_stream.c

index 274ee15707245faf988aa94e1696ee03c9c99446..4e8aaa09bb8d052a49706e175a71f267e4a1784f 100644 (file)
@@ -824,7 +824,7 @@ static apr_status_t buffer_output_receive(h2_stream *stream)
         buf_len = 0;
     }
     else {
-        /* if the brigade contains a file bucket, it normal report length
+        /* if the brigade contains a file bucket, its normal report length
          * might be megabytes, but the memory used is tiny. For buffering,
          * we are only interested in the memory footprint. */
         buf_len = h2_brigade_mem_size(stream->out_buffer);
@@ -1336,8 +1336,6 @@ apr_status_t h2_stream_read_output(h2_stream *stream)
 {
     conn_rec *c1 = stream->session->c1;
     apr_status_t rv = APR_EAGAIN;
-    apr_off_t buf_len;
-    int eos;
 
     /* stream->pout_recv_write signalled a change. Check what has happend, read
      * from it and act on seeing a response/data. */
@@ -1369,22 +1367,17 @@ apr_status_t h2_stream_read_output(h2_stream *stream)
         goto cleanup;
     }
 
-    buf_len = buffer_output_data_to_send(stream, &eos);
-    if (buf_len < stream->session->io.write_size) {
-        rv = buffer_output_receive(stream);
-        if (APR_SUCCESS == rv) {
-            /* process any headers sitting at the buffer head. */
-            rv = buffer_output_process_headers(stream);
-            if (APR_SUCCESS != rv) goto cleanup;
-        }
-        buf_len = buffer_output_data_to_send(stream, &eos);
-        if (buf_len || eos) {
-            nghttp2_session_resume_data(stream->session->ngh2, stream->id);
-            ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, c1,
-                          "h2_stream(%ld-%d): resumed",
-                          stream->session->id, (int)stream->id);
-        }
-    }
+    rv = buffer_output_receive(stream);
+    if (APR_SUCCESS != rv) goto cleanup;
+
+    /* process any headers sitting at the buffer head. */
+    rv = buffer_output_process_headers(stream);
+    if (APR_SUCCESS != rv) goto cleanup;
+
+    nghttp2_session_resume_data(stream->session->ngh2, stream->id);
+    ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, c1,
+                  "h2_stream(%ld-%d): resumed",
+                  stream->session->id, (int)stream->id);
 
 cleanup:
     return rv;