Skip to content

Commit c5b9c14

Browse files
committed
🐛 Guard the access to http.Flusher (fixes #19)
1 parent 27ea559 commit c5b9c14

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

cgi.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,13 @@ func (c *CGI) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.H
163163
inspect(cgiHandler, w, r, repl)
164164
} else {
165165
cgiWriter := w
166+
166167
if c.UnbufferedOutput {
167-
cgiWriter = instantWriter{w}
168+
if _, isFlusher := w.(http.Flusher); isFlusher {
169+
cgiWriter = instantWriter{w}
170+
} else {
171+
c.logger.Warn("Cannot write response without buffer.")
172+
}
168173
}
169174
cgiHandler.ServeHTTP(cgiWriter, r)
170175
}

0 commit comments

Comments
 (0)