<feed xmlns='http://www.w3.org/2005/Atom'>
<title>go/src/net/http/httputil/reverseproxy_test.go, branch makepkg</title>
<subtitle>Fork of Go programming language with my patches.</subtitle>
<id>http://git.kilabit.info/go/atom?h=makepkg</id>
<link rel='self' href='http://git.kilabit.info/go/atom?h=makepkg'/>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/'/>
<updated>2025-11-20T23:15:20Z</updated>
<entry>
<title>net/http/httputil: wrap ReverseProxy's outbound request body so Close is a noop</title>
<updated>2025-11-20T23:15:20Z</updated>
<author>
<name>Nicholas S. Husin</name>
<email>nsh@golang.org</email>
</author>
<published>2025-11-19T22:10:02Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=3ad2e113fc3dd202bfb2ef87d376b6ef54337f0b'/>
<id>urn:sha1:3ad2e113fc3dd202bfb2ef87d376b6ef54337f0b</id>
<content type='text'>
Within ReverseProxy, we are currently sending a clone of our inbound
request (from client) as our outbound request (to upstream). However,
the clone of the request has a shallow copy of the request body. As a
result, when the outbound request body is closed, the inbound request
body (i.e. the outbound request body of the client) will also be closed.

This causes an unfortunate effect where we would infinitely hang when a
client sends a request with a 100-continue header via a ReverseProxy,
but the ReverseProxy fails to make a connection to the upstream server.

When this happens, the ReverseProxy's outbound request body would be
closed, which in turns also closes the client's request body.
Internally, when we close a request body, we would try to consume and
discard the content. Since the client has yet to actually send the body
content (due to 100-continue header) though, an infinite hang occurs.

To prevent this, we make sure that closing an outbound request body from
a ReverseProxy is a noop.

For #75933

Change-Id: I52dc7247f689f35a6e93d1f32b2d003d90e9d2c6
Reviewed-on: https://go-review.googlesource.com/c/go/+/722160
Reviewed-by: Nicholas Husin &lt;husin@google.com&gt;
Reviewed-by: Damien Neil &lt;dneil@google.com&gt;
LUCI-TryBot-Result: Go LUCI &lt;golang-scoped@luci-project-accounts.iam.gserviceaccount.com&gt;
</content>
</entry>
<entry>
<title>net/http/httputil: don't call WriteHeader after Hijack</title>
<updated>2025-03-19T16:57:03Z</updated>
<author>
<name>Damien Neil</name>
<email>dneil@google.com</email>
</author>
<published>2025-03-19T16:26:31Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=1aa9c31ffc8af3fd33bfa995ecf55f08daf33f81'/>
<id>urn:sha1:1aa9c31ffc8af3fd33bfa995ecf55f08daf33f81</id>
<content type='text'>
CL 637939 changed ReverseProxy to report errors encountered when
copying data on an hijacked connection. This is generally not useful,
and when using the default error handler results in WriteHeader
being called on a hijacked connection.

While this is harmless with standard net/http ResponseWriter
implementations, it can confuse middleware layers.

Fixes #72954

Change-Id: I21f3d3d515e114dc5c298d7dbc3796c505d3c82f
Reviewed-on: https://go-review.googlesource.com/c/go/+/659255
Reviewed-by: Jonathan Amsterdam &lt;jba@google.com&gt;
Auto-Submit: Damien Neil &lt;dneil@google.com&gt;
LUCI-TryBot-Result: Go LUCI &lt;golang-scoped@luci-project-accounts.iam.gserviceaccount.com&gt;
</content>
</entry>
<entry>
<title>net/http/httputil: close hijacked connections when CloseWrite not available</title>
<updated>2025-03-10T15:11:43Z</updated>
<author>
<name>Damien Neil</name>
<email>dneil@google.com</email>
</author>
<published>2025-03-06T21:24:58Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=22d5d09f1e39bf0ef77bfcf80388c676e7e91574'/>
<id>urn:sha1:22d5d09f1e39bf0ef77bfcf80388c676e7e91574</id>
<content type='text'>
CL 637939 changed ReverseProxy's handling of hijacked connections:
After copying all data in one direction, it half-closes the outbound
connection rather than fully closing both.

Revert to the old behavior when the outbound connection does not support
CloseWrite, avoiding a case where one side of the proxied connection closes
but the other remains open.

Fixes #72140

Change-Id: Ic0cacaa6323290f89ba48fd6cae737e86045a435
Reviewed-on: https://go-review.googlesource.com/c/go/+/655595
Reviewed-by: Jonathan Amsterdam &lt;jba@google.com&gt;
LUCI-TryBot-Result: Go LUCI &lt;golang-scoped@luci-project-accounts.iam.gserviceaccount.com&gt;
Auto-Submit: Damien Neil &lt;dneil@google.com&gt;
</content>
</entry>
<entry>
<title>net/http/httputil: skip new test on Plan 9</title>
<updated>2025-03-04T18:31:25Z</updated>
<author>
<name>Ian Lance Taylor</name>
<email>iant@golang.org</email>
</author>
<published>2025-03-04T18:07:15Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=f95941de4908a45287d700697347aa69d714457b'/>
<id>urn:sha1:f95941de4908a45287d700697347aa69d714457b</id>
<content type='text'>
TestReverseProxyWebSocketHalfTCP requires half closed connections,
which aren't supported on Plan 9.

For #35892
Fixes #72095

Change-Id: I64b458bc15ac3b8eda43dc871bf67ada32a59708
Reviewed-on: https://go-review.googlesource.com/c/go/+/654636
Reviewed-by: Ian Lance Taylor &lt;iant@google.com&gt;
Auto-Submit: Ian Lance Taylor &lt;iant@golang.org&gt;
LUCI-TryBot-Result: Go LUCI &lt;golang-scoped@luci-project-accounts.iam.gserviceaccount.com&gt;
Reviewed-by: Damien Neil &lt;dneil@google.com&gt;
Reviewed-by: David du Colombier &lt;0intro@gmail.com&gt;
Auto-Submit: Ian Lance Taylor &lt;iant@google.com&gt;
</content>
</entry>
<entry>
<title>net/http: support TCP half-close when HTTP is upgraded in ReverseProxy</title>
<updated>2025-03-04T12:59:32Z</updated>
<author>
<name>Mark Wakefield</name>
<email>mark.a.wakefield@gmail.com</email>
</author>
<published>2025-01-02T19:18:01Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=a053e79024f56a2a64728b1287509e880fad203e'/>
<id>urn:sha1:a053e79024f56a2a64728b1287509e880fad203e</id>
<content type='text'>
This CL propagates closing the write stream from either side of the
reverse proxy and ensures the proxy waits for both copy-to and the
copy-from the backend to complete.

The new unit test checks communication through the reverse proxy when
the backend or frontend closes either the read or write streams.
That closing the write stream is propagated through the proxy from
either the backend or the frontend. That closing the read stream is
not propagated through the proxy.

Fixes #35892

Change-Id: I83ce377df66a0f17b9ba2b53caf9e4991a95f6a0
Reviewed-on: https://go-review.googlesource.com/c/go/+/637939
Reviewed-by: Michael Pratt &lt;mpratt@google.com&gt;
Reviewed-by: Sean Liao &lt;sean@liao.dev&gt;
Auto-Submit: Sean Liao &lt;sean@liao.dev&gt;
LUCI-TryBot-Result: Go LUCI &lt;golang-scoped@luci-project-accounts.iam.gserviceaccount.com&gt;
Reviewed-by: Damien Neil &lt;dneil@google.com&gt;
Reviewed-by: Matej Kramny &lt;matejkramny@gmail.com&gt;
</content>
</entry>
<entry>
<title>net: use strings.SplitSeq and bytes.SplitSeq</title>
<updated>2025-02-05T01:20:47Z</updated>
<author>
<name>apocelipes</name>
<email>seve3r@outlook.com</email>
</author>
<published>2025-02-05T00:37:18Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=a1ea78c470d3136b7aed42a4d8b94497563f98ea'/>
<id>urn:sha1:a1ea78c470d3136b7aed42a4d8b94497563f98ea</id>
<content type='text'>
Replace `for _, s := range {strings, bytes}.Split(v, sep)` with
`for s := range {strings, bytes}.SplitSeq(v, sep)`, to simplify
the code and reduce some memory allocations.

Change-Id: Idead4de1e3928fc75cc5ba8caeff85542f1243d5
GitHub-Last-Rev: 5fb196a073e7583b23b1ebb446d6c067580ed63a
GitHub-Pull-Request: golang/go#71554
Reviewed-on: https://go-review.googlesource.com/c/go/+/646216
Reviewed-by: Damien Neil &lt;dneil@google.com&gt;
Reviewed-by: Ian Lance Taylor &lt;iant@google.com&gt;
Auto-Submit: Ian Lance Taylor &lt;iant@golang.org&gt;
LUCI-TryBot-Result: Go LUCI &lt;golang-scoped@luci-project-accounts.iam.gserviceaccount.com&gt;
</content>
</entry>
<entry>
<title>net/http/httputil: close res body in test</title>
<updated>2024-08-14T18:15:48Z</updated>
<author>
<name>guoguangwu</name>
<email>guoguangwug@gmail.com</email>
</author>
<published>2024-07-15T01:31:15Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=8b32ce586de9a4120bc7cdc104801113bed89f1d'/>
<id>urn:sha1:8b32ce586de9a4120bc7cdc104801113bed89f1d</id>
<content type='text'>
Change-Id: Ic57c93a8d8413fe4985bc430255b6db90e11b70c
GitHub-Last-Rev: 25db6644c6cd3ae532796b18f8978f84a51376af
GitHub-Pull-Request: golang/go#68397
Reviewed-on: https://go-review.googlesource.com/c/go/+/597936
Reviewed-by: Damien Neil &lt;dneil@google.com&gt;
LUCI-TryBot-Result: Go LUCI &lt;golang-scoped@luci-project-accounts.iam.gserviceaccount.com&gt;
Auto-Submit: Damien Neil &lt;dneil@google.com&gt;
Reviewed-by: Carlos Amedee &lt;carlos@golang.org&gt;
Reviewed-by: Emmanuel Odeke &lt;emmanuel@orijtech.com&gt;
</content>
</entry>
<entry>
<title>net: use slices and maps to clean up tests</title>
<updated>2024-07-25T00:20:13Z</updated>
<author>
<name>apocelipes</name>
<email>seve3r@outlook.com</email>
</author>
<published>2024-07-24T10:39:48Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=1d717951f518a9e818e8b98d4daed17756c394ca'/>
<id>urn:sha1:1d717951f518a9e818e8b98d4daed17756c394ca</id>
<content type='text'>
Replace reflect.DeepEqual with slices.Equal/maps.Equal, which is
much faster.

Change-Id: I54600fb63a56460c11d3d5af9072da585e31b1a2
GitHub-Last-Rev: 08c1445ad5be94d071e8ceb4b060b8f4ab0d77ba
GitHub-Pull-Request: golang/go#67606
Reviewed-on: https://go-review.googlesource.com/c/go/+/587816
Reviewed-by: Ian Lance Taylor &lt;iant@google.com&gt;
Reviewed-by: Dmitri Shuralyov &lt;dmitshur@google.com&gt;
LUCI-TryBot-Result: Go LUCI &lt;golang-scoped@luci-project-accounts.iam.gserviceaccount.com&gt;
Auto-Submit: Ian Lance Taylor &lt;iant@google.com&gt;
</content>
</entry>
<entry>
<title>all: change from sort functions to slices functions where feasible</title>
<updated>2024-05-23T01:00:11Z</updated>
<author>
<name>Ian Lance Taylor</name>
<email>iant@golang.org</email>
</author>
<published>2024-05-22T20:38:40Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=b0b1d42db32a992150dd26681d3bda222e108303'/>
<id>urn:sha1:b0b1d42db32a992150dd26681d3bda222e108303</id>
<content type='text'>
Doing this because the slices functions are slightly faster and
slightly easier to use. It also removes one dependency layer.

This CL does not change packages that are used during bootstrap,
as the bootstrap compiler does not have the required slices functions.
It does not change the go/scanner package because the ErrorList
Len, Swap, and Less methods are part of the Go 1 API.

Change-Id: If52899be791c829198e11d2408727720b91ebe8a
Reviewed-on: https://go-review.googlesource.com/c/go/+/587655
LUCI-TryBot-Result: Go LUCI &lt;golang-scoped@luci-project-accounts.iam.gserviceaccount.com&gt;
Reviewed-by: Ian Lance Taylor &lt;iant@google.com&gt;
Auto-Submit: Ian Lance Taylor &lt;iant@google.com&gt;
Commit-Queue: Ian Lance Taylor &lt;iant@google.com&gt;
Reviewed-by: Damien Neil &lt;dneil@google.com&gt;
</content>
</entry>
<entry>
<title>net/http/httputil: avoid ReverseProxy data race on 1xx response and error</title>
<updated>2024-02-27T23:37:42Z</updated>
<author>
<name>Damien Neil</name>
<email>dneil@google.com</email>
</author>
<published>2024-02-26T21:45:42Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=960654be0c4ad7918376e2e1d47491c9bc7520e0'/>
<id>urn:sha1:960654be0c4ad7918376e2e1d47491c9bc7520e0</id>
<content type='text'>
ReverseProxy uses a httptrace.ClientTrace.Got1xxResponse trace hook
to capture 1xx response headers for proxying. This hook can be called
asynchrnously after RoundTrip returns. (This should only happen when
RoundTrip has failed for some reason.) Add synchronization so we don't
attempt to modifying the ResponseWriter headers map from the hook
after another goroutine has begun making use of it.

Fixes #65123

Change-Id: I8b7ecb1a140f7ba7e37b9d27b8a20bca41a118b1
Reviewed-on: https://go-review.googlesource.com/c/go/+/567216
LUCI-TryBot-Result: Go LUCI &lt;golang-scoped@luci-project-accounts.iam.gserviceaccount.com&gt;
Reviewed-by: Jonathan Amsterdam &lt;jba@google.com&gt;
Auto-Submit: Damien Neil &lt;dneil@google.com&gt;
</content>
</entry>
</feed>
