Skip to content

Commit

Permalink
martian: use isClosedConnError instead of isCloseable outside of hand…
Browse files Browse the repository at this point in the history
…leLoop
  • Loading branch information
mmatczuk committed Oct 17, 2023
1 parent 4474a8d commit 2dece1d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion internal/martian/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ func (p *Proxy) readRequest(ctx *Context, conn net.Conn, brw *bufio.ReadWriter)

req, err = http.ReadRequest(brw.Reader)
if err != nil {
if isCloseable(err) {
if isClosedConnError(err) {
log.Debugf(context.TODO(), "connection closed prematurely: %v", err)
} else {
log.Errorf(context.TODO(), "failed to read request: %v", err)
Expand Down
2 changes: 1 addition & 1 deletion internal/martian/proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1825,7 +1825,7 @@ func TestReadHeaderTimeout(t *testing.T) {
if _, err = conn.Write([]byte("Host: example.com\r\n\r\n")); err != nil {
t.Fatalf("conn.Write(): got %v, want no error", err)
}
if _, err = conn.Read(make([]byte, 1)); !errors.Is(err, io.EOF) {
if _, err = conn.Read(make([]byte, 1)); !isClosedConnError(err) {
t.Fatalf("conn.Read(): got %v, want io.EOF", err)
}
}
Expand Down

0 comments on commit 2dece1d

Please sign in to comment.