mirror: drain probe body to EOF, not capped, so reuse actually works

main

Commit

Soph3mo ago

A LimitReader cap on the drain defeats its own purpose: if the body exceeds the cap, io.Copy stops before resp.Body reaches EOF, and Go only recycles a connection whose body was read to EOF — so a capped drain is identical to no drain in exactly the case it's meant to handle.

The maxProbeBytes cap on the read path bounds Decode's allocation; draining to io.Discard is O(1) memory, so no cap is needed there. The client Timeout still bounds how long the drain can run.

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com Entire-Checkpoint: 13446af914fa

Checkpoints

HTTP Connection Reuse and Probe Draining

Claude CodeOpus 4.8[1m]
View session
Checkpoint 1