diff options
author | Nick Kew <niq@apache.org> | 2008-01-12 21:33:57 +0100 |
---|---|---|
committer | Nick Kew <niq@apache.org> | 2008-01-12 21:33:57 +0100 |
commit | 3609dae902afe354460085d4b86ec48abe912be7 (patch) | |
tree | 3c7a0932efa957795f251f2d15bad8138e9d1f81 /modules/http | |
parent | mod_proxy_ftp: Fix base for directory listings. (diff) | |
download | apache2-3609dae902afe354460085d4b86ec48abe912be7.tar.xz apache2-3609dae902afe354460085d4b86ec48abe912be7.zip |
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
Diffstat (limited to 'modules/http')
-rw-r--r-- | modules/http/http_filters.c | 16 |
1 files changed, 14 insertions, 2 deletions
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); } /* |