fix(05-WR-01): raise ReadTimeout/WriteTimeout to 120s for large uploads

15s was too short for 25MB uploads on slow connections (~256KB/s takes
~100s). Both timeouts are raised to 120s to accommodate MAX_UPLOAD_SIZE_MB
at worst-case bandwidth with headroom.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Arthur Belleville 2026-05-15 12:50:25 +02:00
parent 690ea2ddaf
commit 49e84c8176
No known key found for this signature in database

View file

@ -119,8 +119,14 @@ func main() {
Addr: ":" + port,
Handler: router,
// T-01-10 slow-client mitigation per RESEARCH Security Domain.
ReadTimeout: 15 * time.Second,
WriteTimeout: 15 * time.Second,
// ReadTimeout covers request header + body read; 15 s is sufficient for API
// calls but upload routes read up to MAX_UPLOAD_SIZE_MB (default 25 MB). The
// MaxBytesReader in FileUploadHandler bounds the body size, not time; a slow
// upload at ~256 KB/s takes ~100 s. WriteTimeout covers the full request
// lifecycle from accept to response flush, so it must be generous enough for
// large uploads. 120 s accommodates 25 MB at ~250 KB/s with headroom.
ReadTimeout: 120 * time.Second,
WriteTimeout: 120 * time.Second,
IdleTimeout: 60 * time.Second,
}