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
Little cleanups
Matthew Holt committed
Jul 5, 2019 at 13:59 UTC
84f9f7cd606146f1a1d6717d369fc98509365de6
4 files changed
+17
-1
README.md
+2
@@ -238,6 +238,8 @@ Ultimately, we think all these properties are appropriate -- if not ideal -- for
238
239
If you're still not happy with the choice of JSON, feel free to contribute a config adapter of your own choice!
240
241
+Or just use YAML or TOML, which seamlessly translate to JSON.
242
+
243
### JSON is declarative; what if I need more programmability (i.e. imperative syntax)?
244
245
We have good news.
go.mod
+1
-1
@@ -7,7 +7,7 @@ require (
7
github.com/Masterminds/goutils v1.1.0 // indirect
8
github.com/Masterminds/semver v1.4.2 // indirect
9
github.com/Masterminds/sprig v2.20.0+incompatible
10
- github.com/andybalholm/brotli v0.0.0-20190430215306-5c318f9037cb
10
+ github.com/andybalholm/brotli v0.0.0-20190704151324-71eb68cc467c
11
github.com/dustin/go-humanize v1.0.0
12
github.com/go-acme/lego v2.6.0+incompatible
13
github.com/google/go-cmp v0.3.0 // indirect
go.sum
+2
@@ -8,6 +8,8 @@ github.com/Masterminds/sprig v2.20.0+incompatible h1:dJTKKuUkYW3RMFdQFXPU/s6hg10
8
github.com/Masterminds/sprig v2.20.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o=
9
github.com/andybalholm/brotli v0.0.0-20190430215306-5c318f9037cb h1:Qs8/an94NFS1x2nn7rSI+skKFuw/EGfEYAGS3w/p+jc=
10
github.com/andybalholm/brotli v0.0.0-20190430215306-5c318f9037cb/go.mod h1:+lx6/Aqd1kLJ1GQfkvOnaZ1WGmLpMpbprPuIOOZX30U=
11
+github.com/andybalholm/brotli v0.0.0-20190704151324-71eb68cc467c h1:pBKtfXLqKZ+GPHGjlBheGaXK2lddydUG3XhWGrYjxOA=
12
+github.com/andybalholm/brotli v0.0.0-20190704151324-71eb68cc467c/go.mod h1:+lx6/Aqd1kLJ1GQfkvOnaZ1WGmLpMpbprPuIOOZX30U=
13
github.com/cenkalti/backoff v2.1.1+incompatible h1:tKJnvO2kl0zmb/jA5UKAt4VoEVw1qxKWjE/Bpp46npY=
14
github.com/cenkalti/backoff v2.1.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
15
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
modules/caddyhttp/routes.go
+12
@@ -39,6 +39,18 @@ type ServerRoute struct {
39
responder Handler
40
}
41
42
+// Empty returns true if the route has all zero/default values.
43
+func (sr ServerRoute) Empty() bool {
44
+ return len(sr.MatcherSets) == 0 &&
45
+ len(sr.Apply) == 0 &&
46
+ len(sr.Respond) == 0 &&
47
+ len(sr.matcherSets) == 0 &&
48
+ len(sr.middleware) == 0 &&
49
+ sr.responder == nil &&
50
+ !sr.Terminal &&
51
+ sr.Group == ""
52
+}
53
+
54
func (sr ServerRoute) anyMatcherSetMatches(r *http.Request) bool {
55
for _, ms := range sr.matcherSets {
56
if ms.Match(r) {