resp maybe None when pre_request raise exceptions

This commit is contained in:
py 2013-07-30 17:27:51 +08:00
parent 53c4484bb8
commit b4c286bc81
2 changed files with 2 additions and 2 deletions

View File

@ -105,7 +105,7 @@ class AsyncWorker(base.Worker):
if resp.should_close():
raise StopIteration()
except Exception:
if resp.headers_sent:
if resp and resp.headers_sent:
# If the requests have already been sent, we should close the
# connection to indicate the error.
try:

View File

@ -144,7 +144,7 @@ class SyncWorker(base.Worker):
except socket.error:
raise
except Exception as e:
if resp.headers_sent:
if resp and resp.headers_sent:
# If the requests have already been sent, we should close the
# connection to indicate the error.
try: