]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
mod_http2: move get_pollfd_from_conn hook outside the HAS_RESPONSE_BUCKET part
authorStefan Eissing <icing@apache.org>
Thu, 29 Jun 2023 09:28:24 +0000 (09:28 +0000)
committerStefan Eissing <icing@apache.org>
Thu, 29 Jun 2023 09:28:24 +0000 (09:28 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1910685 13f79535-47bb-0310-9956-ffa450edef68

modules/http2/h2_c2.c

index 783a297fe0ba58a7a68c30db804c1d6c88a6af24..9ca888f9e4c700e505cb6530d2b13ed09257e4fb 100644 (file)
@@ -469,6 +469,33 @@ static int c2_hook_fixups(request_rec *r)
     return DECLINED;
 }
 
+#if H2_USE_POLLFD_FROM_CONN
+static apr_status_t c2_get_pollfd_from_conn(conn_rec *c,
+                                            struct apr_pollfd_t *pfd,
+                                            apr_interval_time_t *ptimeout)
+{
+    if (c->master) {
+        h2_conn_ctx_t *ctx = h2_conn_ctx_get(c);
+        if (ctx) {
+            if (ctx->beam_in && ctx->pipe_in[H2_PIPE_OUT]) {
+                pfd->desc_type = APR_POLL_FILE;
+                pfd->desc.f = ctx->pipe_in[H2_PIPE_OUT];
+                if (ptimeout)
+                    *ptimeout = h2_beam_timeout_get(ctx->beam_in);
+            }
+            else {
+                /* no input */
+                pfd->desc_type = APR_NO_DESC;
+                if (ptimeout)
+                    *ptimeout = -1;
+            }
+            return APR_SUCCESS;
+        }
+    }
+    return APR_ENOTIMPL;
+}
+#endif
+
 #if AP_HAS_RESPONSE_BUCKETS
 
 static void c2_pre_read_request(request_rec *r, conn_rec *c2)
@@ -559,33 +586,6 @@ static int c2_hook_pre_connection(conn_rec *c2, void *csd)
     return OK;
 }
 
-#if H2_USE_POLLFD_FROM_CONN
-static apr_status_t c2_get_pollfd_from_conn(conn_rec *c,
-                                            struct apr_pollfd_t *pfd,
-                                            apr_interval_time_t *ptimeout)
-{
-    if (c->master) {
-        h2_conn_ctx_t *ctx = h2_conn_ctx_get(c);
-        if (ctx) {
-            if (ctx->beam_in && ctx->pipe_in[H2_PIPE_OUT]) {
-                pfd->desc_type = APR_POLL_FILE;
-                pfd->desc.f = ctx->pipe_in[H2_PIPE_OUT];
-                if (ptimeout)
-                    *ptimeout = h2_beam_timeout_get(ctx->beam_in);
-            }
-            else {
-                /* no input */
-                pfd->desc_type = APR_NO_DESC;
-                if (ptimeout)
-                    *ptimeout = -1;
-            }
-            return APR_SUCCESS;
-        }
-    }
-    return APR_ENOTIMPL;
-}
-#endif
-
 void h2_c2_register_hooks(void)
 {
     /* When the connection processing actually starts, we might
@@ -912,6 +912,10 @@ void h2_c2_register_hooks(void)
      * install our own. This needs to be done very early. */
     ap_hook_post_read_request(h2_c2_hook_post_read_request, NULL, NULL, APR_HOOK_REALLY_FIRST);
     ap_hook_fixups(c2_hook_fixups, NULL, NULL, APR_HOOK_LAST);
+#if H2_USE_POLLFD_FROM_CONN
+    ap_hook_get_pollfd_from_conn(c2_get_pollfd_from_conn, NULL, NULL,
+                                 APR_HOOK_MIDDLE);
+#endif
 
     ap_register_input_filter("H2_C2_NET_IN", h2_c2_filter_in,
                              NULL, AP_FTYPE_NETWORK);