You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by mi...@apache.org on 2002/03/21 15:49:47 UTC
cvs commit: apache-1.3/src/main http_protocol.c
minfrin 02/03/21 06:49:47
Modified: src CHANGES
src/main http_protocol.c
Log:
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.
Revision Changes Path
1.1791 +4 -0 apache-1.3/src/CHANGES
Index: CHANGES
===================================================================
RCS file: /home/cvs/apache-1.3/src/CHANGES,v
retrieving revision 1.1790
retrieving revision 1.1791
diff -u -r1.1790 -r1.1791
--- CHANGES 21 Mar 2002 14:37:42 -0000 1.1790
+++ CHANGES 21 Mar 2002 14:49:46 -0000 1.1791
@@ -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
1.312 +13 -3 apache-1.3/src/main/http_protocol.c
Index: http_protocol.c
===================================================================
RCS file: /home/cvs/apache-1.3/src/main/http_protocol.c,v
retrieving revision 1.311
retrieving revision 1.312
diff -u -r1.311 -r1.312
--- http_protocol.c 13 Mar 2002 21:05:31 -0000 1.311
+++ http_protocol.c 21 Mar 2002 14:49:46 -0000 1.312
@@ -1513,6 +1513,7 @@
API_EXPORT(void) ap_basic_http_header(request_rec *r)
{
char *protocol;
+ const char *server;
if (r->assbackwards)
return;
@@ -1535,13 +1536,22 @@
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
Re: cvs commit: apache-1.3/src/main http_protocol.c
Posted by Greg Stein <gs...@lyra.org>.
On Thu, Mar 21, 2002 at 02:49:47PM -0000, minfrin@apache.org wrote:
>...
> +++ http_protocol.c 21 Mar 2002 14:49:46 -0000 1.312
>...
> + /* keep a previously set server header (possible from proxy), otherwise
> + * generate a new server header */
> + if (server = ap_table_get(r->headers_out, "Server")) {
To avoid warnings on some compilers, this assignment should have extra stuff
around it to prevent a warning about possible typo'ing of "==". For example:
if ((server = ap_table_get(r->headers_out, "Server")) != NULL) {
Just a standard rule to apply for any construct like this you do...
Cheers,
-g
--
Greg Stein, http://www.lyra.org/