summaryrefslogtreecommitdiffhomepage
path: root/src/http/modules
diff options
context:
space:
mode:
authorRoman Arutyunyan <arut@nginx.com>2018-02-28 16:56:58 +0300
committerRoman Arutyunyan <arut@nginx.com>2018-02-28 16:56:58 +0300
commit7c5c15a25d22b05f1baabfb14395a7924fe4fd8c (patch)
treebacddae8536e0747fa68e66d3e913d4aef9f93b6 /src/http/modules
parent2d9db482aa92194a2258334545908d620b6dd214 (diff)
downloadnginx-7c5c15a25d22b05f1baabfb14395a7924fe4fd8c.tar.gz
nginx-7c5c15a25d22b05f1baabfb14395a7924fe4fd8c.tar.bz2
Generic subrequests in memory.
Previously, only the upstream response body could be accessed with the NGX_HTTP_SUBREQUEST_IN_MEMORY feature. Now any response body from a subrequest can be saved in a memory buffer. It is available as a single buffer in r->out and the buffer size is configured by the subrequest_output_buffer_size directive. Upstream, proxy and fastcgi code used to handle the old-style feature is removed.
Diffstat (limited to 'src/http/modules')
-rw-r--r--src/http/modules/ngx_http_fastcgi_module.c30
-rw-r--r--src/http/modules/ngx_http_proxy_module.c30
-rw-r--r--src/http/modules/ngx_http_ssi_filter_module.c8
3 files changed, 5 insertions, 63 deletions
diff --git a/src/http/modules/ngx_http_fastcgi_module.c b/src/http/modules/ngx_http_fastcgi_module.c
index b4bb1d0a5..c3f5c4a41 100644
--- a/src/http/modules/ngx_http_fastcgi_module.c
+++ b/src/http/modules/ngx_http_fastcgi_module.c
@@ -2512,36 +2512,6 @@ ngx_http_fastcgi_non_buffered_filter(void *data, ssize_t bytes)
break;
}
- /* provide continuous buffer for subrequests in memory */
-
- if (r->subrequest_in_memory) {
-
- cl = u->out_bufs;
-
- if (cl) {
- buf->pos = cl->buf->pos;
- }
-
- buf->last = buf->pos;
-
- for (cl = u->out_bufs; cl; cl = cl->next) {
- ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
- "http fastcgi in memory %p-%p %O",
- cl->buf->pos, cl->buf->last, ngx_buf_size(cl->buf));
-
- if (buf->last == cl->buf->pos) {
- buf->last = cl->buf->last;
- continue;
- }
-
- buf->last = ngx_movemem(buf->last, cl->buf->pos,
- cl->buf->last - cl->buf->pos);
-
- cl->buf->pos = buf->last - (cl->buf->last - cl->buf->pos);
- cl->buf->last = buf->last;
- }
- }
-
return NGX_OK;
}
diff --git a/src/http/modules/ngx_http_proxy_module.c b/src/http/modules/ngx_http_proxy_module.c
index efb4bed8e..9e4ea940d 100644
--- a/src/http/modules/ngx_http_proxy_module.c
+++ b/src/http/modules/ngx_http_proxy_module.c
@@ -2321,36 +2321,6 @@ ngx_http_proxy_non_buffered_chunked_filter(void *data, ssize_t bytes)
return NGX_ERROR;
}
- /* provide continuous buffer for subrequests in memory */
-
- if (r->subrequest_in_memory) {
-
- cl = u->out_bufs;
-
- if (cl) {
- buf->pos = cl->buf->pos;
- }
-
- buf->last = buf->pos;
-
- for (cl = u->out_bufs; cl; cl = cl->next) {
- ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
- "http proxy in memory %p-%p %O",
- cl->buf->pos, cl->buf->last, ngx_buf_size(cl->buf));
-
- if (buf->last == cl->buf->pos) {
- buf->last = cl->buf->last;
- continue;
- }
-
- buf->last = ngx_movemem(buf->last, cl->buf->pos,
- cl->buf->last - cl->buf->pos);
-
- cl->buf->pos = buf->last - (cl->buf->last - cl->buf->pos);
- cl->buf->last = buf->last;
- }
- }
-
return NGX_OK;
}
diff --git a/src/http/modules/ngx_http_ssi_filter_module.c b/src/http/modules/ngx_http_ssi_filter_module.c
index c799b2f1f..d608df9df 100644
--- a/src/http/modules/ngx_http_ssi_filter_module.c
+++ b/src/http/modules/ngx_http_ssi_filter_module.c
@@ -2231,9 +2231,11 @@ ngx_http_ssi_set_variable(ngx_http_request_t *r, void *data, ngx_int_t rc)
{
ngx_str_t *value = data;
- if (r->upstream) {
- value->len = r->upstream->buffer.last - r->upstream->buffer.pos;
- value->data = r->upstream->buffer.pos;
+ if (r->headers_out.status < NGX_HTTP_SPECIAL_RESPONSE
+ && r->out && r->out->buf)
+ {
+ value->len = r->out->buf->last - r->out->buf->pos;
+ value->data = r->out->buf->pos;
}
return rc;