inital commit

This commit is contained in:
2026-05-26 20:21:55 +02:00
parent 965f9d6ad4
commit 0ae20aa68d
21 changed files with 651 additions and 111 deletions

View File

@@ -32,6 +32,17 @@ const defaultMaxRetries = 3
// injects the User-Agent header, retries on transient failures, and
// classifies Cloudflare challenges as non-retryable user-actionable errors.
func (t *transport) RoundTrip(req *http.Request) (*http.Response, error) {
if ov := requestOverrideFrom(req.Context()); ov != nil {
if ov.userAgent != "" {
req.Header.Set("User-Agent", ov.userAgent)
}
if ov.touchesCookies() {
// The cookie jar already wrote a Cookie header by the time we
// reach RoundTrip; replace it wholesale so per-user creds win
// over whatever the shared jar would inject.
req.Header.Set("Cookie", ov.cookieHeader())
}
}
if t.userAgent != "" && req.Header.Get("User-Agent") == "" {
req.Header.Set("User-Agent", t.userAgent)
}