[qutebrowser] How to send custom header ?

Florian Bruhin me at the-compiler.org
Mon Dec 21 23:52:28 CET 2020


On Mon, Dec 21, 2020 at 08:18:42PM +0000, John Lane wrote:
> I'm testing some sites not set up in dns. I can do this with curl:
> 
> curl 10.90.87.64 -H 'Host: this-site.com'
> curl 10.90.87.64 -H 'Host: that-site.com'
> 
> How can I achieve same in Qutebrowser?
> 
> I've seen content.headers.custom but it isn't clear how to use it.

What about it isn't clear?
It's a dictionary (mapping header names to their values) in the config.

To set them in a config.py file, see:
https://github.com/qutebrowser/qutebrowser/blob/master/doc/help/configuring.asciidoc#changing-settings

As for setting it at runtime, either use a JSON string:

  :set -t content.headers.custom "{'X-Answer': '42'}"

Or use the special :config-dict-* commands:

  :config-dict-add --replace content.headers.custom X-Answer 42

> Also, I'd like to be able to do it on the fly (when typing in the url)
> if possible at all?

Not when typing the URL, but you can use those commands (maybe with
--temp so they don't get persisted) before opening the URL. You can also
set those for a specific URL pattern by using ":set -u example.org
content.headers.custom ...".

Florian

-- 
me at the-compiler.org (Mail/XMPP) | https://www.qutebrowser.org 
       https://bruhin.software/ | https://github.com/sponsors/The-Compiler/
       GPG: 916E B0C8 FD55 A072 | https://the-compiler.org/pubkey.asc
             I love long mails! | https://email.is-not-s.ms/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://listi.jpberlin.de/pipermail/qutebrowser/attachments/20201221/0fc6c247/attachment.asc>


More information about the qutebrowser mailing list