Mercurial > hg > nginx-quic
comparison src/http/modules/ngx_http_proxy_module.c @ 6056:24ccec3c4a87
Proxy: fixed proxy_request_buffering and chunked with preread body.
If any preread body bytes were sent in the first chain, chunk size was
incorrectly added before the whole chain, including header, resulting in
an invalid request sent to upstream. Fixed to properly add chunk size
after the header.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Thu, 26 Mar 2015 02:31:30 +0300 |
parents | d97e6be2d292 |
children | b2899e7d0ef8 |
comparison
equal
deleted
inserted
replaced
6055:166c2c19c522 | 6056:24ccec3c4a87 |
---|---|
1501 | 1501 |
1502 off_t size; | 1502 off_t size; |
1503 u_char *chunk; | 1503 u_char *chunk; |
1504 ngx_int_t rc; | 1504 ngx_int_t rc; |
1505 ngx_buf_t *b; | 1505 ngx_buf_t *b; |
1506 ngx_chain_t *out, *cl, *tl, **ll; | 1506 ngx_chain_t *out, *cl, *tl, **ll, **fl; |
1507 ngx_http_proxy_ctx_t *ctx; | 1507 ngx_http_proxy_ctx_t *ctx; |
1508 | 1508 |
1509 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | 1509 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
1510 "proxy output filter"); | 1510 "proxy output filter"); |
1511 | 1511 |
1544 } | 1544 } |
1545 } | 1545 } |
1546 | 1546 |
1547 size = 0; | 1547 size = 0; |
1548 cl = in; | 1548 cl = in; |
1549 fl = ll; | |
1549 | 1550 |
1550 for ( ;; ) { | 1551 for ( ;; ) { |
1551 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | 1552 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
1552 "proxy output chunk: %d", ngx_buf_size(cl->buf)); | 1553 "proxy output chunk: %d", ngx_buf_size(cl->buf)); |
1553 | 1554 |
1600 b->memory = 0; | 1601 b->memory = 0; |
1601 b->temporary = 1; | 1602 b->temporary = 1; |
1602 b->pos = chunk; | 1603 b->pos = chunk; |
1603 b->last = ngx_sprintf(chunk, "%xO" CRLF, size); | 1604 b->last = ngx_sprintf(chunk, "%xO" CRLF, size); |
1604 | 1605 |
1605 tl->next = out; | 1606 tl->next = *fl; |
1606 out = tl; | 1607 *fl = tl; |
1607 } | 1608 } |
1608 | 1609 |
1609 if (cl->buf->last_buf) { | 1610 if (cl->buf->last_buf) { |
1610 tl = ngx_chain_get_free_buf(r->pool, &ctx->free); | 1611 tl = ngx_chain_get_free_buf(r->pool, &ctx->free); |
1611 if (tl == NULL) { | 1612 if (tl == NULL) { |