aboutsummaryrefslogtreecommitdiff
path: root/src/http/v3/ngx_http_v3_request.c
diff options
context:
space:
mode:
authorRoman Arutyunyan <arut@nginx.com>2020-11-25 17:57:43 +0000
committerRoman Arutyunyan <arut@nginx.com>2020-11-25 17:57:43 +0000
commit7cfc5eb11fbfe3beb9d793dbacae70fb658d46c2 (patch)
treeb63a794cf1330bb69c0c137c0387265792fea785 /src/http/v3/ngx_http_v3_request.c
parent9129fb3db9e2f9899161e9573e7a19c774a0df6a (diff)
downloadnginx-7cfc5eb11fbfe3beb9d793dbacae70fb658d46c2.tar.gz
nginx-7cfc5eb11fbfe3beb9d793dbacae70fb658d46c2.zip
HTTP/3: eliminated r->method_start.
The field was introduced to ease parsing HTTP/3 requests. The change reduces diff to the default branch.
Diffstat (limited to 'src/http/v3/ngx_http_v3_request.c')
-rw-r--r--src/http/v3/ngx_http_v3_request.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/http/v3/ngx_http_v3_request.c b/src/http/v3/ngx_http_v3_request.c
index 5511e3031..2ff0440d9 100644
--- a/src/http/v3/ngx_http_v3_request.c
+++ b/src/http/v3/ngx_http_v3_request.c
@@ -129,11 +129,9 @@ ngx_http_v3_parse_request(ngx_http_request_t *r, ngx_buf_t *b)
continue;
}
- ngx_str_set(&r->http_protocol, "HTTP/3.0");
-
- len = (r->method_end - r->method_start) + 1
+ len = r->method_name.len + 1
+ (r->uri_end - r->uri_start) + 1
- + sizeof("HTTP/3") - 1;
+ + sizeof("HTTP/3.0") - 1;
p = ngx_pnalloc(c->pool, len);
if (p == NULL) {
@@ -142,11 +140,13 @@ ngx_http_v3_parse_request(ngx_http_request_t *r, ngx_buf_t *b)
r->request_start = p;
- p = ngx_cpymem(p, r->method_start, r->method_end - r->method_start);
+ p = ngx_cpymem(p, r->method_name.data, r->method_name.len);
+ r->method_end = p - 1;
*p++ = ' ';
p = ngx_cpymem(p, r->uri_start, r->uri_end - r->uri_start);
*p++ = ' ';
- p = ngx_cpymem(p, "HTTP/3", sizeof("HTTP/3") - 1);
+ r->http_protocol.data = p;
+ p = ngx_cpymem(p, "HTTP/3.0", sizeof("HTTP/3.0") - 1);
r->request_end = p;
r->state = 0;
@@ -309,8 +309,7 @@ ngx_http_v3_process_pseudo_header(ngx_http_request_t *r, ngx_str_t *name,
c = r->connection;
if (name->len == 7 && ngx_strncmp(name->data, ":method", 7) == 0) {
- r->method_start = value->data;
- r->method_end = value->data + value->len;
+ r->method_name = *value;
for (i = 0; i < sizeof(ngx_http_v3_methods)
/ sizeof(ngx_http_v3_methods[0]); i++)