mirror of
https://github.com/caddyserver/caddy.git
synced 2025-10-19 07:43:17 +00:00
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
This commit is contained in:
parent
1a345b4fa6
commit
4b1a9b6cc1
21 changed files with 946 additions and 364 deletions
|
@ -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
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue