diff src/http/ngx_http_request.c @ 8226:268f4389130d quic

Refactored HTTP/3 parser.
author Roman Arutyunyan <arut@nginx.com>
date Wed, 18 Mar 2020 13:46:35 +0300
parents 1307308c3cf1
children 1e45c02f6376
line wrap: on
line diff
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -1163,7 +1163,7 @@ ngx_http_process_request_line(ngx_event_
         switch (r->http_version) {
 #if (NGX_HTTP_V3)
         case NGX_HTTP_VERSION_30:
-            rc = ngx_http_v3_parse_header(r, r->header_in, 1);
+            rc = ngx_http_v3_parse_header(r, r->header_in);
             break;
 #endif
 
@@ -1510,7 +1510,7 @@ ngx_http_process_request_headers(ngx_eve
         switch (r->http_version) {
 #if (NGX_HTTP_V3)
         case NGX_HTTP_VERSION_30:
-            rc = ngx_http_v3_parse_header(r, r->header_in, 0);
+            rc = ngx_http_v3_parse_header(r, r->header_in);
             break;
 #endif
 
@@ -1547,11 +1547,17 @@ ngx_http_process_request_headers(ngx_eve
 
             h->key.len = r->header_name_end - r->header_name_start;
             h->key.data = r->header_name_start;
-            h->key.data[h->key.len] = '\0';
+
+            if (h->key.data[h->key.len]) {
+                h->key.data[h->key.len] = '\0';
+            }
 
             h->value.len = r->header_end - r->header_start;
             h->value.data = r->header_start;
-            h->value.data[h->value.len] = '\0';
+
+            if (h->value.data[h->value.len]) {
+                h->value.data[h->value.len] = '\0';
+            }
 
             h->lowcase_key = ngx_pnalloc(r->pool, h->key.len);
             if (h->lowcase_key == NULL) {