Upgrade to Go 1.21 (#3573)

* Upgrade to Go 1.21

* event: remove tests depending on pointer comparison

The test now just tests that the logger is non-nil. For
some reason the old test was broken by upgrading
to Go 1.21.0.

* api: use dummy Host header for unix sockets

When using unix sockets with the net/http.Client,
we cannot use the unix socket address directly
in the Host header, as it fails the validation step.
Instead, use a dummy address in the Host header.
This commit is contained in:
Johan Brandhorst-Satzkorn authored and GitHub committed 2023-08-15 12:04:58 -07:00
1 parent 067a42c715
commit e108ae40ad
3 files changed
+11 -10

No files matched your search

+10 -1
View File
@@ -650,8 +650,17 @@ func (c *Client) NewRequest(ctx context.Context, method, requestPath string, bod
// be pointing to the protocol used in the application layer and not to
// the transport layer. Hence, setting the fields accordingly.
u.Scheme = "http"
u.Host = socket
u.Path = ""
// Go 1.21.0 introduced strict host header validation for clients.
// Using unix domain socket addresses in the Host header fails
// this validation. https://go.dev/issue/61431 details this problem.
// The error-on-domain-socket-host-header will be removed in a
// future release, but in the meantime, we need to set it to something
// that isn't the actual unix domain socket address. Following
// Docker's lead (https://github.com/moby/moby/pull/45942),
// use a localhost TLD.
u.Host = "api.boundary.localhost"
}
host := u.Host