Mercurial > hg > nginx
comparison src/http/v2/ngx_http_v2.c @ 6805:52bd8cc17f34
HTTP/2: fixed saving preread buffer to temp file (ticket #1143).
Previously, a request body bigger than "client_body_buffer_size" wasn't written
into a temporary file if it has been pre-read entirely. The preread buffer
is freed after processing, thus subsequent use of it might result in sending
corrupted body or cause a segfault.
author | Valentin Bartenev <vbart@nginx.com> |
---|---|
date | Mon, 28 Nov 2016 19:19:21 +0300 |
parents | 727c6412673a |
children | 3834951e32ab |
comparison
equal
deleted
inserted
replaced
6804:2c7a2d75938a | 6805:52bd8cc17f34 |
---|---|
3573 && !r->request_body_in_file_only) | 3573 && !r->request_body_in_file_only) |
3574 { | 3574 { |
3575 rb->buf = ngx_create_temp_buf(r->pool, (size_t) len); | 3575 rb->buf = ngx_create_temp_buf(r->pool, (size_t) len); |
3576 | 3576 |
3577 } else { | 3577 } else { |
3578 /* enforce writing body to file */ | |
3579 r->request_body_in_file_only = 1; | |
3580 | |
3578 rb->buf = ngx_calloc_buf(r->pool); | 3581 rb->buf = ngx_calloc_buf(r->pool); |
3579 | 3582 |
3580 if (rb->buf != NULL) { | 3583 if (rb->buf != NULL) { |
3581 rb->buf->sync = 1; | 3584 rb->buf->sync = 1; |
3582 } | 3585 } |