From 0e8d46d075c2ddf69716422ce169c103a7b0f1f4 Mon Sep 17 00:00:00 2001
From: Anmol Sethi <hi@nhooyr.io>
Date: Wed, 24 Apr 2019 20:11:36 -0400
Subject: [PATCH] Warn users against setting Timeout on http.Client

Closes #67
---
 dial.go | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/dial.go b/dial.go
index ff57065..eee40dd 100644
--- a/dial.go
+++ b/dial.go
@@ -47,6 +47,9 @@ func dial(ctx context.Context, u string, opts DialOptions) (_ *Conn, _ *http.Res
 	if opts.HTTPClient == nil {
 		opts.HTTPClient = http.DefaultClient
 	}
+	if opts.HTTPClient.Timeout > 0 {
+		return nil, nil, xerrors.Errorf("please use context for cancellation instead of http.Client.Timeout; see issue nhooyr.io/websocket#67")
+	}
 	if opts.HTTPHeader == nil {
 		opts.HTTPHeader = http.Header{}
 	}
-- 
GitLab