summaryrefslogtreecommitdiff
path: root/modules/caddyhttp
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2022-09-13 13:43:21 -0600
committerMatthew Holt <mholt@users.noreply.github.com>2022-09-13 13:43:21 -0600
commit754fe4f7b4dddbfc7a8ee7fee405cee057da858e (patch)
tree56fd84493e7a076f649c3c5d5fc5474707e72aad /modules/caddyhttp
parent20d487be573424e7647b5a157754f6e284554e23 (diff)
httpcaddyfile: Fix sorting of repeated directives
Fixes #5037
Diffstat (limited to 'modules/caddyhttp')
-rw-r--r--modules/caddyhttp/routes.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/modules/caddyhttp/routes.go b/modules/caddyhttp/routes.go
index 45cbd80..ce9bece 100644
--- a/modules/caddyhttp/routes.go
+++ b/modules/caddyhttp/routes.go
@@ -109,6 +109,17 @@ func (r Route) Empty() bool {
r.Group == ""
}
+func (r Route) String() string {
+ handlersRaw := "["
+ for _, hr := range r.HandlersRaw {
+ handlersRaw += " " + string(hr)
+ }
+ handlersRaw += "]"
+
+ return fmt.Sprintf(`{Group:"%s" MatcherSetsRaw:%s HandlersRaw:%s Terminal:%t}`,
+ r.Group, r.MatcherSetsRaw, handlersRaw, r.Terminal)
+}
+
// RouteList is a list of server routes that can
// create a middleware chain.
type RouteList []Route
@@ -331,4 +342,15 @@ func (ms *MatcherSets) FromInterface(matcherSets any) error {
return nil
}
+// TODO: Is this used?
+func (ms MatcherSets) String() string {
+ result := "["
+ for _, matcherSet := range ms {
+ for _, matcher := range matcherSet {
+ result += fmt.Sprintf(" %#v", matcher)
+ }
+ }
+ return result + " ]"
+}
+
var routeGroupCtxKey = caddy.CtxKey("route_group")