Add a regexp to verify the host parameter.

If the host parameter is invalid, like having a trailing backslash, it will
result on HTTP 400 later which is much harder to diagnose.

TEST=none
BUG=none

Review URL: http://codereview.chromium.org/5339001

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@67295 0039d316-1c4b-4281-b951-d872f2087c98
experimental/szager/collated-output
maruel@chromium.org 15 years ago
parent c3a15a2381
commit cbf1f6b718

@ -188,6 +188,8 @@ class AbstractRpcServer(object):
if (not self.host.startswith("http://") and
not self.host.startswith("https://")):
self.host = "http://" + self.host
assert re.match(r'^[a-z]+://[a-z0-9\.-_]+[a-z](|:[0-9]+)$', self.host), (
'%s is malformed' % host)
self.host_override = host_override
self.auth_function = auth_function
self.authenticated = False

Loading…
Cancel
Save