trailers under h2
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
As you can see, I have implemented trailer extension for http/2... but with some tricks. According to h2's document
When acting as a server, you may call ``send_headers`` any number of
times allowed by the following rules, in this order:
- zero or more times with ``(':status', '1XX')`` (where ``1XX`` is a
placeholder for any 100-level status code).
- once with any other status header.
- zero or one time for trailers.
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 using await 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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the h2 trailer rules quoted in the issue and the ASGI specification's http.response.body message. Trace how the server handles the shown send message, including the proposed meta.flush behavior, and compare trailer, body, and stream-closing behavior. Done means the intended HTTP/2 trailer behavior is defined and implemented without violating the ASGI contract.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- grpc, python
- Domain
- api, backend, networking
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100