Merge pull request #583 from pypeng/resp-maybe-none

resp maybe None when pre_request raises exceptions
This commit is contained in:
Randall Leeds 2013-08-06 01:48:15 -07:00
commit 5afb03e6f4
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: