MCPcopy Create free account
hub / github.com/PostHog/duckgres / serveStream

Method serveStream

cmd/cache-proxy/proxy.go:666–676  ·  view source on GitHub ↗

serveStream copies a cached body from r back to the client, reconstructing 206 Partial Content semantics when the original request had a Range header. size is the on-disk length (known up front), so Content-Length and the Content-Range total are set before any body bytes flow — same response shape t

(w http.ResponseWriter, r io.Reader, size int64, rangeHeader, contentType string)

Source from the content-addressed store, hash-verified

664 return strings.Contains(msg, "connection reset by peer") ||
665 strings.Contains(msg, "connection refused") ||
666 strings.Contains(msg, "unexpected eof") ||
667 strings.Contains(msg, "timeout")
668}
669
670func originFetchOutcome(err error) string {
671 if err == nil {
672 return "success"
673 }
674 var oe *originStatusError
675 if errors.As(err, &oe) {
676 return "http_error"
677 }
678 if errors.Is(err, context.Canceled) {
679 return "canceled"

Callers 1

HandleProxyMethod · 0.95

Calls 1

HeaderMethod · 0.45

Tested by

no test coverage detected