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

Skip to content

Commit 3695322

Browse files
committed
few quick changes
1 parent 887adfc commit 3695322

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

lib/request/basic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def parseResponse(page, headers):
8787

8888
if absFilePath not in kb.absFilePaths:
8989
kb.absFilePaths.add(absFilePath)
90-
90+
9191

9292
def decodePage(page, contentEncoding, contentType):
9393
"""
@@ -105,6 +105,6 @@ def decodePage(page, contentEncoding, contentType):
105105

106106
#http://stackoverflow.com/questions/1020892/python-urllib2-read-to-unicode
107107
if contentType and (contentType.find('charset=') != -1):
108-
page = unicode(page, contentType.split('charset=')[-1])
108+
page = unicode(page, contentType.split('charset=')[-1]) #don't use getUnicode here. it needs to stay as is.
109109

110110
return page

lib/request/connect.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232

3333
from lib.contrib import multipartpost
3434
from lib.core.common import readInput
35+
from lib.core.common import getUnicode
3536
from lib.core.convert import urlencode
3637
from lib.core.data import conf
3738
from lib.core.data import kb
@@ -163,7 +164,7 @@ def getPage(**kwargs):
163164
if not cookieStr:
164165
cookieStr = "Cookie: "
165166

166-
cookie = unicode(cookie)
167+
cookie = getUnicode(cookie)
167168
index = cookie.index(" for ")
168169

169170
cookieStr += "%s; " % cookie[8:index]
@@ -256,7 +257,7 @@ def getPage(**kwargs):
256257
responseMsg += "(%s - %d):\n" % (status, code)
257258

258259
if conf.verbose <= 4:
259-
responseMsg += unicode(responseHeaders)
260+
responseMsg += getUnicode(responseHeaders)
260261
elif conf.verbose > 4:
261262
responseMsg += "%s\n%s\n" % (responseHeaders, page)
262263

0 commit comments

Comments
 (0)