]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
When a proxied site was being served, Apache was replacing
authorGraham Leggett <minfrin@apache.org>
Thu, 21 Mar 2002 14:49:46 +0000 (14:49 +0000)
committerGraham Leggett <minfrin@apache.org>
Thu, 21 Mar 2002 14:49:46 +0000 (14:49 +0000)
the original site Server header with it's own, which is not
allowed by RFC2616. Fixed.
PR:
Obtained from:
Submitted by:
Reviewed by:

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x@94085 13f79535-47bb-0310-9956-ffa450edef68

src/CHANGES
src/main/http_protocol.c

index 0b3e233d2d485aefaca3a58d6734d4b43c046e78..1e3137c4487d23489b9d5ff0169f2a85a0d26aba 100644 (file)
@@ -1,5 +1,9 @@
 Changes with Apache 1.3.24
 
+  *) When a proxied site was being served, Apache was replacing
+     the original site Server header with it's own, which is not
+     allowed by RFC2616. Fixed. [Graham Leggett]
+
   *) Change ap_construct_url() so that the r->hostname is used in
      the URL instead of the value of the ServerName directive. This
      stops Apache redirecting to a different website name to the
index e1b32523ebb2742a023821d00c069e4627b4d232..7da84f785b3e96c3b4dc645af9d9e30a3acf3cf2 100644 (file)
@@ -1513,6 +1513,7 @@ API_EXPORT_NONSTD(int) ap_send_header_field(request_rec *r,
 API_EXPORT(void) ap_basic_http_header(request_rec *r)
 {
     char *protocol;
+    const char *server;
 
     if (r->assbackwards)
         return;
@@ -1535,13 +1536,22 @@ API_EXPORT(void) ap_basic_http_header(request_rec *r)
     PUSH_EBCDIC_OUTPUTCONVERSION_STATE_r(r, 1);
 #endif /*CHARSET_EBCDIC*/
 
-    /* Output the HTTP/1.x Status-Line and the Date and Server fields */
-
+    /* output the HTTP/1.x Status-Line */
     ap_rvputs(r, protocol, " ", r->status_line, CRLF, NULL);
 
+    /* output the date header */
     ap_send_header_field(r, "Date", ap_gm_timestr_822(r->pool, r->request_time));
-    ap_send_header_field(r, "Server", ap_get_server_version());
 
+    /* keep a previously set server header (possible from proxy), otherwise
+     * generate a new server header */
+    if (server = ap_table_get(r->headers_out, "Server")) {
+        ap_send_header_field(r, "Server", server);
+    }
+    else {
+        ap_send_header_field(r, "Server", ap_get_server_version());
+    }
+
+    /* unset so we don't send them again */
     ap_table_unset(r->headers_out, "Date");        /* Avoid bogosity */
     ap_table_unset(r->headers_out, "Server");
 #ifdef CHARSET_EBCDIC