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:
1 parent
067a42c715
commit
e108ae40ad
3 files changed
+11
-10
No files matched your search
+1
-1
@@ -1 +1 @@
|
||||
1.20.5
|
||||
1.21.0
|
||||
+10
-1
@@ -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
|
||||
|
||||
@@ -9,7 +9,6 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"strings"
|
||||
"sync"
|
||||
@@ -829,7 +828,6 @@ func Test_StandardLogger(t *testing.T) {
|
||||
wantErr bool
|
||||
wantErrIs error
|
||||
wantErrContains string
|
||||
wantLogger *log.Logger
|
||||
}{
|
||||
{
|
||||
name: "missing-eventer",
|
||||
@@ -869,11 +867,6 @@ func Test_StandardLogger(t *testing.T) {
|
||||
ctx: testCtx,
|
||||
eventer: SysEventer(),
|
||||
eventType: ErrorType,
|
||||
wantLogger: func() *log.Logger {
|
||||
w, err := SysEventer().StandardWriter(testCtx, ErrorType)
|
||||
require.NoError(t, err)
|
||||
return log.New(w, "okay", 0)
|
||||
}(),
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
@@ -895,7 +888,6 @@ func Test_StandardLogger(t *testing.T) {
|
||||
}
|
||||
require.NoError(err)
|
||||
assert.NotNil(l)
|
||||
assert.Equal(tt.wantLogger, l)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user