parent
c5999443a1
commit
e860d8cfea
@ -21,6 +21,7 @@ Added
|
|||||||
~~~~~
|
~~~~~
|
||||||
|
|
||||||
- New `:edit-url` command to edit the URL in an external editor.
|
- New `:edit-url` command to edit the URL in an external editor.
|
||||||
|
- New `network -> custom-headers` setting to send custom headers with every request.
|
||||||
|
|
||||||
Changed
|
Changed
|
||||||
~~~~~~~
|
~~~~~~~
|
||||||
|
@ -398,6 +398,13 @@ class NetworkManager(QNetworkAccessManager):
|
|||||||
req.setRawHeader('DNT'.encode('ascii'), dnt)
|
req.setRawHeader('DNT'.encode('ascii'), dnt)
|
||||||
req.setRawHeader('X-Do-Not-Track'.encode('ascii'), dnt)
|
req.setRawHeader('X-Do-Not-Track'.encode('ascii'), dnt)
|
||||||
|
|
||||||
|
# Load custom headers
|
||||||
|
custom_headers = config.get('network', 'custom-headers')
|
||||||
|
|
||||||
|
if custom_headers is not None:
|
||||||
|
for header, value in custom_headers.items():
|
||||||
|
req.setRawHeader(header.encode('ascii'), value.encode('ascii'))
|
||||||
|
|
||||||
# There are some scenarios where we can't figure out current_url:
|
# There are some scenarios where we can't figure out current_url:
|
||||||
# - There's a generic NetworkManager, e.g. for downloads
|
# - There's a generic NetworkManager, e.g. for downloads
|
||||||
# - The download was in a tab which is now closed.
|
# - The download was in a tab which is now closed.
|
||||||
|
@ -401,6 +401,10 @@ def data(readonly=False):
|
|||||||
SettingValue(typ.Bool(), 'true'),
|
SettingValue(typ.Bool(), 'true'),
|
||||||
"Whether to try to pre-fetch DNS entries to speed up browsing."),
|
"Whether to try to pre-fetch DNS entries to speed up browsing."),
|
||||||
|
|
||||||
|
('custom-headers',
|
||||||
|
SettingValue(typ.HeaderDict(none_ok=True), ''),
|
||||||
|
"Set custom headers for qutebrowser HTTP requests."),
|
||||||
|
|
||||||
readonly=readonly
|
readonly=readonly
|
||||||
)),
|
)),
|
||||||
|
|
||||||
|
@ -362,3 +362,10 @@ Feature: Various utility commands.
|
|||||||
And I press the key "<Tab>"
|
And I press the key "<Tab>"
|
||||||
And I press the key "<Ctrl-C>"
|
And I press the key "<Ctrl-C>"
|
||||||
Then no crash should happen
|
Then no crash should happen
|
||||||
|
|
||||||
|
## Custom headers
|
||||||
|
|
||||||
|
Scenario: Setting a custom header
|
||||||
|
When I set network -> custom-headers to {"X-Qute-Test": "testvalue"}
|
||||||
|
And I open headers
|
||||||
|
Then the header X-Qute-Test should be set to testvalue
|
||||||
|
Loading…
Reference in New Issue
Block a user