Skip to content

Commit a6a4996

Browse files
author
Kevin D Smith
committed
Improve parsing of hostnames with base URLs
1 parent 2a6ba61 commit a6a4996

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

swat/cas/rest/connection.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,14 @@ def __init__(self, hostname, port, username, password, soptions, error):
212212
self._hostname = []
213213
self._port = []
214214
for host in hostname:
215+
path = ''
216+
# If host contains a path, split them apart first
217+
if '/' in host:
218+
host, path = host.split('/', 1)
219+
# Rebuild URL from pieces
215220
self._baseurl.append('%s://%s:%d' % (protocol, host, port))
221+
if path:
222+
self._baseurl[-1] = self._baseurl[-1] + '/' + path
216223
self._hostname.append(host)
217224
self._port.append(port)
218225

0 commit comments

Comments
 (0)