Skip to content

Commit dcf3e26

Browse files
Jenkinsopenstack-gerrit
Jenkins
authored andcommitted
Merge "Fixed bug where 204 would sometimes be chunked" into milestone-proposed
2 parents fd0a0f0 + 229b2b9 commit dcf3e26

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

swift/proxy/server.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -839,11 +839,10 @@ def GETorHEAD_base(self, req, server_type, partition, nodes, path,
839839
res.environ['swift_x_timestamp'] = \
840840
source.getheader('x-timestamp')
841841
update_headers(res, {'accept-ranges': 'bytes'})
842-
if req.method == 'HEAD':
843-
res.content_length = source.getheader('Content-Length')
844-
if source.getheader('Content-Type'):
845-
res.charset = None
846-
res.content_type = source.getheader('Content-Type')
842+
res.content_length = source.getheader('Content-Length')
843+
if source.getheader('Content-Type'):
844+
res.charset = None
845+
res.content_type = source.getheader('Content-Type')
847846
return res
848847
return self.best_response(req, statuses, reasons, bodies,
849848
'%s %s' % (server_type, req.method))

test/unit/proxy/test_server.py

+12
Original file line numberDiff line numberDiff line change
@@ -3492,6 +3492,18 @@ def clean_acl(header, value):
34923492
res = controller.PUT(req)
34933493
self.assert_(called[0])
34943494

3495+
def test_GET_no_content(self):
3496+
with save_globals():
3497+
proxy_server.http_connect = \
3498+
fake_http_connect(200, 204, 204, 204)
3499+
controller = proxy_server.ContainerController(self.app, 'account',
3500+
'container')
3501+
req = Request.blank('/a/c')
3502+
self.app.update_request(req)
3503+
res = controller.GET(req)
3504+
self.assertEquals(res.content_length, 0)
3505+
self.assertTrue('transfer-encoding' not in res.headers)
3506+
34953507
def test_GET_calls_authorize(self):
34963508
called = [False]
34973509

0 commit comments

Comments
 (0)