[Rt-commit] rt branch, 4.0/sanity-check-url-config, updated. rt-3.9.7-1145-gd90da02
Shawn Moore
sartak at bestpractical.com
Thu Mar 3 01:49:25 EST 2011
The branch, 4.0/sanity-check-url-config has been updated
via d90da0291be55147ba7e081d5b650916eba7203d (commit)
from 9a21d6831ca5319f10596b8b14194d881167bca5 (commit)
Summary of changes:
lib/RT/Interface/Web.pm | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)
- Log -----------------------------------------------------------------
commit d90da0291be55147ba7e081d5b650916eba7203d
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Thu Mar 3 01:46:58 2011 -0500
PSGI spec says prefer HTTP_HOST over SERVER_NAME
Unfortunately it's not that trivial since HTTP_HOST likes including the
port
diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index b8985d5..e3cbf2f 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -1014,11 +1014,21 @@ sub ValidateWebConfig {
$_has_validated_web_config = 1;
if ($ENV{SERVER_PORT} != RT->Config->Get('WebPort')) {
- $RT::Logger->warn("The SERVER_PORT environment variable ($ENV{SERVER_PORT}) does NOT match the configured WebPort ($RT::WebPort)");
+ $RT::Logger->warn("The actual SERVER_PORT ($ENV{SERVER_PORT}) does NOT match the configured WebPort ($RT::WebPort)");
}
- if ($ENV{SERVER_NAME} ne RT->Config->Get('WebDomain')) {
- $RT::Logger->warn("The SERVER_NAME environment variable ($ENV{SERVER_NAME}) does NOT match the configured WebDomain ($RT::WebDomain)");
+ if ($ENV{HTTP_HOST}) {
+ # match "example.com" or "example.com:80"
+ my ($host) = $ENV{HTTP_HOST} =~ /^(.*?)(:\d+)?$/;
+
+ if ($host ne RT->Config->Get('WebDomain')) {
+ $RT::Logger->warn("The actual HTTP_HOST ($host) does NOT match the configured WebDomain ($RT::WebDomain)");
+ }
+ }
+ else {
+ if ($ENV{SERVER_NAME} ne RT->Config->Get('WebDomain')) {
+ $RT::Logger->warn("The actual SERVER_NAME ($ENV{SERVER_NAME}) does NOT match the configured WebDomain ($RT::WebDomain)");
+ }
}
if ($ENV{PATH_INFO} !~ /^\Q$RT::WebPath\E/) {
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list