Skip to content

Host header automatically set to title case #456

@Fussballexperte

Description

@Fussballexperte

When using HTTP1, the Host header is automatically set in title case ("Host"). If I set the header in lowercase, an additional title cased header is added.

host: example.com
Host: example.com

Sugggestion would be to update fhttp/request.go:

Line 624 in func (r *Request) write(w io.Writer, usingProxy bool, extraHeaders Header, waitForContinue func() bool) (err error)

old:

if _, ok := r.Header["Host"]; !ok {
    r.Header.Set("Host", host)
}

new:

foundHost := false
for k := range r.Header {
    if strings.EqualFold(k, "Host") {
        foundHost = true
        break
    }
}

if !foundHost {
    r.Header.Set("Host", host)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions