Description

package stream provides http.Handler middleware that passes-through the entire request

Stream works around several limitations caused by buffering implementations, but also introduces certain risks.

Workarounds for buffering limitations: 1. Streaming really large chunks of data (large file transfers, or streaming videos, etc.)

2. Streaming (chunking) sparse data. For example, an implementation might send a health check or a heart beat over a long-lived connection. This does not play well with buffering.

Risks: 1. Connections could survive for very long periods of time.

2. There is no easy way to enforce limits on size/time of a connection.

Examples of a streaming middleware:

// sample HTTP handler
handler := http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
  w.Write([]byte("hello"))
})

// Stream will literally pass through to the next handler without ANY buffering
// or validation of the data.
stream.New(handler)

stream is referenced in 1 repository

github.com/vulcand/oxy