Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 13, 11:45 UTC
Tweak some comments
Matthew Holt committed
Sep 21, 2022 at 12:59 UTC
9206e8a7381d62a5f8362f541ab9c052f06a9d50
2 files changed
+3
-2
modules/caddyhttp/responsewriter.go
+2
-1
@@ -170,9 +170,10 @@ func (rr *responseRecorder) WriteHeader(statusCode int) {
170
return
171
}
172
173
- // save statusCode in case http middleware upgrading websocket
173
+ // save statusCode always, in case HTTP middleware upgrades websocket
174
// connections by manually setting headers and writing status 101
175
rr.statusCode = statusCode
176
+
177
// 1xx responses aren't final; just informational
178
if statusCode < 100 || statusCode > 199 {
179
rr.wroteHeader = true
modules/caddyhttp/server.go
+1
-1
@@ -239,7 +239,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
239
return
240
}
241
242
- repl.Set("http.response.status", wrec.Status())
242
+ repl.Set("http.response.status", wrec.Status()) // will be 0 if no response is written by us (Go will write 200 to client)
243
repl.Set("http.response.size", wrec.Size())
244
repl.Set("http.response.duration", duration)
245
repl.Set("http.response.duration_ms", duration.Seconds()*1e3) // multiply seconds to preserve decimal (see #4666)