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
df018ea6
Commit
df018ea6
authored
Jul 18, 2016
by
Matthew Holt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Properly handle path-only addresses (also fix godoc typos)
parent
4ff46ad4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
4 deletions
+5
-4
caddy.go
caddy.go
+2
-2
caddyhttp/httpserver/plugin.go
caddyhttp/httpserver/plugin.go
+2
-2
caddyhttp/httpserver/plugin_test.go
caddyhttp/httpserver/plugin_test.go
+1
-0
No files found.
caddy.go
View file @
df018ea6
...
...
@@ -236,7 +236,7 @@ func listenerAddrEqual(ln net.Listener, addr string) bool {
}
// TCPServer is a type that can listen and serve connections.
// A TCPServer must associate with exactly or one net.Listeners.
// A TCPServer must associate with exactly
zero
or one net.Listeners.
type
TCPServer
interface
{
// Listen starts listening by creating a new listener
// and returning it. It does not start accepting
...
...
@@ -254,7 +254,7 @@ type TCPServer interface {
}
// UDPServer is a type that can listen and serve packets.
// A UDPServer must associate with exactly or one net.PacketConns.
// A UDPServer must associate with exactly
zero
or one net.PacketConns.
type
UDPServer
interface
{
// ListenPacket starts listening by creating a new packetconn
// and returning it. It does not start accepting connections.
...
...
caddyhttp/httpserver/plugin.go
View file @
df018ea6
...
...
@@ -273,12 +273,12 @@ func (a Address) VHost() string {
}
// standardizeAddress parses an address string into a structured format with separate
// scheme, host,
and port
portions, as well as the original input string.
// scheme, host,
port, and path
portions, as well as the original input string.
func
standardizeAddress
(
str
string
)
(
Address
,
error
)
{
input
:=
str
// Split input into components (prepend with // to assert host by default)
if
!
strings
.
Contains
(
str
,
"//"
)
{
if
!
strings
.
Contains
(
str
,
"//"
)
&&
!
strings
.
HasPrefix
(
str
,
"/"
)
{
str
=
"//"
+
str
}
u
,
err
:=
url
.
Parse
(
str
)
...
...
caddyhttp/httpserver/plugin_test.go
View file @
df018ea6
...
...
@@ -50,6 +50,7 @@ func TestStandardizeAddress(t *testing.T) {
{
`https://host:443/path/foo`
,
"https"
,
"host"
,
"443"
,
"/path/foo"
,
false
},
{
`host:80/path`
,
""
,
"host"
,
"80"
,
"/path"
,
false
},
{
`host:https/path`
,
"https"
,
"host"
,
"443"
,
"/path"
,
false
},
{
`/path`
,
""
,
""
,
""
,
"/path"
,
false
},
}
{
actual
,
err
:=
standardizeAddress
(
test
.
input
)
...
...
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