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 2014/12/16 18:52:57 UTC

svn commit: r1646027 - /vcl/trunk/web/.ht-inc/requests.php

Author: jfthomps
Date: Tue Dec 16 17:52:57 2014
New Revision: 1646027

URL: http://svn.apache.org/r1646027
Log:
VCL-174 - NAT - support for sites that have small IP address ranges

requests.php: modified AJconnectRequest: when using nat, added code to ensure a port is included in the connect method text; if it is not, added a key for it before doing substitutions in the text

Modified:
    vcl/trunk/web/.ht-inc/requests.php

Modified: vcl/trunk/web/.ht-inc/requests.php
URL: http://svn.apache.org/viewvc/vcl/trunk/web/.ht-inc/requests.php?rev=1646027&r1=1646026&r2=1646027&view=diff
==============================================================================
--- vcl/trunk/web/.ht-inc/requests.php (original)
+++ vcl/trunk/web/.ht-inc/requests.php Tue Dec 16 17:52:57 2014
@@ -4234,6 +4234,20 @@ function AJconnectRequest() {
 			$froms = array('/#userid#/',
 			               '/#password#/',
 			               '/#connectIP#/');
+			# check that connecttext includes port if nat is being used
+			if($usenat) {
+				$found = 0;
+				foreach($method['ports'] as $port) {
+					if(preg_match("/{$port['key']}/", $method['connecttext'])) {
+						$found = 1;
+						break;
+					}
+				}
+				if(! $found) {
+					# no port in connect text, assume first port will work
+					$method['connecttext'] = preg_replace("/#connectIP#/", "#connectIP#:{$method['ports'][0]['key']}", $method['connecttext']);
+				}
+			}
 			$tos = array($conuser,
 			             $passwd,
 			             $res['connectIP']);