@marcel91200 / caddy Mirror · read-only / commits / 2eda21ec
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 14, 05:15 UTC

http: Remove {...query_string} placeholder, in favor of {...query}

I am not sure if the query_string one is necessary or useful yet. We can always add it later if needed.

Matthew Holt committed Jan 10, 2020 at 17:02 UTC 2eda21ec6d44fa2f57e72ef0f02ea29c902d871d
4 files changed +2 -9
caddyconfig/httpcaddyfile/httptype.go
+1 -1
@@ -101,7 +101,7 @@ func (st ServerType) Setup(originalServerBlocks []caddyfile.ServerBlock,
101 "{scheme}", "{http.request.scheme}",
102 "{file}", "{http.request.uri.path.file}",
103 "{dir}", "{http.request.uri.path.dir}",
104 - "{query}", "{http.request.uri.query_string}",
104 + "{query}", "{http.request.uri.query}",
105 )
106 for _, segment := range sb.block.Segments {
107 for i := 0; i < len(segment); i++ {
modules/caddyhttp/caddyhttp.go
-2
@@ -66,7 +66,6 @@ func init() {
66 // `{http.request.orig.path.dir}` | The request's original directory
67 // `{http.request.orig.path.file}` | The request's original filename
68 // `{http.request.orig.uri.path}` | The request's original path
69 -// `{http.request.orig.uri.query_string}` | The request's original full query string (with `?`)
69 // `{http.request.orig.uri.query}` | The request's original query string (without `?`)
70 // `{http.request.orig.uri}` | The request's original URI
71 // `{http.request.port}` | The port part of the request's Host header
@@ -79,7 +78,6 @@ func init() {
78 // `{http.request.uri.path.dir}` | The directory, excluding leaf filename
79 // `{http.request.uri.path.file}` | The filename of the path, excluding directory
80 // `{http.request.uri.path}` | The path component of the request URI
82 -// `{http.request.uri.query_string}` | The full query string (with `?`)
81 // `{http.request.uri.query.*}` | Individual query string value
82 // `{http.request.uri.query}` | The query string (without `?`)
83 // `{http.request.uri}` | The full request URI
modules/caddyhttp/replacer.go
-5
@@ -104,8 +104,6 @@ func addHTTPVarsToReplacer(repl *caddy.Replacer, req *http.Request, w http.Respo
104 return dir, true
105 case "http.request.uri.query":
106 return req.URL.RawQuery, true
107 - case "http.request.uri.query_string":
108 - return "?" + req.URL.RawQuery, true
107
108 // original request, before any internal changes
109 case "http.request.orig_method":
@@ -128,9 +126,6 @@ func addHTTPVarsToReplacer(repl *caddy.Replacer, req *http.Request, w http.Respo
126 case "http.request.orig_uri.query":
127 or, _ := req.Context().Value(OriginalRequestCtxKey).(http.Request)
128 return or.URL.RawQuery, true
131 - case "http.request.orig_uri.query_string":
132 - or, _ := req.Context().Value(OriginalRequestCtxKey).(http.Request)
133 - return "?" + or.URL.RawQuery, true
129 }
130
131 // hostname labels
modules/caddyhttp/reverseproxy/fastcgi/caddyfile.go
+1 -1
@@ -149,7 +149,7 @@ func parsePHPFastCGI(h httpcaddyfile.Helper) ([]httpcaddyfile.ConfigValue, error
149 }),
150 }
151 rewriteHandler := rewrite.Rewrite{
152 - URI: "{http.matchers.file.relative}{http.request.uri.query_string}",
152 + URI: "{http.matchers.file.relative}?{http.request.uri.query}",
153 }
154 rewriteRoute := caddyhttp.Route{
155 MatcherSetsRaw: []caddy.ModuleMap{rewriteMatcherSet},