From cbf1f6b7183f0a31057a97ba1c266929fab76cd2 Mon Sep 17 00:00:00 2001 From: "maruel@chromium.org" Date: Wed, 24 Nov 2010 19:50:39 +0000 Subject: [PATCH] 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 --- third_party/upload.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/third_party/upload.py b/third_party/upload.py index 279221412..c532cd815 100644 --- a/third_party/upload.py +++ b/third_party/upload.py @@ -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