Skip to content

Commit

Permalink
headers: Support repeated WriteHeader if 1xx (fix #5074)
Browse files Browse the repository at this point in the history
  • Loading branch information
mholt committed Sep 23, 2022
1 parent eead00f commit 7041970
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion modules/caddyhttp/headers/headers.go
Expand Up @@ -332,7 +332,10 @@ func (rww *responseWriterWrapper) WriteHeader(status int) {
if rww.wroteHeader {
return
}
rww.wroteHeader = true
// 1xx responses aren't final; just informational
if status < 100 || status > 199 {
rww.wroteHeader = true
}
if rww.require == nil || rww.require.Match(status, rww.ResponseWriterWrapper.Header()) {
if rww.headerOps != nil {
rww.headerOps.ApplyTo(rww.ResponseWriterWrapper.Header(), rww.replacer)
Expand Down

0 comments on commit 7041970

Please sign in to comment.