diff options
author | Erik Dubbelboer <erik@dubbelboer.com> | 2024-04-29 10:48:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-29 10:48:09 +0200 |
commit | a8fa9c04b493324b7805dd5c6f8439b1b15a9f92 (patch) | |
tree | 3e96ca063b6a230e0211d308a84b19a2072a2cf8 | |
parent | chore(deps): bump golangci/golangci-lint-action from 4 to 5 (#1769) (diff) | |
download | fasthttp-a8fa9c04b493324b7805dd5c6f8439b1b15a9f92.tar.gz fasthttp-a8fa9c04b493324b7805dd5c6f8439b1b15a9f92.tar.bz2 fasthttp-a8fa9c04b493324b7805dd5c6f8439b1b15a9f92.zip |
Don't allow , in host when using Client (#1761)
When using a url like http://example.com,/ URI will parse "example.com,"
as host. HostClient then splits this by "," into multiple addresses and
will connect to example.com. HostClient splitting the address by "," is
only for direct use, not for use with Client.
-rw-r--r-- | client.go | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -2,6 +2,7 @@ package fasthttp import ( "bufio" + "bytes" "crypto/tls" "errors" "fmt" @@ -477,6 +478,10 @@ func (c *Client) Do(req *Request, resp *Response) error { host := uri.Host() + if bytes.ContainsRune(host, ',') { + return fmt.Errorf("invalid host %q. Use HostClient for multiple hosts", host) + } + isTLS := false if uri.isHTTPS() { isTLS = true |