Mailing List Archive

svn commit: r1895336 - /httpd/httpd/trunk/modules/http2/h2_c2_filter.c
Author: ylavic
Date: Thu Nov 25 15:57:21 2021
New Revision: 1895336

URL: http://svn.apache.org/viewvc?rev=1895336&view=rev
Log:
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().


Modified:
httpd/httpd/trunk/modules/http2/h2_c2_filter.c

Modified: httpd/httpd/trunk/modules/http2/h2_c2_filter.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_c2_filter.c?rev=1895336&r1=1895335&r2=1895336&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_c2_filter.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_c2_filter.c Thu Nov 25 15:57:21 2021
@@ -245,16 +245,16 @@ static h2_headers *create_response(reque
* 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);
}
}