mirror of
https://github.com/caddyserver/caddy.git
synced 2025-02-10 01:57:07 +01:00
Added escaped versions of uri, query and path.
This commit is contained in:
parent
c748ef944b
commit
168723a026
1 changed files with 10 additions and 6 deletions
|
@ -3,6 +3,7 @@ package middleware
|
||||||
import (
|
import (
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"path"
|
"path"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -40,7 +41,9 @@ func NewReplacer(r *http.Request, rr *responseRecorder, emptyValue string) Repla
|
||||||
}(),
|
}(),
|
||||||
"{host}": r.Host,
|
"{host}": r.Host,
|
||||||
"{path}": r.URL.Path,
|
"{path}": r.URL.Path,
|
||||||
|
"{path_escaped}": url.QueryEscape(r.URL.Path),
|
||||||
"{query}": r.URL.RawQuery,
|
"{query}": r.URL.RawQuery,
|
||||||
|
"{query_escaped}": url.QueryEscape(r.URL.RawQuery),
|
||||||
"{fragment}": r.URL.Fragment,
|
"{fragment}": r.URL.Fragment,
|
||||||
"{proto}": r.Proto,
|
"{proto}": r.Proto,
|
||||||
"{remote}": func() string {
|
"{remote}": func() string {
|
||||||
|
@ -61,6 +64,7 @@ func NewReplacer(r *http.Request, rr *responseRecorder, emptyValue string) Repla
|
||||||
return port
|
return port
|
||||||
}(),
|
}(),
|
||||||
"{uri}": r.URL.RequestURI(),
|
"{uri}": r.URL.RequestURI(),
|
||||||
|
"{uri_escaped}": url.QueryEscape(r.URL.RequestURI()),
|
||||||
"{when}": func() string {
|
"{when}": func() string {
|
||||||
return time.Now().Format(timeFormat)
|
return time.Now().Format(timeFormat)
|
||||||
}(),
|
}(),
|
||||||
|
|
Loading…
Reference in a new issue