Commit 6ff1fc0e authored by Aaron Gable's avatar Aaron Gable

Automatically map urls to their raw appengine forms

BUG=657216
R=dnj@chromium.org

Review URL: https://codereview.chromium.org/2431893002 .
parent 78de30e1
# Copyright (c) 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Ensures that all depot_tools talks directly to appengine to avoid SNI."""
import urlparse
mapping = {
'codereview.chromium.org': 'chromiumcodereview.appspot.com',
'crashpad.chromium.org': 'crashpad-home.appspot.com',
'bugs.chromium.org': 'monorail-prod.appspot.com',
'bugs-staging.chromium.org': 'monorail-staging.appspot.com',
}
def MapUrl(url):
parts = list(urlparse.urlsplit(url))
new_netloc = mapping.get(parts[1])
if new_netloc:
parts[1] = new_netloc
return urlparse.urlunsplit(parts)
......@@ -55,6 +55,8 @@ import urlparse
from multiprocessing.pool import ThreadPool
import appengine_mapper
# The configparser module was renamed in Python 3.
try:
import configparser
......@@ -443,6 +445,7 @@ class AbstractRpcServer(object):
tries += 1
args = dict(kwargs)
url = "%s%s%s" % (self.host, self.request_path_prefix, request_path)
url = appengine_mapper.MapUrl(url)
if args:
url += "?" + urllib.urlencode(args)
req = self._CreateRequest(url=url, data=payload)
......
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