3030from lib .core .common import getRequestHeader
3131from lib .core .common import getUnicode
3232from lib .core .common import logHTTPTraffic
33+ from lib .core .common import pushValue
34+ from lib .core .common import popValue
3335from lib .core .common import randomizeParameterValue
3436from lib .core .common import randomInt
3537from lib .core .common import randomStr
@@ -311,7 +313,7 @@ def getPage(**kwargs):
311313 headers [HTTP_HEADER .PROXY_AUTHORIZATION ] = kb .proxyAuthHeader
312314
313315 headers [HTTP_HEADER .ACCEPT ] = HTTP_ACCEPT_HEADER_VALUE
314- headers [HTTP_HEADER .ACCEPT_ENCODING ] = HTTP_ACCEPT_ENCODING_HEADER_VALUE if method != HTTPMETHOD . HEAD and kb .pageCompress else "identity"
316+ headers [HTTP_HEADER .ACCEPT_ENCODING ] = HTTP_ACCEPT_ENCODING_HEADER_VALUE if kb .pageCompress else "identity"
315317 headers [HTTP_HEADER .HOST ] = host or getHostHeader (url )
316318
317319 if post is not None and HTTP_HEADER .CONTENT_TYPE not in headers :
@@ -813,6 +815,9 @@ def _randomizeParameter(paramString, randomParameter):
813815 if kb .nullConnection and not content and not response and not timeBasedCompare :
814816 noteResponseTime = False
815817
818+ pushValue (kb .pageCompress )
819+ kb .pageCompress = False
820+
816821 if kb .nullConnection == NULLCONNECTION .HEAD :
817822 method = HTTPMETHOD .HEAD
818823 elif kb .nullConnection == NULLCONNECTION .RANGE :
@@ -829,6 +834,8 @@ def _randomizeParameter(paramString, randomParameter):
829834 elif kb .nullConnection == NULLCONNECTION .RANGE and HTTP_HEADER .CONTENT_RANGE in headers :
830835 pageLength = int (headers [HTTP_HEADER .CONTENT_RANGE ][headers [HTTP_HEADER .CONTENT_RANGE ].find ('/' ) + 1 :])
831836
837+ kb .pageCompress = popValue ()
838+
832839 if not pageLength :
833840 try :
834841 page , headers , code = Connect .getPage (url = uri , get = get , post = post , cookie = cookie , ua = ua , referer = referer , host = host , silent = silent , method = method , auxHeaders = auxHeaders , response = response , raise404 = raise404 , ignoreTimeout = timeBasedCompare )
0 commit comments