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

Skip to content

Commit fef407e

Browse files
committed
Making HTTP requests up to 20% smaller (fine tuning the request headers)
1 parent 5afccce commit fef407e

3 files changed

Lines changed: 7 additions & 18 deletions

File tree

lib/core/option.py

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1396,16 +1396,12 @@ def _setHTTPExtraHeaders():
13961396
raise SqlmapSyntaxException(errMsg)
13971397

13981398
elif not conf.requestFile and len(conf.httpHeaders or []) < 2:
1399-
conf.httpHeaders.append((HTTP_HEADER.ACCEPT_LANGUAGE, "en-us,en;q=0.5"))
1400-
if not conf.charset:
1401-
conf.httpHeaders.append((HTTP_HEADER.ACCEPT_CHARSET, "ISO-8859-15,utf-8;q=0.7,*;q=0.7"))
1402-
else:
1399+
if conf.charset:
14031400
conf.httpHeaders.append((HTTP_HEADER.ACCEPT_CHARSET, "%s;q=0.7,*;q=0.1" % conf.charset))
14041401

14051402
# Invalidating any caching mechanism in between
1406-
# Reference: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
1407-
conf.httpHeaders.append((HTTP_HEADER.CACHE_CONTROL, "no-cache,no-store"))
1408-
conf.httpHeaders.append((HTTP_HEADER.PRAGMA, "no-cache"))
1403+
# Reference: http://stackoverflow.com/a/1383359
1404+
conf.httpHeaders.append((HTTP_HEADER.CACHE_CONTROL, "no-cache"))
14091405

14101406
def _defaultHTTPUserAgent():
14111407
"""
@@ -1415,13 +1411,6 @@ def _defaultHTTPUserAgent():
14151411

14161412
return "%s (%s)" % (VERSION_STRING, SITE)
14171413

1418-
# Firefox 3 running on Ubuntu 9.04 updated at April 2009
1419-
#return "Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.9.0.9) Gecko/2009042113 Ubuntu/9.04 (jaunty) Firefox/3.0.9"
1420-
1421-
# Internet Explorer 7.0 running on Windows 2003 Service Pack 2 english
1422-
# updated at March 2009
1423-
#return "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.2; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)"
1424-
14251414
def _setHTTPUserAgent():
14261415
"""
14271416
Set the HTTP User-Agent header.

lib/core/settings.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from lib.core.revision import getRevisionNumber
2020

2121
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
22-
VERSION = "1.0.9.50"
22+
VERSION = "1.0.9.51"
2323
REVISION = getRevisionNumber()
2424
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
2525
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
@@ -133,7 +133,7 @@
133133
TIME_DELAY_CANDIDATES = 3
134134

135135
# Default value for HTTP Accept header
136-
HTTP_ACCEPT_HEADER_VALUE = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
136+
HTTP_ACCEPT_HEADER_VALUE = "*/*"
137137

138138
# Default value for HTTP Accept-Encoding header
139139
HTTP_ACCEPT_ENCODING_HEADER_VALUE = "gzip,deflate"

txt/checksum.md5

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ e4aec2b11c1ad6039d0c3dbbfbc5eb1a lib/core/exception.py
3939
cc9c82cfffd8ee9b25ba3af6284f057e lib/core/__init__.py
4040
91c514013daa796e2cdd940389354eac lib/core/log.py
4141
5b079749c50240602ea92637e268ed31 lib/core/optiondict.py
42-
74d826338a2cd66a4724d8486a648d93 lib/core/option.py
42+
c3bcfb12b2dc7f6eb23f46d020faf580 lib/core/option.py
4343
1e8948dddbd12def5c2af52530738059 lib/core/profiling.py
4444
e60456db5380840a586654344003d4e6 lib/core/readlineng.py
4545
5ef56abb8671c2ca6ceecb208258e360 lib/core/replication.py
4646
99a2b496b9d5b546b335653ca801153f lib/core/revision.py
4747
7c15dd2777af4dac2c89cab6df17462e lib/core/session.py
48-
d9678d7975815c56e3ec2e526e9ed7d7 lib/core/settings.py
48+
9652b7cb6777148034310c0e66b2e85a lib/core/settings.py
4949
7af83e4f18cab6dff5e67840eb65be80 lib/core/shell.py
5050
23657cd7d924e3c6d225719865855827 lib/core/subprocessng.py
5151
c3ace7874a536d801f308cf1fd03df99 lib/core/target.py

0 commit comments

Comments
 (0)