From 84cd81533efaef98ec2835d3c0ab0fb3bc9962dc Mon Sep 17 00:00:00 2001 From: yetone Date: Tue, 13 Oct 2026 06:05:09 +0800 Subject: [PATCH] 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> --- internal/gateway/gateway.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/gateway/gateway.go b/internal/gateway/gateway.go index 2f0b3f199..244306ef2 100644 --- a/internal/gateway/gateway.go +++ b/internal/gateway/gateway.go @@ -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(),