Skip to content

Commit e5b9f9a

Browse files
committed
Address comments
1 parent f03d8f8 commit e5b9f9a

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

pkg/git/proxy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ func (d *httpConnectDialer) DialContext(ctx context.Context, network, addr strin
213213
return nil, fmt.Errorf("http connect proxy: write CONNECT request: %w", err)
214214
}
215215

216-
resp, err := http.ReadResponse(bufio.NewReader(conn), req)
216+
resp, err := http.ReadResponse(bufio.NewReaderSize(conn, 1), req)
217217
if err != nil {
218218
conn.Close()
219219
if ctxErr := ctx.Err(); ctxErr != nil {

pkg/git/proxy_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ func handleProxyConn(t *testing.T, clientConn net.Conn, onConnect func(http.Resp
131131
done <- struct{}{}
132132
}()
133133
<-done
134+
<-done
134135
}
135136

136137
// simpleResponseWriter is a minimal http.ResponseWriter that writes directly to
@@ -475,9 +476,9 @@ func TestHTTPConnectDialer_DefaultPort_HTTPS(t *testing.T) {
475476
// This test exercises cancellation during the forward-dial phase (before the
476477
// TCP connection to the proxy is established).
477478
func TestHTTPConnectDialer_ContextCancelled(t *testing.T) {
478-
// Use a forward dialer that blocks until the context is done.
479+
// Use a forward dialer that blocks until the test context is done.
479480
blocking := &recordingDialer{dial: func(network, addr string) (net.Conn, error) {
480-
time.Sleep(5 * time.Second)
481+
<-t.Context().Done()
481482
return nil, fmt.Errorf("should not reach here")
482483
}}
483484

@@ -700,7 +701,7 @@ func TestHTTPConnectDialer_TLSForHTTPSProxy(t *testing.T) {
700701
t.Fatalf("Write: %v", err)
701702
}
702703
buf := make([]byte, len(msg))
703-
if _, err := io.ReadFull(conn, buf); err != nil && !errors.Is(err, io.ErrUnexpectedEOF) {
704+
if _, err := io.ReadFull(conn, buf); err != nil {
704705
t.Fatalf("Read: %v", err)
705706
}
706707
if got := string(buf); got != msg {

0 commit comments

Comments
 (0)