You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Rodent of Unusual Size <co...@decus.org> on 1997/02/28 19:02:55 UTC
[PATCH] PR#39 (no "Vary: Host" in response)
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;
Re: [PATCH] PR#39 (no "Vary: Host" in response)
Posted by Dean Gaudet <dg...@arctic.org>.
Didn't we decide this was a deficiency in HTTP/1.1? That it would require
"Vary: Host" on all HTTP/1.1 requests and so we shouldn't bother...
Dean
On Fri, 28 Feb 1997, Rodent of Unusual Size wrote:
> 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;
>