diff --git a/swift/common/middleware/proxy_logging.py b/swift/common/middleware/proxy_logging.py index 3cc21b4783..a63e10436f 100644 --- a/swift/common/middleware/proxy_logging.py +++ b/swift/common/middleware/proxy_logging.py @@ -205,10 +205,6 @@ class ProxyLoggingMiddleware(object): elif isinstance(iterable, list): start_response_args[0][1].append( ('content-length', str(sum(len(i) for i in iterable)))) - else: - raise Exception('WSGI [proxy-logging]: No content-length ' - 'or transfer-encoding header sent and ' - 'there is content! %r' % chunk) start_response(*start_response_args[0]) bytes_sent = 0 client_disconnect = False diff --git a/test/unit/common/middleware/test_proxy_logging.py b/test/unit/common/middleware/test_proxy_logging.py index ceee8689b0..86841df5b8 100644 --- a/test/unit/common/middleware/test_proxy_logging.py +++ b/test/unit/common/middleware/test_proxy_logging.py @@ -391,25 +391,6 @@ class TestProxyLogging(unittest.TestCase): self.assertEquals(resp_body, '') self.assertEquals(log_parts[11], '-') - def test_no_content_length_no_transfer_encoding_with_str_body(self): - app = proxy_logging.ProxyLoggingMiddleware( - FakeAppNoContentLengthNoTransferEncoding( - body='line1\nline2\n', - ), {}) - app.access_logger = FakeLogger() - req = Request.blank('/', environ={'REQUEST_METHOD': 'GET'}) - resp = app(req.environ, start_response) - # Python 2.7 can have assertRaises act as a context manager, but python - # 2.6 can't. So there's this. - try: - resp_body = ''.join(resp) - except Exception as e: - self.assertEquals( - "WSGI [proxy-logging]: No content-length or transfer-encoding " - "header sent and there is content! 'l'", str(e)) - else: - self.assert_(False) - def test_req_path_info_popping(self): app = proxy_logging.ProxyLoggingMiddleware(FakeApp(), {}) app.access_logger = FakeLogger()