Make ssync_sender a better HTTP client

When a server responses with an error - if that error includes a body - the
client should read the body.  This cleans up some ugly eventlet/wsgi.server log
output related to chunked transfer disconnect (invalid literal for int() with
base 16).

Change-Id: Ibd06ddee9f216fce07fa33c3a7d8306b59eb6d77
Closes-Bug: #1466138
This commit is contained in:
Clay Gerrard
2015-06-25 01:44:10 -07:00
committed by Matthew Oliver
parent d124ce5792
commit c95a0efe79
2 changed files with 4 additions and 0 deletions

View File

@@ -143,6 +143,7 @@ class Sender(object):
self.daemon.node_timeout, 'connect receive'):
self.response = self.connection.getresponse()
if self.response.status != http.HTTP_OK:
self.response.read()
raise exceptions.ReplicationException(
'Expected status %s; got %s' %
(http.HTTP_OK, self.response.status))

View File

@@ -80,6 +80,9 @@ class FakeResponse(object):
self.fp = StringIO.StringIO(
'%x\r\n%s\r\n0\r\n\r\n' % (len(chunk_body), chunk_body))
def read(self, *args, **kwargs):
return ''
def close(self):
self.close_called = True