summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/templates/tplcontext.go
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2019-06-21 08:08:26 -0600
committerMatthew Holt <mholt@users.noreply.github.com>2019-06-21 08:08:26 -0600
commit70c788ce0c7f81f87d19850164031ce2e8158e72 (patch)
tree5f37c9ab2e524b04ca03065e07663babf2b898af /modules/caddyhttp/templates/tplcontext.go
parent1c443beb9c87b42d1d018f72e36ac9b15fdfccdc (diff)
Minor cleanups/improvements
Diffstat (limited to 'modules/caddyhttp/templates/tplcontext.go')
-rw-r--r--modules/caddyhttp/templates/tplcontext.go10
1 files changed, 3 insertions, 7 deletions
diff --git a/modules/caddyhttp/templates/tplcontext.go b/modules/caddyhttp/templates/tplcontext.go
index 83fe19e..d89f106 100644
--- a/modules/caddyhttp/templates/tplcontext.go
+++ b/modules/caddyhttp/templates/tplcontext.go
@@ -117,12 +117,8 @@ func (c templateContext) Cookie(name string) string {
return ""
}
-// ReqHeader gets the value of a request header with field name.
-func (c templateContext) ReqHeader(name string) string {
- return c.Req.Header.Get(name)
-}
-
// Hostname gets the (remote) hostname of the client making the request.
+// Performance warning: This involves a DNS lookup.
func (c templateContext) Hostname() string {
ip := c.IP()
@@ -134,8 +130,8 @@ func (c templateContext) Hostname() string {
return hostnameList[0]
}
-// IP gets the (remote) IP address of the client making the request.
-func (c templateContext) IP() string {
+// RemoteIP gets the IP address of the client making the request.
+func (c templateContext) RemoteIP() string {
ip, _, err := net.SplitHostPort(c.Req.RemoteAddr)
if err != nil {
return c.Req.RemoteAddr