anacrolix / torrent

Full-featured BitTorrent client package and utilities
Mozilla Public License 2.0
5.51k stars 622 forks source link

Modify HTTP request before sending #787

Closed marcovidonis closed 1 year ago

marcovidonis commented 1 year ago

Exposes a method in torrent.ClientConfig to define a function that modifies the HTTP request. The method is called right before sending the request.

This could be used, for example, to add authentication headers to the request, which could be used to grant permission to a private tracker.

This addresses #784.

anacrolix commented 1 year ago

I might expedite this and merge it in. I also will make some opinionated changes to some config field names, I believe the Go team got the convention wrong, and it's starting to spread inside the code base. The failing CI is unrelated and fixed on master.