mirror of
https://github.com/caddyserver/caddy.git
synced 2025-10-19 07:43:17 +00:00
Don't append port to unix sockets
See https://caddy.community/t/caddy-v2-php-fpm-502-error/6571?u=matt
This commit is contained in:
parent
68adfdc559
commit
33a318d173
2 changed files with 63 additions and 1 deletions
|
@ -250,3 +250,52 @@ func TestParseNetworkAddress(t *testing.T) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestJoinHostPort(t *testing.T) {
|
||||
for i, tc := range []struct {
|
||||
pa ParsedAddress
|
||||
offset uint
|
||||
expect string
|
||||
}{
|
||||
{
|
||||
pa: ParsedAddress{
|
||||
Network: "tcp",
|
||||
Host: "localhost",
|
||||
StartPort: 1234,
|
||||
EndPort: 1234,
|
||||
},
|
||||
expect: "localhost:1234",
|
||||
},
|
||||
{
|
||||
pa: ParsedAddress{
|
||||
Network: "tcp",
|
||||
Host: "localhost",
|
||||
StartPort: 1234,
|
||||
EndPort: 1235,
|
||||
},
|
||||
expect: "localhost:1234",
|
||||
},
|
||||
{
|
||||
pa: ParsedAddress{
|
||||
Network: "tcp",
|
||||
Host: "localhost",
|
||||
StartPort: 1234,
|
||||
EndPort: 1235,
|
||||
},
|
||||
offset: 1,
|
||||
expect: "localhost:1235",
|
||||
},
|
||||
{
|
||||
pa: ParsedAddress{
|
||||
Network: "unix",
|
||||
Host: "/run/php/php7.3-fpm.sock",
|
||||
},
|
||||
expect: "/run/php/php7.3-fpm.sock",
|
||||
},
|
||||
} {
|
||||
actual := tc.pa.JoinHostPort(tc.offset)
|
||||
if actual != tc.expect {
|
||||
t.Errorf("Test %d: Expected '%s' but got '%s'", i, tc.expect, actual)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue