[Rt-commit] rt branch, 4.0/sanity-check-url-config, updated. rt-3.9.7-1132-g01c6628
Shawn Moore
sartak at bestpractical.com
Tue Dec 28 20:20:05 EST 2010
The branch, 4.0/sanity-check-url-config has been updated
via 01c6628f00a57cc6c0176e5268e92200f4a74841 (commit)
from 9dc1eca1511d46e4ac71fa089b0dee1777ea0809 (commit)
Summary of changes:
lib/RT/Config.pm | 8 ++++++--
t/api/web-config.t | 25 +++++++++++++++----------
2 files changed, 21 insertions(+), 12 deletions(-)
- Log -----------------------------------------------------------------
commit 01c6628f00a57cc6c0176e5268e92200f4a74841
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Tue Dec 28 20:19:25 2010 -0500
Fix WebBaseURL tests
WebBaseURL must not contain a path, that's for WebURL
diff --git a/lib/RT/Config.pm b/lib/RT/Config.pm
index fb483ab..17b12bc 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -609,11 +609,15 @@ our %META = (
}
if ($value !~ m{^\w+://}) {
- $RT::Logger->error("The WebDomain config option must contain a scheme");
+ $RT::Logger->error("The WebBaseURL config option must contain a scheme");
}
if ($value =~ m{/$}) {
- $RT::Logger->error("The WebDomain config option requires no trailing slash");
+ $RT::Logger->error("The WebBaseURL config option requires no trailing slash");
+ }
+
+ if ($value =~ m{^\w+://.+?(/[^/].*)}) {
+ $RT::Logger->error("The WebBaseURL config option must not contain a path ($1)");
}
},
},
diff --git a/t/api/web-config.t b/t/api/web-config.t
index e156320..d18d49e 100644
--- a/t/api/web-config.t
+++ b/t/api/web-config.t
@@ -1,7 +1,7 @@
use strict;
use warnings;
use RT;
-use RT::Test nodb => 1, tests => 46;
+use RT::Test nodb => 1, tests => 49;
sub warnings_from {
my $option = shift;
@@ -87,9 +87,9 @@ like($w[0], qr{The WebPort config option must be an integer});
is(warnings_from(WebPort => 443), 0);
# WebBaseURL
-is(warnings_from(WebBaseURL => 'http://rt.example.com/rt'), 0);
-is(warnings_from(WebBaseURL => 'xtp://rt.example.com/rt'), 0, 'nonstandard schema is okay');
-is(warnings_from(WebBaseURL => 'http://rt.example.com:8888/rt'), 0, 'nonstandard port is okay');
+is(warnings_from(WebBaseURL => 'http://rt.example.com'), 0);
+is(warnings_from(WebBaseURL => 'xtp://rt.example.com'), 0, 'nonstandard schema is okay');
+is(warnings_from(WebBaseURL => 'http://rt.example.com:8888'), 0, 'nonstandard port is okay');
@w = warnings_from(WebBaseURL => '');
is(@w, 1);
@@ -97,16 +97,21 @@ like($w[0], qr{You must set the WebBaseURL config option});
@w = warnings_from(WebBaseURL => 'rt.example.com');
is(@w, 1);
-like($w[0], qr{The WebDomain config option must contain a scheme});
+like($w[0], qr{The WebBaseURL config option must contain a scheme});
@w = warnings_from(WebBaseURL => 'http://rt.example.com/');
is(@w, 1);
-like($w[0], qr{The WebDomain config option requires no trailing slash});
+like($w[0], qr{The WebBaseURL config option requires no trailing slash});
- at w = warnings_from(WebBaseURL => 'http://rt.example.com/rt/');
+ at w = warnings_from(WebBaseURL => 'http://rt.example.com/rt/ir');
is(@w, 1);
-like($w[0], qr{The WebDomain config option requires no trailing slash});
+like($w[0], qr{The WebBaseURL config option must not contain a path \(/rt/ir\)});
-# reinstate a valid WebDomain for other tests
-is(warnings_from(WebBaseURL => 'http://rt.example.com/rt'), 0);
+ at w = warnings_from(WebBaseURL => 'http://rt.example.com/rt/ir/');
+is(@w, 2);
+like($w[0], qr{The WebBaseURL config option requires no trailing slash});
+like($w[1], qr{The WebBaseURL config option must not contain a path \(/rt/ir/\)});
+
+# reinstate a valid WebBaseURL for other tests
+is(warnings_from(WebBaseURL => 'http://rt.example.com'), 0);
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list