From: Nick Kew Date: Sat, 12 Jan 2008 20:33:57 +0000 (+0000) Subject: Don't add bogus duplicate Content-Language header entries. X-Git-Tag: 2.3.0~1027 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3609dae902afe354460085d4b86ec48abe912be7;p=apache Don't add bogus duplicate Content-Language header entries. PR 11035 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@611475 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 9fd0565925..4af62a1805 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,9 @@ Changes with Apache 2.3.0 [ When backported to 2.2.x, remove entry from this file ] + *) Don't add bogus duplicate Content-Language entries + PR 11035 [Davi Arnaut] + *) mod_proxy_ftp: Fix base for directory listings. PR 27834 [Nick Kew] diff --git a/modules/http/http_filters.c b/modules/http/http_filters.c index d3fa5f1c0c..ac6f5b1ad9 100644 --- a/modules/http/http_filters.c +++ b/modules/http/http_filters.c @@ -1173,10 +1173,22 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_http_header_filter(ap_filter_t *f, if (!apr_is_empty_array(r->content_languages)) { int i; + char *token; char **languages = (char **)(r->content_languages->elts); - for (i = 0; i < r->content_languages->nelts; ++i) { - apr_table_mergen(r->headers_out, "Content-Language", languages[i]); + const char *field = apr_table_get(r->headers_out, "Content-Language"); + + while (field && (token = ap_get_list_item(r->pool, &field)) != NULL) { + for (i = 0; i < r->content_languages->nelts; ++i) { + if (!strcasecmp(token, languages[i])) + break; + } + if (i == r->content_languages->nelts) { + *((char **) apr_array_push(r->content_languages)) = token; + } } + + field = apr_array_pstrcat(r->pool, r->content_languages, ','); + apr_table_setn(r->headers_out, "Content-Language", field); } /*