Skip to content

Commit 497c399

Browse files
committed
fix: ensure Host header is set in unsafe mode for rawhttp requests
1 parent 7b8fd15 commit 497c399

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

common/httpx/httpx.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,9 @@ func (h *HTTPX) SetCustomHeaders(r *retryablehttp.Request, headers map[string]st
424424
switch strings.ToLower(name) {
425425
case "host":
426426
r.Host = value
427+
if h.Options.Unsafe {
428+
r.Header.Set("Host", value)
429+
}
427430
case "cookie":
428431
// cookies are set in the default branch, and reset during the follow redirect flow
429432
fallthrough

0 commit comments

Comments
 (0)