You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vcl.apache.org by jf...@apache.org on 2018/05/11 15:43:36 UTC
vcl git commit: VCL-1085 - Configuring VCL Website to use custom port
Repository: vcl
Updated Branches:
refs/heads/VCL-1085_web_custom_port [created] 2b87efb9e
VCL-1085 - Configuring VCL Website to use custom port
applied patch submitted by Junaid Ali
conf-default.php and testsetup.php: create $host variable from
$_SERVER['HTTP_HOST'] and strip off port portion if it exists;
use in place of anywhere $_SERVER['HTTP_HOST'] was used
utils.php: modified initGlobals: remove port part from
$_SERVER['HTTP_HOST'] before using to create $uniqid variable
Project: http://git-wip-us.apache.org/repos/asf/vcl/repo
Commit: http://git-wip-us.apache.org/repos/asf/vcl/commit/2b87efb9
Tree: http://git-wip-us.apache.org/repos/asf/vcl/tree/2b87efb9
Diff: http://git-wip-us.apache.org/repos/asf/vcl/diff/2b87efb9
Branch: refs/heads/VCL-1085_web_custom_port
Commit: 2b87efb9e18129759c0ecf63b79517c0088397f4
Parents: 10ea259
Author: Josh Thompson <jf...@ncsu.edu>
Authored: Fri May 11 11:32:37 2018 -0400
Committer: Josh Thompson <jf...@ncsu.edu>
Committed: Fri May 11 11:32:37 2018 -0400
----------------------------------------------------------------------
web/.ht-inc/conf-default.php | 6 +++++-
web/.ht-inc/utils.php | 7 ++++++-
web/testsetup.php | 13 ++++++++-----
3 files changed, 19 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/vcl/blob/2b87efb9/web/.ht-inc/conf-default.php
----------------------------------------------------------------------
diff --git a/web/.ht-inc/conf-default.php b/web/.ht-inc/conf-default.php
index 255991b..e64ea50 100644
--- a/web/.ht-inc/conf-default.php
+++ b/web/.ht-inc/conf-default.php
@@ -56,11 +56,15 @@ regarding specific terms and conditions, please contact
####################### end required modifications ###########################
+$host = $_SERVER['HTTP_HOST'];
+if (strpos($host, ':')) {
+ $host = substr($host, 0, strpos($host, ':'));
+}
define("BASEURL", "https://{$_SERVER['HTTP_HOST']}/vcl"); // no trailing slash - all of the URL except /index.php
define("SCRIPT", "/index.php"); // this should only be "/index.php" unless you rename index.php to something else
define("HOMEURL", "https://{$_SERVER['HTTP_HOST']}/vcl/"); // url to go to when someone clicks HOME or Logout
-define("COOKIEDOMAIN", "{$_SERVER['HTTP_HOST']}"); // domain in which cookies are set
+define("COOKIEDOMAIN", "$host"); // domain in which cookies are set
define("DEFAULTGROUP", "adminUsers"); // if a user is in no groups, use reservation
// length attriubtes from this group
http://git-wip-us.apache.org/repos/asf/vcl/blob/2b87efb9/web/.ht-inc/utils.php
----------------------------------------------------------------------
diff --git a/web/.ht-inc/utils.php b/web/.ht-inc/utils.php
index 7c98834..d53bb20 100644
--- a/web/.ht-inc/utils.php
+++ b/web/.ht-inc/utils.php
@@ -125,7 +125,12 @@ function initGlobals() {
$days = array(i('Sunday'), i('Monday'), i('Tuesday'), i('Wednesday'), i('Thursday'), i('Friday'), i('Saturday'));
$phpVerArr = explode('.', phpversion());
$phpVer = $phpVerArr[0];
- $uniqid = uniqid($_SERVER['HTTP_HOST'] . "-" . getmypid() . "-");
+
+ $host = $_SERVER['HTTP_HOST'];
+ if(strpos($host, ':')) {
+ $host = substr($host, 0, strpos($host, ':'));
+ }
+ $uniqid = uniqid($host . "-" . getmypid() . "-");
$passwdArray = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K',
'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V',
http://git-wip-us.apache.org/repos/asf/vcl/blob/2b87efb9/web/testsetup.php
----------------------------------------------------------------------
diff --git a/web/testsetup.php b/web/testsetup.php
index ba3e5ae..8f384d2 100644
--- a/web/testsetup.php
+++ b/web/testsetup.php
@@ -79,14 +79,18 @@ $myurl .= $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$includesecrets = 1;
$includeconf = 1;
+$host = $_SERVER['HTTP_HOST'];
+if (strpos($host, ':')) {
+ $host = substr($host, 0, strpos($host, ':'));
+}
-if(! ip2long(getHostbyname($_SERVER['HTTP_HOST']))) {
+if(! ip2long(getHostbyname($host))) {
print $header;
# php version
print "PHP version: " . phpversion() . "<br><br>\n";
- title("Trying to resolve my hostname ({$_SERVER['HTTP_HOST']})");
+ title("Trying to resolve my hostname ($host)");
print "<ul>\n";
- fail("unable to resolve my hostname; ensure {$_SERVER['HTTP_HOST']} is in DNS or create an entry for it in /etc/hosts");
+ fail("unable to resolve my hostname; ensure $host is in DNS or create an entry for it in /etc/hosts");
print "</ul>\n";
$includesecrets = 0;
$includeconf = 0;
@@ -160,8 +164,7 @@ else {
# conf.php tests
$createcryptkey = 0;
-if($includeconf && include('.ht-inc/conf.php')) {
- $host = $_SERVER['HTTP_HOST'];
+if($includeconf && include('.ht-inc/conf.php')) {
if(! defined('COOKIEDOMAIN')) {
print $header;
# php version