mirror of
https://github.com/caddyserver/caddy.git
synced 2025-11-13 09:47:50 +08:00
using Matcher methods
This commit is contained in:
@@ -132,15 +132,19 @@ func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhtt
|
|||||||
// the requested destination/output value
|
// the requested destination/output value
|
||||||
for _, m := range h.Mappings {
|
for _, m := range h.Mappings {
|
||||||
if m.re != nil {
|
if m.re != nil {
|
||||||
if m.re.MatchString(input) {
|
matchRegexp := caddyhttp.MatchRegexp{Pattern: m.InputRegexp}
|
||||||
if output := m.Outputs[destIdx]; output == nil {
|
matchRegexp.Provision(caddy.Context{})
|
||||||
continue
|
err := matchRegexp.Validate()
|
||||||
} else {
|
if err == nil {
|
||||||
output = m.re.ReplaceAllString(input, m.Outputs[destIdx].(string))
|
if matchRegexp.Match(input, repl) {
|
||||||
return output, true
|
if output := m.Outputs[destIdx]; output == nil {
|
||||||
|
continue
|
||||||
|
} else {
|
||||||
|
output = repl.ReplaceAll(m.Outputs[destIdx].(string), "")
|
||||||
|
return output, true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
continue
|
|
||||||
}
|
}
|
||||||
if input == m.Input {
|
if input == m.Input {
|
||||||
if output := m.Outputs[destIdx]; output == nil {
|
if output := m.Outputs[destIdx]; output == nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user