aboutsummaryrefslogtreecommitdiffstats
path: root/lib/LXRng/Context.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/LXRng/Context.pm')
-rw-r--r--lib/LXRng/Context.pm21
1 files changed, 20 insertions, 1 deletions
diff --git a/lib/LXRng/Context.pm b/lib/LXRng/Context.pm
index 585cb57..6611b46 100644
--- a/lib/LXRng/Context.pm
+++ b/lib/LXRng/Context.pm
@@ -1,3 +1,22 @@
+# Copyright (C) 2008 Arne Georg Gleditsch <lxr@linux.no>.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# The full GNU General Public License is included in this distribution
+# in the file called COPYING.
+
package LXRng::Context;
use strict;
@@ -16,7 +35,7 @@ sub new {
# metachars, and CGI::Simple does funny things if SCRIPT_NAME
# is the empty string. Do it by hand...
my $host = 'http'.($ENV{'HTTPS'} eq 'ON' ? 's' : '').'://'.
- $ENV{'SERVER_NAME'}.
+ ($ENV{'HTTP_HOST'} || $ENV{'SERVER_NAME'}).
($ENV{'SERVER_PORT'} == ($ENV{'HTTPS'} eq 'ON' ? 443 : 80)
? '' : ':'.$ENV{'SERVER_PORT'});
my $path = $ENV{'REQUEST_URI'};