Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2f4cf61

Browse files
committed
Merge pull request #375 from frohoff/fix_non_ascii_header_name
fixed response header logging for header names with special chars
2 parents 3c0c7f7 + 218a6a9 commit 2f4cf61

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lib/request/connect.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ def getPage(**kwargs):
452452
responseMsg += "[#%d] (%d %s):\n" % (threadData.lastRequestUID, code, status)
453453

454454
if responseHeaders:
455-
logHeaders = "\n".join("%s: %s" % (key.capitalize() if isinstance(key, basestring) else key, getUnicode(value)) for (key, value) in responseHeaders.items())
455+
logHeaders = "\n".join("%s: %s" % (getUnicode(key.capitalize() if isinstance(key, basestring) else key), getUnicode(value)) for (key, value) in responseHeaders.items())
456456

457457
logHTTPTraffic(requestMsg, "%s%s\n\n%s" % (responseMsg, logHeaders, (page or "")[:MAX_CONNECTION_CHUNK_SIZE]))
458458

@@ -543,7 +543,7 @@ def getPage(**kwargs):
543543

544544
responseMsg += "[#%d] (%d %s):\n" % (threadData.lastRequestUID, code, status)
545545
if responseHeaders:
546-
logHeaders = "\n".join("%s: %s" % (key.capitalize() if isinstance(key, basestring) else key, getUnicode(value)) for (key, value) in responseHeaders.items())
546+
logHeaders = "\n".join("%s: %s" % (getUnicode(key.capitalize() if isinstance(key, basestring) else key), getUnicode(value)) for (key, value) in responseHeaders.items())
547547

548548
if not skipLogTraffic:
549549
logHTTPTraffic(requestMsg, "%s%s\n\n%s" % (responseMsg, logHeaders, (page or "")[:MAX_CONNECTION_CHUNK_SIZE]))

0 commit comments

Comments
 (0)