httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@decus.org (Rodent of Unusual Size)
Subject [PATCH] PR#39 (no "Vary: Host" in response)
Date Fri, 28 Feb 1997 18:02:55 GMT
    I *think* the attached patch will close PR#39, but I'm in pretty
    unfamiliar territory here.  The issue is that a "Vary: Host" header
    isn't returned (but should be) if the value of the "Host:" request
    header was used in selecting a virtual host configuration.

    The "Vary" header is put in the r->err_headers_out table because
    something downstream of read_request() is resetting r->headers_out.
    I don't see a clean way to move this check downstream, though - but
    as I said, this is terra incognita for me.

    Roy..?

    #ken    :-)}

Index: http_protocol.c
===================================================================
RCS file: /usr/users/coar/myApache/repository/apache/src/http_protocol.c,v
retrieving revision 1.105
diff -c -r1.105 http_protocol.c
*** 1.105	1997/02/22 00:37:18
--- http_protocol.c	1997/02/28 18:29:27
***************
*** 634,639 ****
--- 634,640 ----
  
  static void check_hostalias (request_rec *r) {
    const char *hostname=r->hostname;
+   char *host_header = table_get (r->headers_in, "Host");
    char *host = getword(r->pool, &hostname, ':');	/* Get rid of port */
    int port = (*hostname) ? atoi(hostname) : 80;
    server_rec *s;
***************
*** 654,659 ****
--- 655,664 ----
      
      if ((!strcasecmp(host, s->server_hostname)) && (port == s->port)) {
        r->server = r->connection->server = s;
+       if (host_header) {
+         table_merge (r->err_headers_out, "Vary", "Host");
+         host_header = NULL;    /* only add "Host" once */
+       }
        if (r->hostlen && !strncmp(r->uri, "http://", 7)) {
  	r->uri += r->hostlen;
  	parse_uri(r, r->uri);
***************
*** 667,672 ****
--- 672,681 ----
  
        if ((is_matchexp(name) && !strcasecmp_match(host, name)) ||
  	  (!strcasecmp(host, name))) {
+         if (host_header) {
+           table_merge (r->err_headers_out, "Vary", "Host");
+           host_header = NULL;    /* only add "Host" once */
+         }
  	r->server = r->connection->server = s;
  	if (r->hostlen && !strncmp(r->uri, "http://", 7)) {
  	  r->uri += r->hostlen;

Mime
View raw message