Mercurial > hg > nginx
comparison src/http/ngx_http_request_body.c @ 7691:08ff2e10ae92
Request body: all read data are now sent to filters.
This is a prerequisite for the next change to allow large reads
on chunk boundaries.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Thu, 06 Aug 2020 05:02:44 +0300 |
parents | 2c4dbcd6f2e4 |
children | 0f7f1a509113 |
comparison
equal
deleted
inserted
replaced
7690:8253424d1aff | 7691:08ff2e10ae92 |
---|---|
280 | 280 |
281 for ( ;; ) { | 281 for ( ;; ) { |
282 for ( ;; ) { | 282 for ( ;; ) { |
283 if (rb->buf->last == rb->buf->end) { | 283 if (rb->buf->last == rb->buf->end) { |
284 | 284 |
285 if (rb->buf->pos != rb->buf->last) { | 285 /* update chains */ |
286 | 286 |
287 /* pass buffer to request body filter chain */ | 287 rc = ngx_http_request_body_filter(r, NULL); |
288 | 288 |
289 out.buf = rb->buf; | 289 if (rc != NGX_OK) { |
290 out.next = NULL; | 290 return rc; |
291 | |
292 rc = ngx_http_request_body_filter(r, &out); | |
293 | |
294 if (rc != NGX_OK) { | |
295 return rc; | |
296 } | |
297 | |
298 } else { | |
299 | |
300 /* update chains */ | |
301 | |
302 rc = ngx_http_request_body_filter(r, NULL); | |
303 | |
304 if (rc != NGX_OK) { | |
305 return rc; | |
306 } | |
307 } | 291 } |
308 | 292 |
309 if (rb->busy != NULL) { | 293 if (rb->busy != NULL) { |
310 if (r->request_body_no_buffering) { | 294 if (r->request_body_no_buffering) { |
311 if (c->read->timer_set) { | 295 if (c->read->timer_set) { |
353 } | 337 } |
354 | 338 |
355 rb->buf->last += n; | 339 rb->buf->last += n; |
356 r->request_length += n; | 340 r->request_length += n; |
357 | 341 |
358 if (n == rest) { | 342 /* pass buffer to request body filter chain */ |
359 /* pass buffer to request body filter chain */ | 343 |
360 | 344 out.buf = rb->buf; |
361 out.buf = rb->buf; | 345 out.next = NULL; |
362 out.next = NULL; | 346 |
363 | 347 rc = ngx_http_request_body_filter(r, &out); |
364 rc = ngx_http_request_body_filter(r, &out); | 348 |
365 | 349 if (rc != NGX_OK) { |
366 if (rc != NGX_OK) { | 350 return rc; |
367 return rc; | |
368 } | |
369 } | 351 } |
370 | 352 |
371 if (rb->rest == 0) { | 353 if (rb->rest == 0) { |
372 break; | 354 break; |
373 } | 355 } |
383 if (rb->rest == 0) { | 365 if (rb->rest == 0) { |
384 break; | 366 break; |
385 } | 367 } |
386 | 368 |
387 if (!c->read->ready) { | 369 if (!c->read->ready) { |
388 | |
389 if (r->request_body_no_buffering | |
390 && rb->buf->pos != rb->buf->last) | |
391 { | |
392 /* pass buffer to request body filter chain */ | |
393 | |
394 out.buf = rb->buf; | |
395 out.next = NULL; | |
396 | |
397 rc = ngx_http_request_body_filter(r, &out); | |
398 | |
399 if (rc != NGX_OK) { | |
400 return rc; | |
401 } | |
402 } | |
403 | 370 |
404 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); | 371 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); |
405 ngx_add_timer(c->read, clcf->client_body_timeout); | 372 ngx_add_timer(c->read, clcf->client_body_timeout); |
406 | 373 |
407 if (ngx_handle_read_event(c->read, 0) != NGX_OK) { | 374 if (ngx_handle_read_event(c->read, 0) != NGX_OK) { |