Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
caddy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
caddy
Commits
f2491580
Commit
f2491580
authored
Feb 02, 2019
by
Matthew Holt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
httpserver: Fix address display and routing for IPv6 IPs/wildcards
parent
8369a121
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
3 deletions
+9
-3
caddyhttp/httpserver/plugin.go
caddyhttp/httpserver/plugin.go
+3
-2
caddyhttp/httpserver/vhosttrie.go
caddyhttp/httpserver/vhosttrie.go
+6
-1
No files found.
caddyhttp/httpserver/plugin.go
View file @
f2491580
...
@@ -428,11 +428,12 @@ func (a Address) String() string {
...
@@ -428,11 +428,12 @@ func (a Address) String() string {
if
s
!=
""
{
if
s
!=
""
{
s
+=
"://"
s
+=
"://"
}
}
s
+=
a
.
Host
if
a
.
Port
!=
""
&&
if
a
.
Port
!=
""
&&
((
scheme
==
"https"
&&
a
.
Port
!=
DefaultHTTPSPort
)
||
((
scheme
==
"https"
&&
a
.
Port
!=
DefaultHTTPSPort
)
||
(
scheme
==
"http"
&&
a
.
Port
!=
DefaultHTTPPort
))
{
(
scheme
==
"http"
&&
a
.
Port
!=
DefaultHTTPPort
))
{
s
+=
":"
+
a
.
Port
s
+=
net
.
JoinHostPort
(
a
.
Host
,
a
.
Port
)
}
else
{
s
+=
a
.
Host
}
}
if
a
.
Path
!=
""
{
if
a
.
Path
!=
""
{
s
+=
a
.
Path
s
+=
a
.
Path
...
...
caddyhttp/httpserver/vhosttrie.go
View file @
f2491580
...
@@ -32,7 +32,12 @@ type vhostTrie struct {
...
@@ -32,7 +32,12 @@ type vhostTrie struct {
// newVHostTrie returns a new vhostTrie.
// newVHostTrie returns a new vhostTrie.
func
newVHostTrie
()
*
vhostTrie
{
func
newVHostTrie
()
*
vhostTrie
{
return
&
vhostTrie
{
edges
:
make
(
map
[
string
]
*
vhostTrie
),
fallbackHosts
:
[]
string
{
"0.0.0.0"
,
""
}}
// TODO: fallbackHosts doesn't discriminate between network interfaces;
// i.e. if there is a host "0.0.0.0", it could match a request coming
// in to "[::1]" (and vice-versa) even though the IP versions differ.
// This might be OK, or maybe it's not desirable. The 'bind' directive
// can be used to restrict what interface a listener binds to.
return
&
vhostTrie
{
edges
:
make
(
map
[
string
]
*
vhostTrie
),
fallbackHosts
:
[]
string
{
"0.0.0.0"
,
"[::]"
,
""
}}
}
}
// Insert adds stack to t keyed by key. The key should be
// Insert adds stack to t keyed by key. The key should be
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment