Comments (12)
I @Fenny @erikdubbelboer I really appreciate your attention to my question. I believe we can close this issue because there is an alternative.
from fiber.
What will the trailers be used for? Is your response body so big that you can't wait with returning the initial headers until it is completely generated? I'm curious as I have never seen a use case for trailers before.
from fiber.
Thanks for opening your first issue here! 🎉 Be sure to follow the issue template!
from fiber.
@rhodee, I will leave this issue open for now. I will take a look at the RFC 7230 and see if we can help out to implement this in fasthttp.
You could ask @erikdubbelboer here if he could help implementing this, he is one of the core maintainers of fasthttp.
from fiber.
I will do just that @Fenny thank you for giving this a look!
from fiber.
@rhodee I'm guessing we are talking about receiving Trailers here or responding with Trailers? At least not sending them in an outgoing request right?
from fiber.
Hi @erikdubbelboer I am seeking an approach where I can define Trailer Headers, then set them after writing the chunk response. I think the semantics which best capture my intent are in this URL:
https://golang.org/pkg/net/http/#example_ResponseWriter_trailers
Does that make sense? If not I can try to explain further.
from fiber.
The problem I'm having with this is that fasthttp will always wait with sending a response until the handler function has returned. The only ways to send the response body after the handler has returned are SetBodyStream()
and SetBodyStreamWriter()
. These functions allow you to either specify an io.Reader
to read the body from or write it yourself to an bufio.Writer
. Neither of these give us the ability to allow you to add trailers after it all.
So to be able to send Trailers we'll need to add some form of API that allows you to set these after the handler has returned already.
In your use case, what are you using? SetBodyStream
or SetBodyStreamWriter
?
from fiber.
@erikdubbelboer this is a very helpful discussion. I am starting the fiber
project from scratch (moving away from a gRPC implementation) and wanted to use Trailers (which I have in my gRPC implementation). So it is a clean slate 😄
from fiber.
Is your response body so big that you can't wait with returning the initial headers until it is completely generated?
They will not be. I use the trailer for timings or arbitrary messages, however it is trivial to meet my needs without Trailers
.
from fiber.
Thanks @erikdubbelboer for jumping in 👍
from fiber.
In my case I'm using trailer headers to notify a down stream proxy to purge session since it is expensive to find out whether the session is done unless the body is completely generated. It is not a deal breaker to not support trailer but it still would be nice to have.
from fiber.
Related Issues (20)
- 🐛 [Bug]: setting a Logger that access TLSConnectionState() will break when `app.Server().MaxConnsPerIP` is set to a value HOT 9
- 🤗 [Question]: Fiber http with Cloudflare ssl reverse leading to 525, SSL handshake failed HOT 2
- 🤗 [Question] Is Fiber going to be used for Rust? HOT 3
- proxy.Balancer middleware should handle http backend servers when using app.ListenTLS HOT 2
- 🤗 [Question]: How to get the form data from the html form object? HOT 1
- 📝 [Proposal]: Add support for zstd compression
- 📝 [Proposal]: Add support for CHIPS (Cookies Having Independent Partitioned State)
- 🐛 [Bug]: incorrect selection of the error handler if one of the sub apps is mounted on "/" HOT 2
- 🤗 [Question]: gofiber v3 rc release date? HOT 2
- 📝 [Proposal]: v3 auto binding HOT 2
- 🤗 [Question]: Does fiber v3's Request not have the function of adding files to FormData? HOT 3
- 🤗 [Question]: I have a problem with Middleware HOT 10
- 🤗 [Question]: Is `fiber.Ctx` thread safe? If not, is that documented? HOT 8
- 🤗 [Question]: A new Redis key is created every time the url is accessed. Is this normal? HOT 5
- [question]: Why do long requests block each other? HOT 15
- 🐛 [Bug]: Limiter middleware with pebble storage does not deduct remaining limit
- 📝 [Proposal]: Improving route matching and url parsing performance with Ada Url HOT 7
- Improve Error Handling in CSRF Middleware Storage
- 🤗 [Question]: v3 when ready for production HOT 1
- 🐛 [Bug]: Unclear "json: invalid use of ,string struct tag, trying to unmarshal unquoted value into uint64" HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fiber.