Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nginx/nginx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/http/modules/proxy/ngx_http_proxy_upstream.c')
-rw-r--r--src/http/modules/proxy/ngx_http_proxy_upstream.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/http/modules/proxy/ngx_http_proxy_upstream.c b/src/http/modules/proxy/ngx_http_proxy_upstream.c
new file mode 100644
index 000000000..532e313d6
--- /dev/null
+++ b/src/http/modules/proxy/ngx_http_proxy_upstream.c
@@ -0,0 +1,43 @@
+
+#include <ngx_config.h>
+#include <ngx_core.h>
+#include <ngx_event.h>
+#include <ngx_event_connect.h>
+#include <ngx_event_pipe.h>
+#include <ngx_http.h>
+#include <ngx_http_proxy_handler.h>
+
+
+void ngx_http_proxy_reinit_upstream(ngx_http_proxy_ctx_t *p)
+{
+ ngx_chain_t *cl;
+ ngx_output_chain_ctx_t *octx;
+
+ octx = p->output_chain_ctx;
+
+ /* reinit the request chain */
+
+ for (cl = p->request->request_hunks; cl; cl = cl->next) {
+ cl->hunk->pos = cl->hunk->start;
+ }
+
+ /* reinit ngx_output_chain() context */
+
+ octx->hunk = NULL;
+ octx->in = NULL;
+ octx->free = NULL;
+ octx->busy = NULL;
+
+ /* reinit r->header_in buffer */
+
+ if (p->header_in) {
+ if (p->cache) {
+ p->header_in->pos = p->header_in->start + p->cache->ctx.header.size;
+ p->header_in->last = p->header_in->pos;
+
+ } else {
+ p->header_in->pos = p->header_in->start;
+ p->header_in->last = p->header_in->start;
+ }
+ }
+}