@marcel91200 / caddy Mirror · read-only / commits / 0bf2565c
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

caddyhttp: Reorder some access log fields; add host matcher test case

This field order reads a little more naturally.

Matthew Holt committed Jul 7, 2020 at 08:11 UTC 0bf2565c37c0b2e4857be70c5302d6ad5c34b80d
2 files changed +8 -3
modules/caddyhttp/marshalers.go
+3 -3
@@ -26,11 +26,11 @@ type LoggableHTTPRequest struct{ *http.Request }
26
27 // MarshalLogObject satisfies the zapcore.ObjectMarshaler interface.
28 func (r LoggableHTTPRequest) MarshalLogObject(enc zapcore.ObjectEncoder) error {
29 - enc.AddString("method", r.Method)
30 - enc.AddString("uri", r.RequestURI)
31 - enc.AddString("proto", r.Proto)
29 enc.AddString("remote_addr", r.RemoteAddr)
30 + enc.AddString("proto", r.Proto)
31 + enc.AddString("method", r.Method)
32 enc.AddString("host", r.Host)
33 + enc.AddString("uri", r.RequestURI)
34 enc.AddObject("headers", LoggableHTTPHeader(r.Header))
35 if r.TLS != nil {
36 enc.AddObject("tls", LoggableTLSConnState(*r.TLS))
modules/caddyhttp/matchers_test.go
+5
@@ -122,6 +122,11 @@ func TestHostMatcher(t *testing.T) {
122 input: "sub.foo.example.net",
123 expect: false,
124 },
125 + {
126 + match: MatchHost{"www.*.*"},
127 + input: "www.example.com",
128 + expect: true,
129 + },
130 {
131 match: MatchHost{"example.com"},
132 input: "example.com:5555",