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, 10:30 UTC
headers: Support repeated WriteHeader if 1xx (fix #5074)
Matthew Holt committed
Sep 23, 2022 at 17:11 UTC
7041970059db9047143d82b2c489c7bc34df691f
1 file changed
+4
-1
modules/caddyhttp/headers/headers.go
+4
-1
@@ -332,7 +332,10 @@ func (rww *responseWriterWrapper) WriteHeader(status int) {
332
if rww.wroteHeader {
333
return
334
}
335
- rww.wroteHeader = true
335
+ // 1xx responses aren't final; just informational
336
+ if status < 100 || status > 199 {
337
+ rww.wroteHeader = true
338
+ }
339
if rww.require == nil || rww.require.Match(status, rww.ResponseWriterWrapper.Header()) {
340
if rww.headerOps != nil {
341
rww.headerOps.ApplyTo(rww.ResponseWriterWrapper.Header(), rww.replacer)