From a7d1a0c2502bdbfe245054fca361d21bcb626000 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Mon, 23 Jul 2012 14:14:22 +0200 Subject: [PATCH] Implementation for an Issue #117 --- lib/core/settings.py | 5 ++++- lib/request/connect.py | 5 ++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/core/settings.py b/lib/core/settings.py index 4fe56136b..ab33b175d 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -70,9 +70,12 @@ UNION_STDEV_COEFF = 7 # length of queue for candidates for time delay adjustment TIME_DELAY_CANDIDATES = 3 -# standard value for HTTP Accept header +# default value for HTTP Accept header HTTP_ACCEPT_HEADER_VALUE = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" +# default value for HTTP Accept-Encoding header +HTTP_ACCEPT_ENCODING_HEADER_VALUE = "gzip,deflate" + # HTTP timeout in silent mode HTTP_SILENT_TIMEOUT = 3 diff --git a/lib/request/connect.py b/lib/request/connect.py index 8a6089d56..18453f6d1 100644 --- a/lib/request/connect.py +++ b/lib/request/connect.py @@ -48,6 +48,7 @@ from lib.core.exception import sqlmapConnectionException from lib.core.exception import sqlmapSyntaxException from lib.core.settings import CUSTOM_INJECTION_MARK_CHAR from lib.core.settings import HTTP_ACCEPT_HEADER_VALUE +from lib.core.settings import HTTP_ACCEPT_ENCODING_HEADER_VALUE from lib.core.settings import HTTP_SILENT_TIMEOUT from lib.core.settings import MAX_CONNECTION_CHUNK_SIZE from lib.core.settings import META_REFRESH_REGEX @@ -267,6 +268,7 @@ class Connect: headers[HTTPHEADER.PROXY_AUTHORIZATION] = kb.proxyAuthHeader headers[HTTPHEADER.ACCEPT] = HTTP_ACCEPT_HEADER_VALUE + headers[HTTPHEADER.ACCEPT_ENCODING] = HTTP_ACCEPT_ENCODING_HEADER_VALUE headers[HTTPHEADER.HOST] = host or getHostHeader(url) @@ -286,9 +288,6 @@ class Connect: else: req = urllib2.Request(url, post, headers) - if not req.has_header(HTTPHEADER.ACCEPT_ENCODING): - requestHeaders += "%s: identity\n" % HTTPHEADER.ACCEPT_ENCODING - requestHeaders += "\n".join("%s: %s" % (key.capitalize() if isinstance(key, basestring) else key, getUnicode(value)) for (key, value) in req.header_items()) if not req.has_header(HTTPHEADER.COOKIE) and conf.cj: