mirror of
https://github.com/caddyserver/caddy.git
synced 2025-01-27 23:03:37 -05:00
templates: Changed .RemoteAddr to .IP and stripped port
This commit is contained in:
parent
21c26f48d0
commit
a9064a7871
1 changed files with 7 additions and 3 deletions
|
@ -51,9 +51,13 @@ func (c context) Header(name string) string {
|
||||||
return c.req.Header.Get(name)
|
return c.req.Header.Get(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
// RemoteAddr gets the address of the client making the request.
|
// IP gets the (remote) IP address of the client making the request.
|
||||||
func (c context) RemoteAddr() string {
|
func (c context) IP() string {
|
||||||
return c.req.RemoteAddr
|
ip, _, err := net.SplitHostPort(c.req.RemoteAddr)
|
||||||
|
if err != nil {
|
||||||
|
return c.req.RemoteAddr
|
||||||
|
}
|
||||||
|
return ip
|
||||||
}
|
}
|
||||||
|
|
||||||
// URI returns the raw, unprocessed request URI (including query
|
// URI returns the raw, unprocessed request URI (including query
|
||||||
|
|
Loading…
Add table
Reference in a new issue