Fix some mistakes- Issue3243 (r87399) Correcting the operator precendence

problem with Content-Length header and uncommenting the test.
This commit is contained in:
Senthil Kumaran 2010-12-24 04:03:59 +00:00
parent c44befb82e
commit 1e991f2de5
3 changed files with 2 additions and 4 deletions

View File

@ -775,7 +775,7 @@ class HTTPConnection:
for d in data: for d in data:
self.sock.sendall(d) self.sock.sendall(d)
else: else:
raise TypeError("data should be byte-like object\ raise TypeError("data should be a bytes-like object\
or an iterable, got %r " % type(it)) or an iterable, got %r " % type(it))
def _output(self, s): def _output(self, s):

View File

@ -839,7 +839,6 @@ class HandlerTests(unittest.TestCase):
# A file object # A file object
"""
file_obj = io.StringIO() file_obj = io.StringIO()
file_obj.write("Something\nSomething\nSomething\n") file_obj.write("Something\nSomething\nSomething\n")
@ -863,7 +862,6 @@ class HandlerTests(unittest.TestCase):
req = Request("http://example.com/", iterable_array, headers) req = Request("http://example.com/", iterable_array, headers)
newreq = h.do_request_(req) newreq = h.do_request_(req)
self.assertEqual(int(newreq.get_header('Content-length')),16) self.assertEqual(int(newreq.get_header('Content-length')),16)
"""
def test_http_doubleslash(self): def test_http_doubleslash(self):

View File

@ -1062,7 +1062,7 @@ class AbstractHTTPHandler(BaseHandler):
data)) data))
else: else:
request.add_unredirected_header( request.add_unredirected_header(
'Content-length', '%d' % len(mv) * mv.itemsize) 'Content-length', '%d' % (len(mv) * mv.itemsize))
sel_host = host sel_host = host
if request.has_proxy(): if request.has_proxy():