-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
trailers under h2 #11
Labels
help wanted
Extra attention is needed
Comments
I'm not very familiar with h2, so if there is anything wrong, please point it out. |
Suddenly I came up with an idea: why not look into the headers? If trailer header exists in headers, then server just prepare to flush, in this case, we can throw |
So, according to the comments in asgiref so far, now we have a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As you can see, I have implemented trailer extension for http/2... but with some tricks. According to h2's document
So h2 will force to close stream when build trailers. When stream got closed, there is no chance to send that trailer. So you must flush that trailer immediately, then the stream is close. But wait, where is the response body? It's still waiting for http/2's priority! And since the stream is closed, you will lose the chance to send the response body. So the server must know which body should also be flushed without waiting for priority. How? Emm..... I added a extra key to do that, called
meta
. And by usingawait send({"type": "http.response.body", "body": xxxx, "meta": {"flush": True}})
, the server will flush it without waiting. Using this method, I built a gRPC server, and successfully talked to a normal gRPC client. It's just.... that's not a part of asgi spec.The text was updated successfully, but these errors were encountered: