diff options
author | Aaron Paterson <[email protected]> | 2024-09-30 12:55:03 -0400 |
---|---|---|
committer | GitHub <[email protected]> | 2024-09-30 10:55:03 -0600 |
commit | 4b1a9b6cc1aa521e21289afa276d29952a97d8f3 (patch) | |
tree | c4e28391860ed003aebaca340deb764b6f532e94 /cmd | |
parent | 1a345b4fa620dfb0909a3b086bd76e35dfdbefa5 (diff) | |
download | caddy-4b1a9b6cc1aa521e21289afa276d29952a97d8f3.tar.gz caddy-4b1a9b6cc1aa521e21289afa276d29952a97d8f3.zip |
core: Implement socket activation listeners (#6573)
* caddy adapt for listen_protocols
* adapt listen_socket
* allow multiple listen sockets for port ranges and readd socket fd listen logic
* readd logic to start servers according to listener protocols
* gofmt
* adapt caddytest
* gosec
* fmt and rename listen to listenWithSocket
* fmt and rename listen to listenWithSocket
* more consistent error msg
* non unix listenReusableWithSocketFile
* remove unused func
* doc comment typo
* nonosec
* commit
* doc comments
* more doc comments
* comment was misleading, cardinality did not change
* addressesWithProtocols
* update test
* fd/ and fdgram/
* rm addr
* actually write...
* i guess we doin' "skip": now
* wrong var in placeholder
* wrong var in placeholder II
* update param name in comment
* dont save nil file pointers
* windows
* key -> parsedKey
* osx
* multiple default_bind with protocols
* check for h1 and h2 listener netw
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/commandfuncs.go | 12 | ||||
-rw-r--r-- | cmd/main_test.go | 6 |
2 files changed, 10 insertions, 8 deletions
diff --git a/cmd/commandfuncs.go b/cmd/commandfuncs.go index 49d0321ef..50e9b110d 100644 --- a/cmd/commandfuncs.go +++ b/cmd/commandfuncs.go @@ -660,6 +660,8 @@ func AdminAPIRequest(adminAddr, method, uri string, headers http.Header, body io return nil, err } parsedAddr.Host = addr + } else if parsedAddr.IsFdNetwork() { + origin = "http://127.0.0.1" } // form the request @@ -667,13 +669,13 @@ func AdminAPIRequest(adminAddr, method, uri string, headers http.Header, body io if err != nil { return nil, fmt.Errorf("making request: %v", err) } - if parsedAddr.IsUnixNetwork() { + if parsedAddr.IsUnixNetwork() || parsedAddr.IsFdNetwork() { // We used to conform to RFC 2616 Section 14.26 which requires // an empty host header when there is no host, as is the case - // with unix sockets. However, Go required a Host value so we - // used a hack of a space character as the host (it would see - // the Host was non-empty, then trim the space later). As of - // Go 1.20.6 (July 2023), this hack no longer works. See: + // with unix sockets and socket fds. However, Go required a + // Host value so we used a hack of a space character as the host + // (it would see the Host was non-empty, then trim the space later). + // As of Go 1.20.6 (July 2023), this hack no longer works. See: // https://github.com/golang/go/issues/60374 // See also the discussion here: // https://github.com/golang/go/issues/61431 diff --git a/cmd/main_test.go b/cmd/main_test.go index 757a58ce6..3b2412c57 100644 --- a/cmd/main_test.go +++ b/cmd/main_test.go @@ -235,7 +235,7 @@ func Test_isCaddyfile(t *testing.T) { wantErr: false, }, { - + name: "json is not caddyfile but not error", args: args{ configFile: "./Caddyfile.json", @@ -245,7 +245,7 @@ func Test_isCaddyfile(t *testing.T) { wantErr: false, }, { - + name: "prefix of Caddyfile and ./ with any extension is Caddyfile", args: args{ configFile: "./Caddyfile.prd", @@ -255,7 +255,7 @@ func Test_isCaddyfile(t *testing.T) { wantErr: false, }, { - + name: "prefix of Caddyfile without ./ with any extension is Caddyfile", args: args{ configFile: "Caddyfile.prd", |