Commit cbf1f6b7 authored by maruel@chromium.org's avatar maruel@chromium.org

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
parent c3a15a23
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment