[PATCH 1 of 2] get-with-headers: support rfc2616 sec 5.1.2 requests

timeless at mozdev.org timeless at mozdev.org
Fri Oct 2 20:19:07 UTC 2015


# HG changeset patch
# User timeless at mozdev.org
# Date 1443813330 14400
#      Fri Oct 02 15:15:30 2015 -0400
# Node ID 8bd5471f48ec17944c641e3b7fbb8a2d9a8f1865
# Parent  97dc6ab42aad232c73180dee648685c26662230b
get-with-headers: support rfc2616 sec 5.1.2 requests

Upcoming patches will add support for rfc2616 sec 5.1.2 requests

diff --git a/tests/get-with-headers.py b/tests/get-with-headers.py
--- a/tests/get-with-headers.py
+++ b/tests/get-with-headers.py
@@ -35,14 +35,20 @@
 
 tag = None
 def request(host, path, show):
-    assert not path.startswith('/'), path
+    '''perform a GET request to host with the specified path
+       path should either be a fully qualified http(s)://host:port/path
+       or relative (i.e. with the leading '/' omitted).
+    '''
+    if not path.startswith('http://') and not path.startswith('https://'):
+        assert not path.startswith('/'), path
+        path = '/' + path
     global tag
     headers = {}
     if tag:
         headers['If-None-Match'] = tag
 
     conn = httplib.HTTPConnection(host)
-    conn.request("GET", '/' + path, None, headers)
+    conn.request("GET", path, None, headers)
     response = conn.getresponse()
     print response.status, response.reason
     if show[:1] == ['-']:


More information about the Mercurial-devel mailing list