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: Only enable access logs if configured
Matthew Holt committed
Nov 15, 2019 at 17:01 UTC
af26a03da1af7cd7d64fc03270961829d0311ed7
2 files changed
+6
-1
modules/caddyhttp/caddyhttp.go
+5
-1
@@ -76,9 +76,13 @@ func (app *App) Provision(ctx caddy.Context) error {
76
77
for srvName, srv := range app.Servers {
78
srv.logger = app.logger.Named("log")
79
- srv.accessLogger = app.logger.Named("log.access")
79
srv.errorLogger = app.logger.Named("log.error")
80
81
+ // only enable access logs if configured
82
+ if srv.Logs != nil {
83
+ srv.accessLogger = app.logger.Named("log.access")
84
+ }
85
+
86
if srv.AutoHTTPS == nil {
87
// avoid nil pointer dereferences
88
srv.AutoHTTPS = new(AutoHTTPSConfig)
modules/caddyhttp/responsewriter.go
+1
@@ -229,6 +229,7 @@ func (rr *responseRecorder) WriteResponse() error {
229
_, err := io.Copy(rr.ResponseWriterWrapper, rr.buf)
230
return err
231
}
232
+
233
// ResponseRecorder is a http.ResponseWriter that records
234
// responses instead of writing them to the client. See
235
// docs for NewResponseRecorder for proper usage.