Bug 1405325 - Use HTTPWireProtocol#url to build full URL. r=maja_zf draft
authorAndreas Tolfsen <ato@sny.no>
Tue, 03 Oct 2017 16:21:25 +0100
changeset 677230 0293877da491cffa836fae776a284936058e7692
parent 677229 f325199389d31a3fc39985bad494f43b37f6fd41
child 677231 7bf7f8c0c8cb554c7c5aba0680168f2baa9775f6
push id83730
push userbmo:ato@sny.no
push dateTue, 10 Oct 2017 11:48:50 +0000
reviewersmaja_zf
bugs1405325
milestone58.0a1
Bug 1405325 - Use HTTPWireProtocol#url to build full URL. r=maja_zf Instead of using string concatentation for building the command URL, rely on self.url which internally uses urlparse.urljoin. MozReview-Commit-ID: DqakZJIgdJF
testing/web-platform/tests/tools/webdriver/webdriver/transport.py
--- a/testing/web-platform/tests/tools/webdriver/webdriver/transport.py
+++ b/testing/web-platform/tests/tools/webdriver/webdriver/transport.py
@@ -60,17 +60,17 @@ class HTTPWireProtocol(object):
         self.port = port
         self.url_prefix = url_prefix
 
         self._timeout = timeout
 
     def url(self, suffix):
         return urlparse.urljoin(self.url_prefix, suffix)
 
-    def send(self, method, url, body=None, headers=None):
+    def send(self, method, uri, body=None, headers=None):
         """Send a command to the remote.
 
         :param method: "POST" or "GET".
         :param url: "command part" of the requests URL path
         :param body: Body of the request.  Defaults to an empty dictionary
             if ``method`` is "POST".
         :param headers: Additional headers to include in the request.
         :return: an instance of wdclient.Response describing the HTTP response
@@ -84,17 +84,17 @@ class HTTPWireProtocol(object):
             body = json.dumps(body, cls=ToJsonEncoder)
 
         if isinstance(body, unicode):
             body = body.encode("utf-8")
 
         if headers is None:
             headers = {}
 
-        url = self.url_prefix + url
+        url = self.url(uri)
 
         kwargs = {}
         if self._timeout is not None:
             kwargs["timeout"] = self._timeout
 
         conn = httplib.HTTPConnection(
             self.host, self.port, strict=True, **kwargs)
         conn.request(method, url, body, headers)