diff src/http/ngx_http_request.c @ 8456:c9538aef3211 quic

HTTP/3: refactored dynamic table implementation. Previously dynamic table was not functional because of zero limit on its size set by default. Now the following changes enable it: - new directives to set SETTINGS_QPACK_MAX_TABLE_CAPACITY and SETTINGS_QPACK_BLOCKED_STREAMS - send settings with SETTINGS_QPACK_MAX_TABLE_CAPACITY and SETTINGS_QPACK_BLOCKED_STREAMS to the client - send Insert Count Increment to the client - send Header Acknowledgement to the client - evict old dynamic table entries on overflow - decode Required Insert Count from client - block stream if Required Insert Count is not reached
author Roman Arutyunyan <arut@nginx.com>
date Thu, 02 Jul 2020 15:34:05 +0300
parents 833898b35b24
children 72f9ff4e0a88
line wrap: on
line diff
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -223,7 +223,17 @@ ngx_http_init_connection(ngx_connection_
 
 #if (NGX_HTTP_V3)
     if (c->type == SOCK_DGRAM) {
-        hc = ngx_pcalloc(c->pool, sizeof(ngx_http_v3_connection_t));
+        ngx_http_v3_connection_t  *h3c;
+
+        h3c = ngx_pcalloc(c->pool, sizeof(ngx_http_v3_connection_t));
+        if (h3c == NULL) {
+            ngx_http_close_connection(c);
+            return;
+        }
+
+        ngx_queue_init(&h3c->blocked);
+
+        hc = &h3c->hc;
         hc->quic = 1;
         hc->ssl = 1;
 
@@ -414,6 +424,13 @@ ngx_http_quic_stream_handler(ngx_connect
     pc = c->qs->parent;
     h3c = pc->data;
 
+    if (!h3c->settings_sent) {
+        h3c->settings_sent = 1;
+
+        /* TODO close QUIC connection on error */
+        (void) ngx_http_v3_send_settings(c);
+    }
+
     if (c->qs->id & NGX_QUIC_STREAM_UNIDIRECTIONAL) {
         ngx_http_v3_handle_client_uni_stream(c);
         return;
@@ -1255,7 +1272,7 @@ ngx_http_process_request_line(ngx_event_
             break;
         }
 
-        if (rc == NGX_DONE) {
+        if (rc == NGX_BUSY) {
             if (ngx_handle_read_event(rev, 0) != NGX_OK) {
                 ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
                 return;