diff options
author | Roman Arutyunyan <arut@nginx.com> | 2020-03-27 19:41:06 +0300 |
---|---|---|
committer | Roman Arutyunyan <arut@nginx.com> | 2020-03-27 19:41:06 +0300 |
commit | fa1e1beadca8b1ea900ec654919aea58762ab746 (patch) | |
tree | 772a9443d24831a11fae49b2493a87fa6f6d4a94 /src/http/v3/ngx_http_v3_parse.c | |
parent | 84a783501590e13ab27277e11f179067c08d38b3 (diff) | |
download | nginx-fa1e1beadca8b1ea900ec654919aea58762ab746.tar.gz nginx-fa1e1beadca8b1ea900ec654919aea58762ab746.zip |
Parsing HTTP/3 request body.
Diffstat (limited to 'src/http/v3/ngx_http_v3_parse.c')
-rw-r--r-- | src/http/v3/ngx_http_v3_parse.c | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/src/http/v3/ngx_http_v3_parse.c b/src/http/v3/ngx_http_v3_parse.c index 0fd44bc40..3be3802ed 100644 --- a/src/http/v3/ngx_http_v3_parse.c +++ b/src/http/v3/ngx_http_v3_parse.c @@ -1421,3 +1421,61 @@ done: st->state = sw_start; return NGX_DONE; } + + +ngx_int_t +ngx_http_v3_parse_data(ngx_connection_t *c, ngx_http_v3_parse_data_t *st, + u_char ch) +{ + enum { + sw_start = 0, + sw_type, + sw_length + }; + + switch (st->state) { + + case sw_start: + + ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http3 parse data"); + + st->state = sw_type; + + /* fall through */ + + case sw_type: + + if (ngx_http_v3_parse_varlen_int(c, &st->vlint, ch) != NGX_DONE) { + break; + } + + if (st->vlint.value != NGX_HTTP_V3_FRAME_DATA) { + return NGX_ERROR; + } + + st->state = sw_length; + break; + + case sw_length: + + if (ngx_http_v3_parse_varlen_int(c, &st->vlint, ch) != NGX_DONE) { + break; + } + + st->length = st->vlint.value; + + ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, + "http3 parse data frame len:%ui", st->length); + + goto done; + } + + return NGX_AGAIN; + +done: + + ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http3 parse data done"); + + st->state = sw_start; + return NGX_DONE; +} |