skip host in http_connect if specified in headers

Change-Id: If614768f2aaf7ca8b06985c8efcd4120b324b290
This commit is contained in:
David Goetz 2012-02-07 11:36:42 -08:00
parent e90424e88b
commit 0f997425ea
2 changed files with 3 additions and 3 deletions

View File

@ -135,7 +135,7 @@ def http_connect(ipaddr, port, device, partition, method, path,
if query_string: if query_string:
path += '?' + query_string path += '?' + query_string
conn.path = path conn.path = path
conn.putrequest(method, path) conn.putrequest(method, path, skip_host=(headers and 'Host' in headers))
if headers: if headers:
for header, value in headers.iteritems(): for header, value in headers.iteritems():
conn.putheader(header, str(value)) conn.putheader(header, str(value))
@ -168,7 +168,7 @@ def http_connect_raw(ipaddr, port, method, path, headers=None,
if query_string: if query_string:
path += '?' + query_string path += '?' + query_string
conn.path = path conn.path = path
conn.putrequest(method, path) conn.putrequest(method, path, skip_host=(headers and 'Host' in headers))
if headers: if headers:
for header, value in headers.iteritems(): for header, value in headers.iteritems():
conn.putheader(header, str(value)) conn.putheader(header, str(value))

View File

@ -74,7 +74,7 @@ class TestBufferedHTTP(unittest.TestCase):
def __init__(self, hostport): def __init__(self, hostport):
pass pass
def putrequest(self, method, path): def putrequest(self, method, path, skip_host=0):
pass pass
def putheader(self, header, *values): def putheader(self, header, *values):