diff options
author | Andrew Svetlov <andrew.svetlov@gmail.com> | 2013-04-12 19:49:19 (GMT) |
---|---|---|
committer | Andrew Svetlov <andrew.svetlov@gmail.com> | 2013-04-12 19:49:19 (GMT) |
commit | 7b2c8bb833780a6f6a0b5480f65d27248d7b3b53 (patch) | |
tree | 8bf8f58f639df574ed2f0dffd26de50baac07505 | |
parent | a3b255f275b09d5e12b43832c022df35a4fed9ac (diff) | |
download | cpython-7b2c8bb833780a6f6a0b5480f65d27248d7b3b53.zip cpython-7b2c8bb833780a6f6a0b5480f65d27248d7b3b53.tar.gz cpython-7b2c8bb833780a6f6a0b5480f65d27248d7b3b53.tar.bz2 |
Issue #16658: add missing return to HTTPConnection.send().
Patch by Jeff Knupp
-rw-r--r-- | Lib/http/client.py | 2 | ||||
-rw-r--r-- | Lib/test/test_httplib.py | 21 | ||||
-rw-r--r-- | Misc/NEWS | 3 |
3 files changed, 25 insertions, 1 deletions
diff --git a/Lib/http/client.py b/Lib/http/client.py index 4663d43..b72cf08 100644 --- a/Lib/http/client.py +++ b/Lib/http/client.py @@ -866,7 +866,7 @@ class HTTPConnection: if encode: datablock = datablock.encode("iso-8859-1") self.sock.sendall(datablock) - + return try: self.sock.sendall(data) except TypeError: diff --git a/Lib/test/test_httplib.py b/Lib/test/test_httplib.py index db123dc..863e4bc 100644 --- a/Lib/test/test_httplib.py +++ b/Lib/test/test_httplib.py @@ -371,6 +371,27 @@ class BasicTest(TestCase): conn.send(io.BytesIO(expected)) self.assertEqual(expected, sock.data) + def test_send_updating_file(self): + def data(): + yield 'data' + yield None + yield 'data_two' + + class UpdatingFile(): + mode = 'r' + d = data() + def read(self, blocksize=-1): + return self.d.__next__() + + expected = b'data' + + conn = client.HTTPConnection('example.com') + sock = FakeSocket("") + conn.sock = sock + conn.send(UpdatingFile()) + self.assertEqual(sock.data, expected) + + def test_send_iter(self): expected = b'GET /foo HTTP/1.1\r\nHost: example.com\r\n' \ b'Accept-Encoding: identity\r\nContent-Length: 11\r\n' \ @@ -23,6 +23,9 @@ Core and Builtins Library ------- +- Issue #16658: add missing return to HTTPConnection.send() + Patch by Jeff Knupp. + - Issue #14971: unittest test discovery no longer gets confused when a function has a different __name__ than its name in the TestCase class dictionary. |