net/http: add ErrUseLastResponse, Client.CloseIdleConnections, Transport.Proxy and ProxyURL - #70
Merged
Conversation
This was referenced Aug 14, 2026
0pcom
force-pushed
the
http-api-compat-fills
branch
from
August 24, 2026 16:49
3102197 to
b6fd871
Compare
deadprogram
reviewed
Aug 24, 2026
| // | ||
| // To make a request with a specified context.Context, use [NewRequestWithContext] | ||
| // and Client.Do. | ||
| // CloseIdleConnections closes any connections on its Transport which were |
Member
There was a problem hiding this comment.
This method is placed directly into the comments from the Get method.
Contributor
Author
There was a problem hiding this comment.
Good catch — it was sitting inside the Client.Get doc block, orphaning that comment. Moved to after Client.Head, which is where upstream Go has it. Code motion only.
Both are API-compatibility fills. ErrUseLastResponse is a sentinel a CheckRedirect func returns to stop following redirects; nothing here has to act on it beyond existing. CloseIdleConnections delegates to the Transport when it has the method, which is what net/http does. Programs that reference either currently fail to compile against this package for want of a name, which is the whole cost.
Same as the TLSHandshakeTimeout one: what matters is that the field exists for API compatibility, not which project happens to set it.
0pcom
force-pushed
the
http-api-compat-fills
branch
from
August 25, 2026 18:31
b6fd871 to
1e17dbc
Compare
Member
|
Now squash/merging. Thanks for the improvement @0pcom |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Four API-compatibility fills in
net/http. Programs that reference any of them currently fail to compile against this package even when the feature is irrelevant to how they run.ErrUseLastResponse— the sentinel aCheckRedirectfunc returns to stop following redirects. Nothing has to act on it beyond existing.Client.CloseIdleConnections— delegates to the Transport when it has the method, which is what upstream net/http does.ProxyURL— returns a proxy function that always yields the same URL.Transport.Proxy— the field itself.One caveat worth stating plainly:
Transport.Proxyis accepted but not consulted. The netdev-backed transport dials directly. A caller that sets it gets a client that compiles and runs but ignores the proxy, which is a real footgun — I have commented it as such at the field. If you would rather not carry a field that silently does nothing, I am happy to dropProxy/ProxyURLand keep only the first two, which have no such caveat.Independent of #59 — this touches no netdev code and applies to
maindirectly.Found while building Skycoin's skywire against TinyGo, where each of these was a compile error before it was anything else.