gateway: the client's comment points at where the ChatGPT backend's HTTP/1.1 rule now lives (#1700)

The previous #1700 commit deleted gateway/codex_http1.go and moved the
rule into netproxy.HTTP1, which provider/codex_http1.go sets; the
comment on the gateway's client still named the deleted file.

Review of #1700 (no other change needed): every Codex request magpie
makes goes through a netproxy.Dispatch transport, http.DefaultClient's
(codexModels, warmCodex, accountJSON for /wham/usage and the reset
credits, consumeCodexReset) or the gateway's s.client (turns, /models);
the HTTP/1.1 clone keeps netproxy.Func, or the account's own proxy,
and Clone deep-copies TLSClientConfig, so clearing NextProtos there
leaves the base transport offering h2 to every other vendor.

Run on 7485065d (the cherry-picked #1700, sandbox HOME, private
GOCACHE): go test -tags nogui ./internal/netproxy ./internal/provider
./internal/gateway pass; -race on TestDispatchHTTP1, TestWith,
TestCodexBackendOwnRequestsOverHTTP1, TestAccountProxy (provider and
gateway) and TestCodexBackendOverHTTP1 pass. Broken by hand: with
netproxy.HTTP1 left nil, TestCodexBackendOwnRequestsOverHTTP1 fails
(all five requests "HTTP/2.0 (h2 offered)") and the gateway's
TestCodexBackendOverHTTP1 fails ("asked over HTTP/2.0"); without the
NextProtos reset TestDispatchHTTP1 fails ("malformed HTTP response",
the server took h2 from the hello). gofmt -l clean; go vet darwin,
GOOS=linux -tags nogui, GOOS=windows clean; linux and windows builds.
Not reproduced: the reporter's PROTOCOL_ERROR itself.

Co-authored-by: appointat <65004114+Appointat@users.noreply.github.com>
This commit is contained in:
yetone
2026-10-13 06:18:27 +08:00
co-authored by appointat
parent 4537e92093
commit 84cd81533e
+1 -1
View File
@@ -367,7 +367,7 @@ func New() *Server {
return &Server{
// a request counted against a MaxRPM waits for room in its minute
// first (rpm.go); the ChatGPT backend is spoken to over HTTP/1.1
// (codex_http1.go)
// (netproxy.HTTP1, which provider/codex_http1.go sets)
client: &http.Client{Transport: rpmTransport{upstreamTransport()}},
unfit: make(map[string]bool),
subscription: newSubscriptionBridge(),