Merge branch 'paretje-netrc'

This commit is contained in:
Florian Bruhin 2016-10-14 06:45:58 +02:00
commit 89e422a9f7
4 changed files with 14 additions and 2 deletions

View File

@ -163,9 +163,9 @@ Contributors, sorted by the number of commits in descending order:
* Corentin Julé
* meles5
* Philipp Hansch
* Kevin Velghe
* Daniel Karbach
* Panagiotis Ktistakis
* Kevin Velghe
* Artur Shaik
* Nathan Isom
* Thorsten Wißmann

View File

@ -69,6 +69,7 @@
|<<network-ssl-strict,ssl-strict>>|Whether to validate SSL handshakes.
|<<network-dns-prefetch,dns-prefetch>>|Whether to try to pre-fetch DNS entries to speed up browsing.
|<<network-custom-headers,custom-headers>>|Set custom headers for qutebrowser HTTP requests.
|<<network-netrc-file,netrc-file>>|Set location of a netrc-file for HTTP authentication. If empty, ~/.netrc is used.
|==============
.Quick reference for section ``completion''
@ -808,6 +809,12 @@ Set custom headers for qutebrowser HTTP requests.
Default: empty
[[network-netrc-file]]
=== netrc-file
Set location of a netrc-file for HTTP authentication. If empty, ~/.netrc is used.
Default: empty
== completion
Options related to completion and command history.

View File

@ -330,7 +330,7 @@ class NetworkManager(QNetworkAccessManager):
# altogether.
reply.netrc_used = True
try:
net = netrc.netrc()
net = netrc.netrc(config.get('network', 'netrc-file'))
authenticators = net.authenticators(reply.url().host())
if authenticators is not None:
(user, _account, password) = authenticators

View File

@ -438,6 +438,11 @@ def data(readonly=False):
SettingValue(typ.HeaderDict(none_ok=True), ''),
"Set custom headers for qutebrowser HTTP requests."),
('netrc-file',
SettingValue(typ.File(none_ok=True), ''),
"Set location of a netrc-file for HTTP authentication. If empty, "
"~/.netrc is used."),
readonly=readonly
)),