From 5c8f9c52e3f2944f01cea621326532e058a225f7 Mon Sep 17 00:00:00 2001 From: Michael Barton Date: Wed, 14 Nov 2012 03:12:21 -0800 Subject: [PATCH] check response status in WSGIContext._app_call Only re-chain response iter if start_response hasn't been called yet. Change-Id: I9670f49419104fb8f949e6edc12d9047d1289cde --- swift/common/wsgi.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/swift/common/wsgi.py b/swift/common/wsgi.py index bf62cbebac..150afeebe7 100644 --- a/swift/common/wsgi.py +++ b/swift/common/wsgi.py @@ -262,7 +262,11 @@ class WSGIContext(object): """ Ensures start_response has been called before returning. """ - resp = iter(self.app(env, self._start_response)) + resp = self.app(env, self._start_response) + # if start_response has been called, just return the iter + if self._response_status is not None: + return resp + resp = iter(resp) try: first_chunk = resp.next() except StopIteration: