diff src/http/v3/ngx_http_v3.c @ 8986:6546c2ae1c7b quic

HTTP/3: unified hq code with regular HTTP/3 code. The change removes hq-specific request handler. Now hq requests are handled by the HTTP/3 request handler.
author Roman Arutyunyan <arut@nginx.com>
date Wed, 19 Oct 2022 17:45:30 +0400
parents 81a3429db8b0
children be39ffdf9208
line wrap: on
line diff
--- a/src/http/v3/ngx_http_v3.c
+++ b/src/http/v3/ngx_http_v3.c
@@ -17,10 +17,13 @@ static void ngx_http_v3_cleanup_session(
 ngx_int_t
 ngx_http_v3_init_session(ngx_connection_t *c)
 {
-    ngx_connection_t       *pc;
-    ngx_pool_cleanup_t     *cln;
-    ngx_http_connection_t  *hc;
-    ngx_http_v3_session_t  *h3c;
+    ngx_connection_t        *pc;
+    ngx_pool_cleanup_t      *cln;
+    ngx_http_connection_t   *hc;
+    ngx_http_v3_session_t   *h3c;
+#if (NGX_HTTP_V3_HQ)
+    ngx_http_v3_srv_conf_t  *h3scf;
+#endif
 
     pc = c->quic->parent;
     hc = pc->data;
@@ -39,6 +42,13 @@ ngx_http_v3_init_session(ngx_connection_
     h3c->max_push_id = (uint64_t) -1;
     h3c->goaway_push_id = (uint64_t) -1;
 
+#if (NGX_HTTP_V3_HQ)
+    h3scf = ngx_http_get_module_srv_conf(hc->conf_ctx, ngx_http_v3_module);
+    if (h3scf->hq) {
+        h3c->hq = 1;
+    }
+#endif
+
     ngx_queue_init(&h3c->blocked);
     ngx_queue_init(&h3c->pushing);
 
@@ -61,6 +71,12 @@ ngx_http_v3_init_session(ngx_connection_
 
     hc->v3_session = h3c;
 
+#if (NGX_HTTP_V3_HQ)
+    if (h3c->hq) {
+        return NGX_OK;
+    }
+#endif
+
     return ngx_http_v3_send_settings(c);
 
 failed: