From: Jim Jagielski Date: Tue, 26 Feb 2008 19:52:29 +0000 (+0000) Subject: Merge r611475 from trunk: X-Git-Tag: 2.2.9~342 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e50a060015e6eac99030f68574d2b873de0763b3;p=thirdparty%2Fapache%2Fhttpd.git Merge r611475 from trunk: Don't add bogus duplicate Content-Language header entries. PR 11035 Submitted by: niq Reviewed by: jim git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@631363 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index d1fd278f809..74418d2447c 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,9 @@ -*- coding: utf-8 -*- Changes with Apache 2.2.9 + *) Don't add bogus duplicate Content-Language entries + PR 11035 [Davi Arnaut] + *) Worker / Event MPM: Fix race condition in pool recycling that leads to segmentation faults under load. PR 44402 [Basant Kumar Kukreja ] diff --git a/STATUS b/STATUS index 7166a445bfd..0df45183c48 100644 --- a/STATUS +++ b/STATUS @@ -81,11 +81,6 @@ RELEASE SHOWSTOPPERS: PATCHES ACCEPTED TO BACKPORT FROM TRUNK: [ start all new proposals below, under PATCHES PROPOSED. ] - * Don't add bogus duplicate Content-Language entries to generated output - PR 11035 - http://svn.apache.org/viewvc?rev=611475&view=rev - +1: niq, rpluem, jim - PATCHES PROPOSED TO BACKPORT FROM TRUNK: [ New proposals should be added at the end of the list ] diff --git a/modules/http/http_filters.c b/modules/http/http_filters.c index 9ab3e5d66c7..83e2f784261 100644 --- a/modules/http/http_filters.c +++ b/modules/http/http_filters.c @@ -1174,10 +1174,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); } /*