From: Nick Kew Date: Fri, 26 Oct 2007 23:56:06 +0000 (+0000) Subject: Add option not to send&clear response headers in ap_send_interim_response. X-Git-Tag: 2.3.0~1308 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c94140fb017f551ab7b58f9b49b886623153df08;p=apache Add option not to send&clear response headers in ap_send_interim_response. We'll need this option to fix PR#43711, and ap_send_interim_response is fortunately too new an API to have made it into anything stable. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@588806 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/include/http_protocol.h b/include/http_protocol.h index 4cf351e13d..276d09bf98 100644 --- a/include/http_protocol.h +++ b/include/http_protocol.h @@ -668,8 +668,9 @@ AP_DECLARE(void) ap_finalize_sub_req_protocol(request_rec *sub_r); /** * Send an interim (HTTP 1xx) response immediately. * @param r The request + * @param send_headers Whether to send&clear headers in r->headers_out */ -AP_DECLARE(void) ap_send_interim_response(request_rec *r); +AP_DECLARE(void) ap_send_interim_response(request_rec *r, int send_headers); #ifdef __cplusplus } diff --git a/modules/proxy/mod_proxy_http.c b/modules/proxy/mod_proxy_http.c index 762b2a8a1e..16a557a7e4 100644 --- a/modules/proxy/mod_proxy_http.c +++ b/modules/proxy/mod_proxy_http.c @@ -1532,7 +1532,7 @@ apr_status_t ap_proxy_http_process_response(apr_pool_t * p, request_rec *r, "proxy: HTTP: received interim %d response", r->status); if (!policy || !strcasecmp(policy, "RFC")) { - ap_send_interim_response(r); + ap_send_interim_response(r, 1); } /* FIXME: refine this to be able to specify per-response-status * policies and maybe also add option to bail out with 502 diff --git a/server/protocol.c b/server/protocol.c index 6a878ca27d..697f6997a8 100644 --- a/server/protocol.c +++ b/server/protocol.c @@ -1641,7 +1641,7 @@ static int send_header(void *data, const char *key, const char *val) key, ": ", val, CRLF, NULL); return 1; } -AP_DECLARE(void) ap_send_interim_response(request_rec *r) +AP_DECLARE(void) ap_send_interim_response(request_rec *r, int send_headers) { hdr_ptr x; @@ -1658,11 +1658,13 @@ AP_DECLARE(void) ap_send_interim_response(request_rec *r) x.f = r->connection->output_filters; x.bb = apr_brigade_create(r->pool, r->connection->bucket_alloc); ap_fputstrs(x.f, x.bb, AP_SERVER_PROTOCOL, " ", r->status_line, CRLF, NULL); - apr_table_do(send_header, &x, r->headers_out, NULL); + if (send_headers) { + apr_table_do(send_header, &x, r->headers_out, NULL); + apr_table_clear(r->headers_out); + } ap_fputs(x.f, x.bb, CRLF); ap_fflush(x.f, x.bb); apr_brigade_destroy(x.bb); - apr_table_clear(r->headers_out); }