summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2022-09-21 12:59:40 -0600
committerMatthew Holt <mholt@users.noreply.github.com>2022-09-21 12:59:44 -0600
commit9206e8a7381d62a5f8362f541ab9c052f06a9d50 (patch)
treef6febb548a54d1dca17716a07af0e9413db6b075 /modules
parent1426c97da57fc84d8b584a960c43fbb58df68b80 (diff)
Tweak some comments
Diffstat (limited to 'modules')
-rw-r--r--modules/caddyhttp/responsewriter.go3
-rw-r--r--modules/caddyhttp/server.go2
2 files changed, 3 insertions, 2 deletions
diff --git a/modules/caddyhttp/responsewriter.go b/modules/caddyhttp/responsewriter.go
index d29f6a7..0631229 100644
--- a/modules/caddyhttp/responsewriter.go
+++ b/modules/caddyhttp/responsewriter.go
@@ -170,9 +170,10 @@ func (rr *responseRecorder) WriteHeader(statusCode int) {
return
}
- // save statusCode in case http middleware upgrading websocket
+ // save statusCode always, in case HTTP middleware upgrades websocket
// connections by manually setting headers and writing status 101
rr.statusCode = statusCode
+
// 1xx responses aren't final; just informational
if statusCode < 100 || statusCode > 199 {
rr.wroteHeader = true
diff --git a/modules/caddyhttp/server.go b/modules/caddyhttp/server.go
index d9fe077..5daa5b2 100644
--- a/modules/caddyhttp/server.go
+++ b/modules/caddyhttp/server.go
@@ -239,7 +239,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
return
}
- repl.Set("http.response.status", wrec.Status())
+ repl.Set("http.response.status", wrec.Status()) // will be 0 if no response is written by us (Go will write 200 to client)
repl.Set("http.response.size", wrec.Size())
repl.Set("http.response.duration", duration)
repl.Set("http.response.duration_ms", duration.Seconds()*1e3) // multiply seconds to preserve decimal (see #4666)