Skip to content

Commit ddd9247

Browse files
committed
minor fix
1 parent 19beb91 commit ddd9247

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

lib/request/connect.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ def getPage(**kwargs):
165165
# url splitted with space char while urlencoding it in the later phase
166166
url = url.replace(" ", "%20")
167167

168+
code = None
168169
page = None
169170
requestMsg = u"HTTP request [#%d]:\n%s " % (threadData.lastRequestUID, method or (HTTPMETHOD.POST if post else HTTPMETHOD.GET))
170171
requestMsg += "%s" % urlparse.urlsplit(url)[2] or "/"
@@ -308,10 +309,11 @@ def getPage(**kwargs):
308309
else kb.originalPage if kb.redirectChoice == REDIRECTION.ORIGINAL\
309310
else conn.read()
310311
skipLogTraffic = kb.redirectChoice != REDIRECTION.FOLLOW
312+
code = conn.redcode
311313
else:
312314
page = conn.read()
313315

314-
code = conn.code
316+
code = code or conn.code
315317
responseHeaders = conn.info()
316318
responseHeaders[URI_HTTP_HEADER] = conn.geturl()
317319
page = decodePage(page, responseHeaders.get(HTTPHEADER.CONTENT_ENCODING), responseHeaders.get(HTTPHEADER.CONTENT_TYPE))

0 commit comments

Comments
 (0)