Buffer http response instead of writing directly (#106)
This commit is contained in:
parent
685d1d0d78
commit
8b5d75a979
1 changed files with 7 additions and 1 deletions
|
|
@ -590,7 +590,13 @@ func serveHijack(w http.ResponseWriter, targetConn net.Conn) error {
|
|||
}
|
||||
res.Header.Set("Server", "Caddy")
|
||||
|
||||
err = res.Write(clientConn)
|
||||
buf := bufio.NewWriter(clientConn)
|
||||
err = res.Write(buf)
|
||||
if err != nil {
|
||||
return caddyhttp.Error(http.StatusInternalServerError,
|
||||
fmt.Errorf("failed to write response: %v", err))
|
||||
}
|
||||
err = buf.Flush()
|
||||
if err != nil {
|
||||
return caddyhttp.Error(http.StatusInternalServerError,
|
||||
fmt.Errorf("failed to send response to client: %v", err))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue