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

login
register
mail settings
Submitter timeless@mozdev.org
Date Oct. 2, 2015, 8:19 p.m.
Message ID <8bd5471f48ec17944c64.1443817147@waste.org>
Download mbox | patch
Permalink /patch/10740/
State Changes Requested
Delegated to: Augie Fackler
Headers show

Comments

timeless@mozdev.org - Oct. 2, 2015, 8:19 p.m.
# HG changeset patch
# User timeless@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

Patch

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] == ['-']: