ASF Bugzilla – Attachment 27423 Details for
Bug 51709
ServerName/ServerAlias don't work if Host: header from HTTP request matches VirtualHost address
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Fix for function check_hostalias()
httpd-2.2.19_Fix_check_hostalias.patch (text/plain), 1.77 KB, created by
Micha Lenk
on 2011-08-23 08:52:23 UTC
(
hide
)
Description:
Fix for function check_hostalias()
Filename:
MIME Type:
Creator:
Micha Lenk
Created:
2011-08-23 08:52:23 UTC
Size:
1.77 KB
patch
obsolete
>diff -ur httpd-2.2.19.orig//server/vhost.c httpd-2.2.19.patched//server/vhost.c >--- httpd-2.2.19.orig//server/vhost.c 2010-08-10 21:11:40.000000000 +0200 >+++ httpd-2.2.19.patched//server/vhost.c 2011-08-23 10:31:49.827506728 +0200 >@@ -872,9 +872,11 @@ > const char *host = r->hostname; > apr_port_t port; > server_rec *s; >+ server_rec *virthost_s; > server_rec *last_s; > name_chain *src; > >+ virthost_s = NULL; > last_s = NULL; > > port = r->connection->local_addr->port; >@@ -901,23 +903,34 @@ > > s = src->server; > >- /* does it match the virthost from the sar? */ >- if (!strcasecmp(host, sar->virthost)) { >- goto found; >- } >- >- if (s == last_s) { >- /* we've already done ServerName and ServerAlias checks for this >- * vhost >- */ >- continue; >+ /* If we still need to do ServerName and ServerAlias checks for this >+ * server, do them now. >+ */ >+ if (s != last_s) { >+ /* does it match any ServerName or ServerAlias directive? */ >+ if (matches_aliases(s, host)) { >+ goto found; >+ } > } > last_s = s; > >- if (matches_aliases(s, host)) { >- goto found; >+ /* Fallback: does it match the virthost from the sar? */ >+ if (!strcasecmp(host, sar->virthost)) { >+ /* only the first match is used */ >+ if (virthost_s == NULL) { >+ virthost_s = s; >+ } > } > } >+ >+ /* If ServerName and ServerAlias check failed, we end up here. If it >+ * matches a VirtualHost, virthost_s is set. Use that as fallback >+ */ >+ if (virthost_s) { >+ s = virthost_s; >+ goto found; >+ } >+ > return; > > found:
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 51709
:
27423
|
27424
|
27520