It appears the login for handling anyhost in the case where there is
an HTTP/1.0 request without a host is incorrect.
basically, this line in request.cs:find_vs, in the else part of the
if (r->host) test:
if (v->host == 0 && v->anyhost == 0)
needs to be:
if (v->anyhost == 1)
The current code is only matching on a specification if anyhost is
NOT set. However, this means the virtual host marked as "anyhost"
won't actually match it.
I suppose there is some odd possibility that this was not a mistake.
By matching only a virtualhost with no host directive and no AnyHost,
you can have one virtualhost definition for http/1.0 non-host
connections, and another for all virtualhost connections, but this is
very undocumented and confusing behavior, given the implicit meaning
of "AnyHost".
- David
*** mathopd-1.5p2/src/request.c Fri Feb 13 06:43:28 2004
--- mathopd-1.5p2-jeske/src/request.c Tue Mar 23 20:57:48 2004
***************
*** 666,672 ****
d = 0;
v = r->cn->s->children;
! if (r->host)
while (v) {
if (v->host) {
if (strcmp(r->host, v->host) == 0)
--- 666,673 ----
d = 0;
v = r->cn->s->children;
! if (r->host && r->host[0]) {
! log_d("find specific host '%s'!",r->host);
while (v) {
if (v->host) {
if (strcmp(r->host, v->host) == 0)
***************
*** 675,686 ****
d = v;
v = v->next;
}
! else
while (v) {
! if (v->host == 0 && v->anyhost == 0)
break;
v = v->next;
}
if (v == 0) {
if (d == 0)
return -1;
--- 676,691 ----
d = v;
v = v->next;
}
! } else {
! log_d("find anyhost!");
while (v) {
! log_d("testing host: %s anyhost:%d",
v->host,v->anyhost);
! if (v->anyhost == 1)
break;
v = v->next;
}
+ log_d("failed to find anyhost!");
+ }
if (v == 0) {
if (d == 0)return -1;
*** mathopd-1.5p2/src/request.c Fri Feb 13 06:43:28 2004
--- mathopd-1.5p2-jeske/src/request.c Tue Mar 23 20:57:48 2004
***************
*** 666,672 ****
d = 0;
v = r->cn->s->children;
! if (r->host)
while (v) {
if (v->host) {
if (strcmp(r->host, v->host) == 0)
--- 666,673 ----
d = 0;
v = r->cn->s->children;
! if (r->host && r->host[0]) {
! log_d("find specific host '%s'!",r->host);
while (v) {
if (v->host) {
if (strcmp(r->host, v->host) == 0)
***************
*** 675,686 ****
d = v;
v = v->next;
}
! else
while (v) {
! if (v->host == 0 && v->anyhost == 0)
break;
v = v->next;
}
if (v == 0) {
if (d == 0)
return -1;
--- 676,691 ----
d = v;
v = v->next;
}
! } else {
! log_d("find anyhost!");
while (v) {
! log_d("testing host: %s anyhost:%d",
v->host,v->anyhost);
! if (v->anyhost == 1)
break;
v = v->next;
}
+ log_d("failed to find anyhost!");
+ }
if (v == 0) {
if (d == 0)
return -1;