Skip to content

Commit 301714d

Browse files
committed
net/http: document CONNECT more
Fixes #22554 Change-Id: I624f2883489a46d7162c11f489c2f0a0ec5a836f Reviewed-on: https://go-review.googlesource.com/86277 Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent 3639929 commit 301714d

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/net/http/request.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ var reqWriteExcludeHeader = map[string]bool{
9898
type Request struct {
9999
// Method specifies the HTTP method (GET, POST, PUT, etc.).
100100
// For client requests an empty string means GET.
101+
//
102+
// Go's HTTP client does not support sending a request with
103+
// the CONNECT method. See the documentation on Transport for
104+
// details.
101105
Method string
102106

103107
// URL specifies either the URI being requested (for server

src/net/http/transport.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,15 @@ const DefaultMaxIdleConnsPerHost = 2
7373
// and how the Transport is configured. The DefaultTransport supports HTTP/2.
7474
// To explicitly enable HTTP/2 on a transport, use golang.org/x/net/http2
7575
// and call ConfigureTransport. See the package docs for more about HTTP/2.
76+
//
77+
// The Transport will send CONNECT requests to a proxy for its own use
78+
// when processing HTTPS requests, but Transport should generally not
79+
// be used to send a CONNECT request. That is, the Request passed to
80+
// the RoundTrip method should not have a Method of "CONNECT", as Go's
81+
// HTTP/1.x implementation does not support full-duplex request bodies
82+
// being written while the response body is streamed. Go's HTTP/2
83+
// implementation does support full duplex, but many CONNECT proxies speak
84+
// HTTP/1.x.
7685
type Transport struct {
7786
idleMu sync.Mutex
7887
wantIdle bool // user has requested to close all idle conns

0 commit comments

Comments
 (0)