Commit 1811aa0
authored
node, cmd: remove dead geth-forked httpServer (erigontech#21724)
`node/rpcstack.go` carried a geth-forked `httpServer` (plus
`httpConfig`/`wsConfig`/`rpcHandler`, `checkPath`, and a package-local
`isWebsocket`) that is never constructed outside tests — `newHTTPServer`
has no non-test callers. Erigon's actual HTTP/WS serving lives in
`cmd/rpcdaemon/cli` (`createHandler` + `node.StartHTTPEndpoint`). This
removes the dead closure and its never-wired configuration:
- `node/rpcstack.go`: drop `httpServer` and friends (−331 lines). The
live exports (`NewHTTPHandlerStack`, `NewWSConnectionLimiter`,
`RegisterApisFromWhitelist`, and the CORS/vhost/gzip/admission
middleware) are untouched.
- `cmd/utils/flags.go`: drop `--http.rpcprefix` / `--ws.rpcprefix` flag
definitions — never registered with any command.
- `node/nodecfg/config.go`: drop the corresponding `HTTPPathPrefix` /
`WSPathPrefix` fields — never read.
Tests previously used the dead `httpServer` as a harness around live
middleware; they are rewritten to target the live constructors directly:
- CORS/vhosts/allowlist tests now run `httptest.Server` around
`NewHTTPHandlerStack`.
- WebSocket origin and connection-limit tests use
`rpc.Server.WebsocketHandler` + `NewWSConnectionLimiter`.
- `TestHTTP2H2C` now exercises the production `StartHTTPEndpoint` h2c
path (x/net h2c) instead of the dead server's `http.Protocols` wiring,
so h2c support is finally asserted on a server erigon actually runs.
- `TestIsWebsocket` moves to `cmd/rpcdaemon/cli`, which has the live
(previously untested) `isWebsocket` copy.
- `Test_checkPath` is deleted along with `checkPath`.
Supersedes erigontech#21714: the WS status-code bug fixed there lives in the
removed, unreachable `httpServer.ServeHTTP`. The corresponding upstream
fix is ethereum/go-ethereum#35111, which remains correct in geth where
this code is live.
Pure dead-code removal, no behavior change — per the repo TDD guidance
the rewritten existing tests are the safety net. Verified locally: `make
lint` (twice) clean, `go test ./node/ ./cmd/rpcdaemon/cli/` green, `make
erigon integration` builds.
Possible follow-up (out of scope here): most of the geth-inherited
HTTP/WS block in `nodecfg.Config` (`HTTPHost`, `HTTPPort`, `HTTPCors`,
`HTTPModules`, `WSHost`, `WSPort`, `WSOrigins`, `WSModules`,
`WSExposeAll`) also has no non-test readers.1 parent 5a7c7ad commit 1811aa0
5 files changed
Lines changed: 71 additions & 479 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
26 | 42 | | |
27 | 43 | | |
28 | 44 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
470 | 470 | | |
471 | 471 | | |
472 | 472 | | |
473 | | - | |
474 | | - | |
475 | | - | |
476 | | - | |
477 | | - | |
478 | 473 | | |
479 | 474 | | |
480 | 475 | | |
| |||
518 | 513 | | |
519 | 514 | | |
520 | 515 | | |
521 | | - | |
522 | | - | |
523 | | - | |
524 | | - | |
525 | | - | |
526 | 516 | | |
527 | 517 | | |
528 | 518 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | 116 | | |
120 | 117 | | |
121 | 118 | | |
| |||
125 | 122 | | |
126 | 123 | | |
127 | 124 | | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | 125 | | |
132 | 126 | | |
133 | 127 | | |
| |||
0 commit comments