Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(261)

Side by Side Diff: third_party/upload.py

Issue 5339001: Add a regexp to verify the host parameter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Improve regexp to support port number Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright 2007 Google Inc. 3 # Copyright 2007 Google Inc.
4 # 4 #
5 # Licensed under the Apache License, Version 2.0 (the "License"); 5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License. 6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at 7 # You may obtain a copy of the License at
8 # 8 #
9 # http://www.apache.org/licenses/LICENSE-2.0 9 # http://www.apache.org/licenses/LICENSE-2.0
10 # 10 #
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 save_cookies: If True, save the authentication cookies to local disk. 181 save_cookies: If True, save the authentication cookies to local disk.
182 If False, use an in-memory cookiejar instead. Subclasses must 182 If False, use an in-memory cookiejar instead. Subclasses must
183 implement this functionality. Defaults to False. 183 implement this functionality. Defaults to False.
184 account_type: Account type used for authentication. Defaults to 184 account_type: Account type used for authentication. Defaults to
185 AUTH_ACCOUNT_TYPE. 185 AUTH_ACCOUNT_TYPE.
186 """ 186 """
187 self.host = host 187 self.host = host
188 if (not self.host.startswith("http://") and 188 if (not self.host.startswith("http://") and
189 not self.host.startswith("https://")): 189 not self.host.startswith("https://")):
190 self.host = "http://" + self.host 190 self.host = "http://" + self.host
191 assert re.match(r'^[a-z]+://[a-z0-9\.-_]+[a-z](|:[0-9]+)$', self.host), (
192 '%s is malformed' % host)
191 self.host_override = host_override 193 self.host_override = host_override
192 self.auth_function = auth_function 194 self.auth_function = auth_function
193 self.authenticated = False 195 self.authenticated = False
194 self.extra_headers = extra_headers 196 self.extra_headers = extra_headers
195 self.save_cookies = save_cookies 197 self.save_cookies = save_cookies
196 self.account_type = account_type 198 self.account_type = account_type
197 self.opener = self._GetOpener() 199 self.opener = self._GetOpener()
198 if self.host_override: 200 if self.host_override:
199 logging.info("Server: %s; Host: %s", self.host, self.host_override) 201 logging.info("Server: %s; Host: %s", self.host, self.host_override)
200 else: 202 else:
(...skipping 1572 matching lines...) Expand 10 before | Expand all | Expand 10 after
1773 try: 1775 try:
1774 RealMain(sys.argv) 1776 RealMain(sys.argv)
1775 except KeyboardInterrupt: 1777 except KeyboardInterrupt:
1776 print 1778 print
1777 StatusUpdate("Interrupted.") 1779 StatusUpdate("Interrupted.")
1778 sys.exit(1) 1780 sys.exit(1)
1779 1781
1780 1782
1781 if __name__ == "__main__": 1783 if __name__ == "__main__":
1782 main() 1784 main()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698