Go net/http 1.26

Last reviewed Sep 23, 2026

Export as PDF

Prompt Details

Prompt Composition

2prompts
  1. Go 1.26134 lines · 5.6K tokens
  2. Go net/http 1.2673 lines · 3.8K tokens
Total207 lines · 9.4K tokens

CWE Coverage

  • 20
  • 22
  • 59
  • 78
  • 79
  • 89
  • 94
  • 117
  • 190
  • 208
  • 209
  • 250
  • 252
  • 257
  • 295
  • 307
  • 323
  • 327
  • 338
  • 347
  • 352
  • 362
  • 367
  • 378
  • 384
  • 426
  • 488
  • 494
  • 525
  • 532
  • 552
  • 601
  • 613
  • 639
  • 732
  • 759
  • 770
  • 772
  • 807
  • 862
  • 863
  • 915
  • 916
  • 918
  • 942
  • 1004
  • 1021
  • 1275
  • 1395
  • 1428

Prompt Preview

Apply the Go 1.26 baseline first. These rules cover servers, clients, routers, reverse proxies, and browser-facing handlers built with the Go 1.26 net/http standard library. net/http and net/http/httputil ship inside the Go toolchain, so their fixes reach an application only when it is rebuilt and redeployed with a newer Go 1.26 release, never by raising a module requirement. The standard library carries its own copy of the HTTP/2 code; if the application also imports golang.org/x/net/http2 or golang.org/x/net/http2/h2c directly, that copy comes from the golang.org/x/net module and needs its own upgrade.

Server and protocol boundaries

  • Attach a dedicated http.NewServeMux to each configured http.Server. Package-level serving shortcuts create a server with default limits, and a nil Server.Handler exposes DefaultServeMux, including handlers registered by imports such as net/http/pprof.
  • Enforce header counts at the ingress before Go parses them. Go 1.26 has no Server.MaxHeaderValueCount; a handler count check limits downstream work but cannot prevent initial parser allocations. Keep the baseline's MaxHeaderBytes budget as well.
  • Select Server.Protocols and Transport.Protocols explicitly when protocol choice affects security. Keep unencrypted HTTP/2 behind an authenticated, integrity-protected channel. Check the negotiated protocol after changing ALPN, TLSNextProto, or transport dial/TLS hooks; custom transport hooks can disable automatic HTTP/2 unless explicitly enabled.
  • Set Server.HTTP2.MaxConcurrentStreams per connection and