Skip to content

Commit

Permalink
remove connect check since it's done in Write method
Browse files Browse the repository at this point in the history
  • Loading branch information
WeidiDeng committed Dec 20, 2024
1 parent bb4f0ae commit c856aa1
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions modules/caddyhttp/encode/encode.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,12 +360,6 @@ const sniffLen = 512
// It's based on stdlin http1.1 response writer implementation.
// https://github.com/golang/go/blob/f4e3ec3dbe3b8e04a058d266adf8e048bab563f2/src/net/http/server.go#L586
func (rw *responseWriter) ReadFrom(r io.Reader) (int64, error) {
// WriteHeader wasn't called and is a CONNECT request, treat it as a success.
// otherwise, determine if the response should be compressed.
if rw.isConnect && !rw.wroteHeader && rw.statusCode == 0 {
rw.WriteHeader(http.StatusOK)
}

rf, ok := rw.ResponseWriter.(io.ReaderFrom)
// sendfile can't be used anyway
if !ok {
Expand Down

0 comments on commit c856aa1

Please sign in to comment.