diff options
author | Glenn Strauss <gstrauss@gluelogic.com> | 2021-06-18 20:31:58 -0400 |
---|---|---|
committer | Glenn Strauss <gstrauss@gluelogic.com> | 2021-08-27 02:16:54 -0400 |
commit | 9f82ba8fab9d0807849fe36bac4135255eb1e2ff (patch) | |
tree | 3e509fe7b8dfbe4afbadc020d7fa183d9a4a4099 /src/mod_proxy.c | |
parent | f2cdee2430c6737610017e5e912aa5bbf676dfbd (diff) | |
download | lighttpd-git-9f82ba8fab9d0807849fe36bac4135255eb1e2ff.tar.gz |
[mod_proxy] proxy_response_headers load v earlier
proxy_response_headers() issue variable load slightly earlier
Diffstat (limited to 'src/mod_proxy.c')
-rw-r--r-- | src/mod_proxy.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/mod_proxy.c b/src/mod_proxy.c index fd5a5f61..7865b021 100644 --- a/src/mod_proxy.c +++ b/src/mod_proxy.c @@ -1034,9 +1034,10 @@ static handler_t proxy_create_env_connect(gw_handler_ctx *gwhctx) { static handler_t proxy_response_headers(request_st * const r, struct http_response_opts_t *opts) { /* response headers just completed */ handler_ctx *hctx = (handler_ctx *)opts->pdata; + http_header_remap_opts * const remap_hdrs = &hctx->conf.header; if (light_btst(r->resp_htags, HTTP_HEADER_UPGRADE)) { - if (hctx->conf.header.upgrade && r->http_status == 101) { + if (remap_hdrs->upgrade && r->http_status == 101) { /* 101 Switching Protocols; transition to transparent proxy */ gw_set_transparent(&hctx->gw); http_response_upgrade_read_body_unknown(r); @@ -1055,21 +1056,24 @@ static handler_t proxy_response_headers(request_st * const r, struct http_respon /* rewrite paths, if needed */ - if (NULL == hctx->conf.header.urlpaths - && NULL == hctx->conf.header.hosts_response) + if (NULL == remap_hdrs->urlpaths && NULL == remap_hdrs->hosts_response) return HANDLER_GO_ON; + buffer *vb; if (light_btst(r->resp_htags, HTTP_HEADER_LOCATION)) { - buffer *vb = http_header_response_get(r, HTTP_HEADER_LOCATION, CONST_STR_LEN("Location")); - if (vb) http_header_remap_uri(vb, 0, &hctx->conf.header, 0); + vb = http_header_response_get(r, HTTP_HEADER_LOCATION, + CONST_STR_LEN("Location")); + if (vb) http_header_remap_uri(vb, 0, remap_hdrs, 0); } if (light_btst(r->resp_htags, HTTP_HEADER_CONTENT_LOCATION)) { - buffer *vb = http_header_response_get(r, HTTP_HEADER_CONTENT_LOCATION, CONST_STR_LEN("Content-Location")); - if (vb) http_header_remap_uri(vb, 0, &hctx->conf.header, 0); + vb = http_header_response_get(r, HTTP_HEADER_CONTENT_LOCATION, + CONST_STR_LEN("Content-Location")); + if (vb) http_header_remap_uri(vb, 0, remap_hdrs, 0); } if (light_btst(r->resp_htags, HTTP_HEADER_SET_COOKIE)) { - buffer *vb = http_header_response_get(r, HTTP_HEADER_SET_COOKIE, CONST_STR_LEN("Set-Cookie")); - if (vb) http_header_remap_setcookie(vb, 0, &hctx->conf.header); + vb = http_header_response_get(r, HTTP_HEADER_SET_COOKIE, + CONST_STR_LEN("Set-Cookie")); + if (vb) http_header_remap_setcookie(vb, 0, remap_hdrs); } return HANDLER_GO_ON; |