Permalink
Browse files

Allow to not send the DNT header

  • Loading branch information...
The-Compiler committed Jul 3, 2017
1 parent 040be60 commit 5ada3606d88f5ee629fcd808f92e6bcaa9303204
@@ -33,9 +33,12 @@ class CallSuper(Exception):
def custom_headers():
"""Get the combined custom headers."""
headers = {}
dnt = b'1' if config.val.content.headers.do_not_track else b'0'
headers[b'DNT'] = dnt
headers[b'X-Do-Not-Track'] = dnt
dnt_config = config.val.content.headers.do_not_track
if dnt_config is not None:
dnt = b'1' if dnt_config else b'0'
headers[b'DNT'] = dnt
headers[b'X-Do-Not-Track'] = dnt
for header, value in config.val.content.headers.custom.items():
headers[header.encode('ascii')] = value.encode('ascii')
@@ -225,13 +225,15 @@ content.headers.custom:
desc: Set custom headers for qutebrowser HTTP requests.
content.headers.do_not_track:
type: Bool
type:
name: Bool
none_ok: true
default: true
desc: >-
Value to send in the `DNT` header.
When this is set to true, qutebrowser asks websites to not track your
identity.
identity. If set to null, the DNT header is not sent at all.
content.headers.referer:
default: same-domain
@@ -499,7 +499,11 @@ def check_header(quteproc, header, value):
content = quteproc.get_content()
data = json.loads(content)
print(data)
assert utils.pattern_match(pattern=value, value=data['headers'][header])
if value == '<unset>':
assert header not in data['headers']
else:
actual = data['headers'][header]
assert utils.pattern_match(pattern=value, value=actual)
@bdd.then(bdd.parsers.parse('the page should contain the html "{text}"'))
@@ -335,6 +335,12 @@ Feature: Various utility commands.
Then the header Dnt should be set to 0
And the header X-Do-Not-Track should be set to 0
Scenario: DNT header (unset)
When I set content.headers.do_not_track to <empty>
And I open headers
Then the header Dnt should be set to <unset>
And the header X-Do-Not-Track should be set to <unset>
Scenario: Accept-Language header
When I set content.headers.accept_language to en,de
And I open headers

0 comments on commit 5ada360

Please sign in to comment.