From 4b440cbf97af3ffe0ab31cb083fb1ce5b0fb5f89 Mon Sep 17 00:00:00 2001 From: Roman Arutyunyan Date: Fri, 27 Nov 2020 17:46:21 +0000 Subject: HTTP/3: introduced ngx_http_v3_filter. The filter is responsible for creating HTTP/3 response header and body. The change removes differences to the default branch for ngx_http_chunked_filter_module and ngx_http_header_filter_module. --- src/http/modules/ngx_http_chunked_filter_module.c | 50 ++--------------------- 1 file changed, 4 insertions(+), 46 deletions(-) (limited to 'src/http/modules') diff --git a/src/http/modules/ngx_http_chunked_filter_module.c b/src/http/modules/ngx_http_chunked_filter_module.c index 138369815..4d6fd3eed 100644 --- a/src/http/modules/ngx_http_chunked_filter_module.c +++ b/src/http/modules/ngx_http_chunked_filter_module.c @@ -106,7 +106,6 @@ ngx_http_chunked_body_filter(ngx_http_request_t *r, ngx_chain_t *in) { u_char *chunk; off_t size; - size_t n; ngx_int_t rc; ngx_buf_t *b; ngx_chain_t *out, *cl, *tl, **ll; @@ -162,68 +161,27 @@ ngx_http_chunked_body_filter(ngx_http_request_t *r, ngx_chain_t *in) chunk = b->start; if (chunk == NULL) { + /* the "0000000000000000" is 64-bit hexadecimal string */ -#if (NGX_HTTP_V3) - if (r->http_version == NGX_HTTP_VERSION_30) { - n = NGX_HTTP_V3_VARLEN_INT_LEN * 2; - - } else -#endif - { - /* the "0000000000000000" is 64-bit hexadecimal string */ - n = sizeof("0000000000000000" CRLF) - 1; - } - - chunk = ngx_palloc(r->pool, n); + chunk = ngx_palloc(r->pool, sizeof("0000000000000000" CRLF) - 1); if (chunk == NULL) { return NGX_ERROR; } b->start = chunk; - b->end = chunk + n; + b->end = chunk + sizeof("0000000000000000" CRLF) - 1; } b->tag = (ngx_buf_tag_t) &ngx_http_chunked_filter_module; b->memory = 0; b->temporary = 1; b->pos = chunk; - -#if (NGX_HTTP_V3) - if (r->http_version == NGX_HTTP_VERSION_30) { - b->last = (u_char *) ngx_http_v3_encode_varlen_int(chunk, - NGX_HTTP_V3_FRAME_DATA); - b->last = (u_char *) ngx_http_v3_encode_varlen_int(b->last, size); - - } else -#endif - { - b->last = ngx_sprintf(chunk, "%xO" CRLF, size); - } + b->last = ngx_sprintf(chunk, "%xO" CRLF, size); tl->next = out; out = tl; } -#if (NGX_HTTP_V3) - if (r->http_version == NGX_HTTP_VERSION_30) { - - if (cl->buf->last_buf) { - tl = ngx_http_v3_create_trailers(r); - if (tl == NULL) { - return NGX_ERROR; - } - - cl->buf->last_buf = 0; - - *ll = tl; - - } else { - *ll = NULL; - } - - } else -#endif - if (cl->buf->last_buf) { tl = ngx_http_chunked_create_trailers(r, ctx); if (tl == NULL) { -- cgit