Mercurial > hg > nginx
comparison src/http/v3/ngx_http_v3_request.c @ 8295:5649079a41f4 quic
Parsing HTTP/3 request body.
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Fri, 27 Mar 2020 19:41:06 +0300 |
parents | 46e3542d51b3 |
children | 7bd334b8d91a |
comparison
equal
deleted
inserted
replaced
8294:32db41d603cd | 8295:5649079a41f4 |
---|---|
239 | 239 |
240 return NGX_OK; | 240 return NGX_OK; |
241 } | 241 } |
242 | 242 |
243 | 243 |
244 ngx_int_t | |
245 ngx_http_v3_parse_request_body(ngx_http_request_t *r, ngx_buf_t *b, | |
246 ngx_http_chunked_t *ctx) | |
247 { | |
248 ngx_int_t rc; | |
249 ngx_connection_t *c; | |
250 ngx_http_v3_parse_data_t *st; | |
251 | |
252 c = r->connection; | |
253 st = ctx->h3_parse; | |
254 | |
255 if (st == NULL) { | |
256 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, | |
257 "http3 parse request body"); | |
258 | |
259 st = ngx_pcalloc(c->pool, sizeof(ngx_http_v3_parse_data_t)); | |
260 if (st == NULL) { | |
261 goto failed; | |
262 } | |
263 | |
264 r->h3_parse = st; | |
265 } | |
266 | |
267 if (ctx->size) { | |
268 return NGX_OK; | |
269 } | |
270 | |
271 while (b->pos < b->last) { | |
272 rc = ngx_http_v3_parse_data(c, st, *b->pos++); | |
273 | |
274 if (rc == NGX_ERROR) { | |
275 goto failed; | |
276 } | |
277 | |
278 if (rc == NGX_AGAIN) { | |
279 continue; | |
280 } | |
281 | |
282 /* rc == NGX_DONE */ | |
283 | |
284 ctx->size = st->length; | |
285 return NGX_OK; | |
286 } | |
287 | |
288 if (!b->last_buf) { | |
289 ctx->length = 1; | |
290 return NGX_AGAIN; | |
291 } | |
292 | |
293 if (st->state) { | |
294 goto failed; | |
295 } | |
296 | |
297 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http3 parse header done"); | |
298 | |
299 return NGX_DONE; | |
300 | |
301 failed: | |
302 | |
303 return NGX_ERROR; | |
304 } | |
305 | |
306 | |
244 ngx_chain_t * | 307 ngx_chain_t * |
245 ngx_http_v3_create_header(ngx_http_request_t *r) | 308 ngx_http_v3_create_header(ngx_http_request_t *r) |
246 { | 309 { |
247 u_char *p; | 310 u_char *p; |
248 size_t len, n; | 311 size_t len, n; |