mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Issue #16658: add missing return to HTTPConnection.send().
Patch by Jeff Knupp
This commit is contained in:
commit
3042b5ebf4
3 changed files with 25 additions and 1 deletions
|
@ -864,7 +864,7 @@ class HTTPConnection:
|
||||||
if encode:
|
if encode:
|
||||||
datablock = datablock.encode("iso-8859-1")
|
datablock = datablock.encode("iso-8859-1")
|
||||||
self.sock.sendall(datablock)
|
self.sock.sendall(datablock)
|
||||||
|
return
|
||||||
try:
|
try:
|
||||||
self.sock.sendall(data)
|
self.sock.sendall(data)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
|
|
|
@ -373,6 +373,27 @@ class BasicTest(TestCase):
|
||||||
conn.send(io.BytesIO(expected))
|
conn.send(io.BytesIO(expected))
|
||||||
self.assertEqual(expected, sock.data)
|
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):
|
def test_send_iter(self):
|
||||||
expected = b'GET /foo HTTP/1.1\r\nHost: example.com\r\n' \
|
expected = b'GET /foo HTTP/1.1\r\nHost: example.com\r\n' \
|
||||||
b'Accept-Encoding: identity\r\nContent-Length: 11\r\n' \
|
b'Accept-Encoding: identity\r\nContent-Length: 11\r\n' \
|
||||||
|
|
|
@ -34,6 +34,9 @@ Core and Builtins
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #16658: add missing return to HTTPConnection.send()
|
||||||
|
Patch by Jeff Knupp.
|
||||||
|
|
||||||
- Issue #9556: Allowed specifying a time-of-day for a TimedRotatingFileHandler
|
- Issue #9556: Allowed specifying a time-of-day for a TimedRotatingFileHandler
|
||||||
to rotate.
|
to rotate.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue