Merge pull request #847 from jetsecurity/fix_distinct_ports

Allow distinct values between the Host and Port options
readme-wiki
Chris Ross 2017-12-07 23:04:56 -05:00 committed by GitHub
commit 7e0809f562
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 7 deletions

View File

@ -102,14 +102,16 @@ class Listeners:
if len(parts) != 1 and parts[-1].isdigit():
# if a port is specified with http://host:port
listenerObject.options['Host']['Value'] = "%s://%s" % (protocol, value)
listenerObject.options['Port']['Value'] = parts[-1]
if listenerObject.options['Port']['Value'] == '':
listenerObject.options['Port']['Value'] = parts[-1]
elif listenerObject.options['Port']['Value'] != '':
# otherwise, check if the port value was manually set
listenerObject.options['Host']['Value'] = "%s://%s:%s" % (protocol, value, listenerObject.options['Port']['Value'])
else:
# otherwise use default port
listenerObject.options['Host']['Value'] = "%s://%s" % (protocol, value)
listenerObject.options['Port']['Value'] = defaultPort
if listenerObject.options['Port']['Value'] == '':
listenerObject.options['Port']['Value'] = defaultPort
return True
@ -123,11 +125,6 @@ class Listeners:
if option == 'Port':
listenerObject.options[option]['Value'] = value
# set the port in the Host configuration as well
host = listenerObject.options['Host']['Value']
parts = host.split(':')
if len(parts) == 2 or len(parts) == 3:
listenerObject.options['Host']['Value'] = "%s:%s:%s" % (parts[0], parts[1], str(value))
return True
elif option == 'StagingKey':