Skip to content

Commit

Permalink
HTTP/2: fixed saving preread buffer to temp file (ticket #1143).
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
VBart committed Nov 28, 2016
1 parent 4c6e31a commit 89f92b3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/http/v2/ngx_http_v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -3575,6 +3575,9 @@ ngx_http_v2_read_request_body(ngx_http_request_t *r,
rb->buf = ngx_create_temp_buf(r->pool, (size_t) len);

} else {
/* enforce writing body to file */
r->request_body_in_file_only = 1;

rb->buf = ngx_calloc_buf(r->pool);

if (rb->buf != NULL) {
Expand Down

0 comments on commit 89f92b3

Please sign in to comment.