Skip to content

net/http: clarify that TimeoutHandler buffers all writes into memory #47899

@jsign

Description

@jsign
Contributor

While reading http.TimeoutHandler implementation I noticed that in current docs there's no mention that all writes in the response are buffered in memory before being flushed to the client.

Digging a bit in the git history, this was a clarification that was present on the original implementation.

The last change that touched the docs has a good summary of some back and forth in implementing Flusher, which docs changes made this original note be lost.

It feels to me that clarifying that all writes are buffered to memory is something worth adding again since that should be considered by users when wrapping handlers that might produce big writes.

The proposed new docs for that paragraph could be:

// TimeoutHandler buffers all Handler writes to memory. 
// It supports the Pusher interface but does not support the Hijacker 
// or Flusher interfaces.

If that sounds like a good idea, I can create a CL with this change.

Activity

seankhliao

seankhliao commented on Aug 23, 2021

@seankhliao
Member
added
DocumentationIssues describing a change to documentation.
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.
on Aug 23, 2021
gopherbot

gopherbot commented on Aug 28, 2021

@gopherbot
Contributor

Change https://golang.org/cl/345795 mentions this issue: net/http: clarify TimeoutHandler buffer writes to memory

added this to the Unplanned milestone on Aug 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationIssues describing a change to documentation.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      Participants

      @jsign@gopherbot@seankhliao

      Issue actions

        net/http: clarify that TimeoutHandler buffers all writes into memory · Issue #47899 · golang/go