Mercurial > hg > nginx
diff src/http/v3/ngx_http_v3_request.c @ 8838:d6e191a583cc quic
HTTP/3: bulk parse functions.
Previously HTTP/3 streams were parsed by one character. Now all parse functions
receive buffers. This should optimize parsing time and CPU load.
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Thu, 08 Jul 2021 21:52:47 +0300 |
parents | d8d48c977b0f |
children | e29c1ede905f |
line wrap: on
line diff
--- a/src/http/v3/ngx_http_v3_request.c Tue Aug 24 14:41:31 2021 +0300 +++ b/src/http/v3/ngx_http_v3_request.c Thu Jul 08 21:52:47 2021 +0300 @@ -207,6 +207,7 @@ static void ngx_http_v3_process_request(ngx_event_t *rev) { + u_char *p; ssize_t n; ngx_buf_t *b; ngx_int_t rc; @@ -273,7 +274,9 @@ b->last = b->start + n; } - rc = ngx_http_v3_parse_headers(c, st, *b->pos); + p = b->pos; + + rc = ngx_http_v3_parse_headers(c, st, b); if (rc > 0) { ngx_http_v3_finalize_connection(c, rc, @@ -302,8 +305,7 @@ break; } - b->pos++; - r->request_length++; + r->request_length += b->pos - p; if (rc == NGX_AGAIN) { continue; @@ -1024,6 +1026,7 @@ { off_t max; size_t size; + u_char *p; ngx_int_t rc; ngx_buf_t *b; ngx_uint_t last; @@ -1078,9 +1081,11 @@ while (cl->buf->pos < cl->buf->last) { if (st->length == 0) { - r->request_length++; + p = cl->buf->pos; - rc = ngx_http_v3_parse_data(r->connection, st, *cl->buf->pos++); + rc = ngx_http_v3_parse_data(r->connection, st, cl->buf); + + r->request_length += cl->buf->pos - p; if (rc == NGX_AGAIN) { continue;