Merge "py3: stop barfing on message/rfc822 Content-Types"
This commit is contained in:
@@ -87,6 +87,8 @@ class BufferedHTTPResponse(HTTPResponse):
|
|||||||
def begin(self):
|
def begin(self):
|
||||||
HTTPResponse.begin(self)
|
HTTPResponse.begin(self)
|
||||||
header_payload = self.headers.get_payload()
|
header_payload = self.headers.get_payload()
|
||||||
|
if isinstance(header_payload, list) and len(header_payload) == 1:
|
||||||
|
header_payload = header_payload[0].get_payload()
|
||||||
if header_payload:
|
if header_payload:
|
||||||
# This shouldn't be here. We must've bumped up against
|
# This shouldn't be here. We must've bumped up against
|
||||||
# https://bugs.python.org/issue37093
|
# https://bugs.python.org/issue37093
|
||||||
|
|||||||
@@ -501,6 +501,8 @@ class SwiftHttpProtocol(wsgi.HttpProtocol):
|
|||||||
def get_environ(self, *args, **kwargs):
|
def get_environ(self, *args, **kwargs):
|
||||||
environ = wsgi.HttpProtocol.get_environ(self, *args, **kwargs)
|
environ = wsgi.HttpProtocol.get_environ(self, *args, **kwargs)
|
||||||
header_payload = self.headers.get_payload()
|
header_payload = self.headers.get_payload()
|
||||||
|
if isinstance(header_payload, list) and len(header_payload) == 1:
|
||||||
|
header_payload = header_payload[0].get_payload()
|
||||||
if header_payload:
|
if header_payload:
|
||||||
# This shouldn't be here. We must've bumped up against
|
# This shouldn't be here. We must've bumped up against
|
||||||
# https://bugs.python.org/issue37093
|
# https://bugs.python.org/issue37093
|
||||||
|
|||||||
@@ -3297,9 +3297,10 @@ class TestReplicatedObjectController(
|
|||||||
fd.write(b'PUT /v1/a/c/o.chunked HTTP/1.1\r\n'
|
fd.write(b'PUT /v1/a/c/o.chunked HTTP/1.1\r\n'
|
||||||
b'Host: localhost\r\n'
|
b'Host: localhost\r\n'
|
||||||
b'X-Storage-Token: t\r\n'
|
b'X-Storage-Token: t\r\n'
|
||||||
b'Content-Type: application/octet-stream\r\n'
|
b'Content-Type: message/rfc822\r\n'
|
||||||
b'Content-Length: 33\r\n'
|
b'Content-Length: 33\r\n'
|
||||||
b'X-Object-Meta-\xf0\x9f\x8c\xb4: \xf0\x9f\x91\x8d\r\n'
|
b'X-Object-Meta-\xf0\x9f\x8c\xb4: \xf0\x9f\x91\x8d\r\n'
|
||||||
|
b'X-Object-Meta-\xe2\x98\x85: \xe2\x98\x85\r\n'
|
||||||
b'Expect: 100-continue\r\n'
|
b'Expect: 100-continue\r\n'
|
||||||
b'Transfer-Encoding: chunked\r\n\r\n')
|
b'Transfer-Encoding: chunked\r\n\r\n')
|
||||||
fd.flush()
|
fd.flush()
|
||||||
@@ -3338,9 +3339,13 @@ class TestReplicatedObjectController(
|
|||||||
headers = readuntil2crlfs(fd)
|
headers = readuntil2crlfs(fd)
|
||||||
exp = b'HTTP/1.1 200'
|
exp = b'HTTP/1.1 200'
|
||||||
self.assertEqual(headers[:len(exp)], exp)
|
self.assertEqual(headers[:len(exp)], exp)
|
||||||
self.assertIn(b'Content-Length: 33', headers.split(b'\r\n'))
|
header_lines = headers.split(b'\r\n')
|
||||||
|
self.assertIn(b'Content-Length: 33', header_lines)
|
||||||
|
self.assertIn(b'Content-Type: message/rfc822', header_lines)
|
||||||
self.assertIn(b'X-Object-Meta-\xf0\x9f\x8c\xb4: \xf0\x9f\x91\x8d',
|
self.assertIn(b'X-Object-Meta-\xf0\x9f\x8c\xb4: \xf0\x9f\x91\x8d',
|
||||||
headers.split(b'\r\n'))
|
header_lines)
|
||||||
|
self.assertIn(b'X-Object-Meta-\xe2\x98\x85: \xe2\x98\x85',
|
||||||
|
header_lines)
|
||||||
self.assertEqual(b"oh say can you see by the dawns'\n", fd.read(33))
|
self.assertEqual(b"oh say can you see by the dawns'\n", fd.read(33))
|
||||||
|
|
||||||
@unpatch_policies
|
@unpatch_policies
|
||||||
|
|||||||
Reference in New Issue
Block a user