Lines Matching refs:hctx

798 static handler_t proxy_stdin_append(gw_handler_ctx *hctx) {  in proxy_stdin_append()  argument
800 chunkqueue * const req_cq = &hctx->r->reqbody_queue; in proxy_stdin_append()
804 buffer * const tb = hctx->r->tmp_buf; in proxy_stdin_append()
812 if (-1 != hctx->wb_reqlen) in proxy_stdin_append()
813 hctx->wb_reqlen += (hctx->wb_reqlen >= 0) ? len : -len; in proxy_stdin_append()
815 (chunkqueue_is_empty(&hctx->wb) || hctx->wb.first->type == MEM_CHUNK) in proxy_stdin_append()
817 ? chunkqueue_append_mem(&hctx->wb, BUF_PTR_LEN(tb)) in proxy_stdin_append()
818 : chunkqueue_append_mem_min(&hctx->wb, BUF_PTR_LEN(tb)); in proxy_stdin_append()
819 chunkqueue_steal(&hctx->wb, req_cq, req_cqlen); in proxy_stdin_append()
821 chunkqueue_append_mem_min(&hctx->wb, CONST_STR_LEN("\r\n")); in proxy_stdin_append()
824 if (hctx->wb.bytes_in == hctx->wb_reqlen) {/*hctx->r->reqbody_length >= 0*/ in proxy_stdin_append()
826 chunkqueue_append_mem(&hctx->wb, CONST_STR_LEN("0\r\n\r\n")); in proxy_stdin_append()
827 hctx->wb_reqlen += (int)sizeof("0\r\n\r\n"); in proxy_stdin_append()
835 handler_ctx *hctx = (handler_ctx *)gwhctx; in proxy_create_env() local
836 request_st * const r = hctx->gw.r; in proxy_create_env()
837 const int remap_headers = (NULL != hctx->conf.header.urlpaths in proxy_create_env()
838 || NULL != hctx->conf.header.hosts_request); in proxy_create_env()
839 size_t rsz = (size_t)(r->read_queue.bytes_out - hctx->gw.wb.bytes_in); in proxy_create_env()
841 buffer * const b = chunkqueue_prepend_buffer_open_sz(&hctx->gw.wb, rsz); in proxy_create_env()
856 &hctx->conf.header, 1); in proxy_create_env()
858 buffer_append_string_len(b, !hctx->conf.header.force_http10 in proxy_create_env()
862 if (hctx->conf.replace_http_host && !buffer_is_blank(hctx->gw.host->id)) { in proxy_create_env()
863 if (hctx->gw.conf.debug > 1) { in proxy_create_env()
865 "proxy - using \"%s\" as HTTP Host", hctx->gw.host->id->ptr); in proxy_create_env()
868 BUF_PTR_LEN(hctx->gw.host->id)); in proxy_create_env()
874 http_header_remap_host(b, buffer_clen(b) - alen, &hctx->conf.header, 1, alen); in proxy_create_env()
899 if (__builtin_expect( (hctx->conf.header.force_http10), 0)) in proxy_create_env()
901 hctx->gw.stdin_append = proxy_stdin_append; /* stream chunked body */ in proxy_create_env()
906 proxy_set_Forwarded(r->con, r, hctx->conf.forwarded); in proxy_create_env()
929 if (hctx->conf.header.force_http10 || r->http_version == HTTP_VERSION_1_0) continue; in proxy_create_env()
936 if (hctx->conf.header.force_http10 in proxy_create_env()
939 if (!hctx->conf.header.upgrade) continue; in proxy_create_env()
986 http_header_remap_uri(b, buffer_clen(b) - vlen, &hctx->conf.header, 1); in proxy_create_env()
989 if (connhdr && !hctx->conf.header.force_http10 && r->http_version >= HTTP_VERSION_1_1 in proxy_create_env()
1022 hctx->gw.wb_reqlen = buffer_clen(b); in proxy_create_env()
1023 chunkqueue_prepend_buffer_commit(&hctx->gw.wb); in proxy_create_env()
1027 hctx->gw.wb_reqlen += r->reqbody_length; /* total req size */ in proxy_create_env()
1029 hctx->gw.wb_reqlen = -hctx->gw.wb_reqlen; in proxy_create_env()
1030 if (hctx->gw.stdin_append == proxy_stdin_append) in proxy_create_env()
1031 proxy_stdin_append(&hctx->gw); in proxy_create_env()
1033 chunkqueue_append_chunkqueue(&hctx->gw.wb, &r->reqbody_queue); in proxy_create_env()
1042 handler_ctx *hctx = (handler_ctx *)gwhctx; in proxy_create_env_connect() local
1043 request_st * const r = hctx->gw.r; in proxy_create_env_connect()
1046 gw_set_transparent(&hctx->gw); in proxy_create_env_connect()
1056 handler_ctx *hctx = (handler_ctx *)opts->pdata; in proxy_response_headers() local
1057 http_header_remap_opts * const remap_hdrs = &hctx->conf.header; in proxy_response_headers()
1069 gw_set_transparent(&hctx->gw); in proxy_response_headers()
1130 handler_ctx *hctx = r->plugin_ctx[p->id]; in mod_proxy_check_extension() local
1131 hctx->gw.create_env = proxy_create_env; in mod_proxy_check_extension()
1132 hctx->gw.response = chunk_buffer_acquire(); in mod_proxy_check_extension()
1133 hctx->gw.opts.backend = BACKEND_PROXY; in mod_proxy_check_extension()
1134 hctx->gw.opts.pdata = hctx; in mod_proxy_check_extension()
1135 hctx->gw.opts.headers = proxy_response_headers; in mod_proxy_check_extension()
1137 hctx->conf = p->conf; /*(copies struct)*/ in mod_proxy_check_extension()
1138 hctx->conf.header.http_host = r->http_host; in mod_proxy_check_extension()
1139 hctx->conf.header.upgrade &= in mod_proxy_check_extension()
1145 if (hctx->conf.header.https_remap) { in mod_proxy_check_extension()
1146 hctx->conf.header.https_remap = in mod_proxy_check_extension()
1154 && (hctx->conf.header.connect_method = in mod_proxy_check_extension()
1155 hctx->conf.header.upgrade)) { /*(405 if not set)*/ in mod_proxy_check_extension()
1159 else if (hctx->conf.header.connect_method) { in mod_proxy_check_extension()
1160 hctx->gw.create_env = proxy_create_env_connect; in mod_proxy_check_extension()