Go net/http 1.27

Last reviewed Oct 11, 2026

Export as PDF

Prompt Details

Prompt Composition

2prompts
  1. Go 1.27130 lines · 5.5K tokens
  2. Go net/http 1.2772 lines · 3.9K tokens
Total202 lines · 9.3K tokens

CWE Coverage

  • 15
  • 20
  • 22
  • 59
  • 78
  • 79
  • 89
  • 94
  • 117
  • 190
  • 208
  • 209
  • 250
  • 252
  • 257
  • 287
  • 295
  • 307
  • 323
  • 327
  • 338
  • 347
  • 352
  • 362
  • 367
  • 378
  • 384
  • 426
  • 444
  • 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.27 prompt first. These rules cover the Go 1.27 standard-library HTTP server, client, router, file handlers, and reverse proxy. The standard library is updated by rebuilding with the toolchain; the included baseline governs its security updates.

Server limits and protocols

  • Assign an explicit, fully wrapped handler to Server.Handler; nil selects DefaultServeMux, including routes registered by imported packages. Keep administrative handlers on a separately restricted listener.
  • Size MaxHeaderBytes and MaxHeaderValueCount independently: zero selects defaults of 1 MiB and 500 values. Repeated header lines count separately, but comma-separated members of one line count once, except that Go 1.27.2 and later count each field a Trailer header declares; validate security-sensitive singleton headers separately.
  • Configure Server.Protocols and Transport.Protocols deliberately. Enable SetUnencryptedHTTP2(true) only on an explicitly trusted, isolated connection path; it supplies neither TLS nor peer authentication. Review custom TLSNextProto and ConnectionState() tls.ConnectionState implementations because they affect ALPN protocol selection.
  • Configure HTTP/2 through the native Protocols and HTTP2Config APIs where possible. If golang.org/x/net/http2 remains, audit both the module and the toolchain and check which implementation the build selects: current Go 1.27 wrappers delegate to net/http, while http2legacy and older module implementations need their own fixes. Replace deprecated h2c.NewHandler with Server.Protocols; wrap