From: Yann Ylavic Date: Thu, 25 Nov 2021 15:57:21 +0000 (+0000) Subject: mod_http2: fix logic for non-proxy Server and Date response headers. X-Git-Tag: 2.5.0-alpha2-ci-test-only~686 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=772952aca2b66976299874f14c21b90508ed2b02;p=thirdparty%2Fapache%2Fhttpd.git mod_http2: fix logic for non-proxy Server and Date response headers. First error was in r1890564 where the test for !PROXYREQ_NONE was replaced by PROXYREQ_RESPONSE (which is never the case besides the fake proxy origin request) so a mod_h2 PR tried to fix that but the logic is now incorrect. Let's finally use the same logic as ap_basic_http_header(). git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1895336 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/http2/h2_c2_filter.c b/modules/http2/h2_c2_filter.c index ed34db681de..9df138161fc 100644 --- a/modules/http2/h2_c2_filter.c +++ b/modules/http2/h2_c2_filter.c @@ -245,16 +245,16 @@ static h2_headers *create_response(request_rec *r) * keep the set-by-proxy server and date headers, otherwise * generate a new server header / date header */ - if (r->proxyreq != PROXYREQ_NONE - && !apr_table_get(r->headers_out, "Date")) { + if (r->proxyreq == PROXYREQ_NONE + || !apr_table_get(r->headers_out, "Date")) { char *date = apr_palloc(r->pool, APR_RFC822_DATE_LEN); ap_recent_rfc822_date(date, r->request_time); apr_table_setn(r->headers_out, "Date", date ); } - if (r->proxyreq != PROXYREQ_NONE - && !apr_table_get(r->headers_out, "Server")) { + if (r->proxyreq == PROXYREQ_NONE + || !apr_table_get(r->headers_out, "Server")) { const char *us = ap_get_server_banner(); - if (us) { + if (us && *us) { apr_table_setn(r->headers_out, "Server", us); } }