You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello again, We currently need this functionality and I think it could be beneficial to everyone.
Basically, the idea is:
In server
funchandle(ctx*fasthttp.RequestCtx) {
// DisableBuffering modifies fasthttp to disable headers and body buffering for this requestctx.DisableBuffering()
// Write headersctx.Response.Header.Set(.....)
ctx.Response.Header.Set(.....)
ctx.Response.Header.Set(.....)
// Write body. Headers will be sent and cannot be modified once the body begins to be dispatched.// src can be any io.Reader or io.ReaderFrom or any object implementing io.WriteTo// The process would be unbuffered, well, actually using at most a 32KB buffer // according to the current io.Copy implementation.// Ideal for serving large files without storing them on RAM. io.Copy(ctx, src)
}
It would automatically set the Transfer-Encoding header to "chunked" and chunk the content on the fly.
I can write a PR if you think it makes sense for fasthttp
Hello everyone. I know this has been asked several times, but it's been a while and there have been many changes in fasthttp.
Is there a way to copy a body directly from the source to the user without having to get it completely in memory?
This involves two aspects:
The text was updated successfully, but these errors were encountered: