From: Graham Leggett Date: Thu, 21 Mar 2002 12:05:45 +0000 (+0000) Subject: Change the header merging behaviour in proxy, as some headers X-Git-Tag: 2.0.34~197 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=19c02136129177b8589df82039c4d188414e7aca;p=apache Change the header merging behaviour in proxy, as some headers (like Set-Cookie) cannot be unmerged due to stray commas in dates. PR: Obtained from: Submitted by: Reviewed by: git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94083 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index f6214bd822..c8a3dad9a9 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,9 @@ Changes with Apache 2.0.34-dev + *) Change the header merging behaviour in proxy, as some headers + (like Set-Cookie) cannot be unmerged due to stray commas in + dates. [Graham Leggett] + *) Be more vocal about what AcceptMutex values we allow, to make us closer to how 1.3 does it. [Jim Jagielski] diff --git a/modules/proxy/mod_proxy.c b/modules/proxy/mod_proxy.c index a53912ae81..5daef69d5b 100644 --- a/modules/proxy/mod_proxy.c +++ b/modules/proxy/mod_proxy.c @@ -854,7 +854,7 @@ static const char * ap_get_module_config(parms->server->module_config, &proxy_module); long s = atol(arg); - psf->io_buffer_size = MAX(s, AP_IOBUFSIZE); + psf->io_buffer_size = ((s > AP_IOBUFSIZE) ? s : AP_IOBUFSIZE); psf->io_buffer_size_set = 1; return NULL; } diff --git a/modules/proxy/proxy_http.c b/modules/proxy/proxy_http.c index 33a3705baa..e57ffc3ea9 100644 --- a/modules/proxy/proxy_http.c +++ b/modules/proxy/proxy_http.c @@ -781,10 +781,6 @@ apr_status_t ap_proxy_http_process_response(apr_pool_t * p, request_rec *r, } } - /* cookies are special: they must not be merged (stupid browsers) */ - ap_proxy_table_unmerge(r->pool, r->headers_out, "Set-Cookie"); - ap_proxy_table_unmerge(r->pool, r->headers_out, "Set-Cookie2"); - r->sent_bodyct = 1; /* Is it an HTTP/0.9 response? If so, send the extra data */ if (backasswards) { diff --git a/modules/proxy/proxy_util.c b/modules/proxy/proxy_util.c index bf1c85b190..7ce7f318de 100644 --- a/modules/proxy/proxy_util.c +++ b/modules/proxy/proxy_util.c @@ -392,8 +392,11 @@ PROXY_DECLARE(request_rec *)ap_proxy_make_fake_req(conn_rec *c, request_rec *r) * Reads headers from a buffer and returns an array of headers. * Returns NULL on file error * This routine tries to deal with too long lines and continuation lines. - * @@@: XXX: FIXME: currently the headers are passed thru un-merged. - * Is that okay, or should they be collapsed where possible? + * + * Note: Currently the headers are passed through unmerged. This has to be + * done so that headers which react badly to merging (such as Set-Cookie + * headers, which contain commas within the date field) do not get stuffed + * up. */ PROXY_DECLARE(apr_table_t *)ap_proxy_read_headers(request_rec *r, request_rec *rr, char *buffer, int size, conn_rec *c) { @@ -441,8 +444,8 @@ PROXY_DECLARE(apr_table_t *)ap_proxy_read_headers(request_rec *r, request_rec *r for (end = &value[strlen(value)-1]; end > value && apr_isspace(*end); --end) *end = '\0'; - /* make sure we merge so as not to destroy duplicated headers */ - apr_table_merge(headers_out, buffer, value); + /* make sure we add so as not to destroy duplicated headers */ + apr_table_add(headers_out, buffer, value); /* the header was too long; at the least we should skip extra data */ if (len >= size - 1) {