summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/caddyhttp/responsewriter.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/caddyhttp/responsewriter.go b/modules/caddyhttp/responsewriter.go
index 4e2c8f0..d29f6a7 100644
--- a/modules/caddyhttp/responsewriter.go
+++ b/modules/caddyhttp/responsewriter.go
@@ -170,9 +170,11 @@ func (rr *responseRecorder) WriteHeader(statusCode int) {
return
}
+ // save statusCode in case http middleware upgrading 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.statusCode = statusCode
rr.wroteHeader = true
// decide whether we should buffer the response