@marcel91200 / caddy Mirror · read-only / commits / c7a6bc59
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 13, 11:45 UTC

caddyhttp: responseRecorder save status in all cases (#5049)

WeidiDeng committed Sep 18, 2022 at 08:47 UTC c7a6bc59345ca4075cc8bf97bd80900d28d8e05d
1 file changed +3 -1
modules/caddyhttp/responsewriter.go
+3 -1
@@ -170,9 +170,11 @@ func (rr *responseRecorder) WriteHeader(statusCode int) {
170 return
171 }
172
173 + // save statusCode in case http middleware upgrading websocket
174 + // connections by manually setting headers and writing status 101
175 + rr.statusCode = statusCode
176 // 1xx responses aren't final; just informational
177 if statusCode < 100 || statusCode > 199 {
175 - rr.statusCode = statusCode
178 rr.wroteHeader = true
179
180 // decide whether we should buffer the response