Allow to not send the DNT header
This commit is contained in:
parent
040be60697
commit
5ada3606d8
@ -33,7 +33,10 @@ class CallSuper(Exception):
|
|||||||
def custom_headers():
|
def custom_headers():
|
||||||
"""Get the combined custom headers."""
|
"""Get the combined custom headers."""
|
||||||
headers = {}
|
headers = {}
|
||||||
dnt = b'1' if config.val.content.headers.do_not_track else b'0'
|
|
||||||
|
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'DNT'] = dnt
|
||||||
headers[b'X-Do-Not-Track'] = dnt
|
headers[b'X-Do-Not-Track'] = dnt
|
||||||
|
|
||||||
|
@ -225,13 +225,15 @@ content.headers.custom:
|
|||||||
desc: Set custom headers for qutebrowser HTTP requests.
|
desc: Set custom headers for qutebrowser HTTP requests.
|
||||||
|
|
||||||
content.headers.do_not_track:
|
content.headers.do_not_track:
|
||||||
type: Bool
|
type:
|
||||||
|
name: Bool
|
||||||
|
none_ok: true
|
||||||
default: true
|
default: true
|
||||||
desc: >-
|
desc: >-
|
||||||
Value to send in the `DNT` header.
|
Value to send in the `DNT` header.
|
||||||
|
|
||||||
When this is set to true, qutebrowser asks websites to not track your
|
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:
|
content.headers.referer:
|
||||||
default: same-domain
|
default: same-domain
|
||||||
|
@ -499,7 +499,11 @@ def check_header(quteproc, header, value):
|
|||||||
content = quteproc.get_content()
|
content = quteproc.get_content()
|
||||||
data = json.loads(content)
|
data = json.loads(content)
|
||||||
print(data)
|
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}"'))
|
@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
|
Then the header Dnt should be set to 0
|
||||||
And the header X-Do-Not-Track 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
|
Scenario: Accept-Language header
|
||||||
When I set content.headers.accept_language to en,de
|
When I set content.headers.accept_language to en,de
|
||||||
And I open headers
|
And I open headers
|
||||||
|
Loading…
Reference in New Issue
Block a user