A pull-oriented HTTP/2 response body stream.
More...
#include <cpp/a11/net/http2.h>
A pull-oriented HTTP/2 response body stream.
Read() returns nullopt after a clean END_STREAM. Only one outstanding Read() is permitted, which provides a bounded handoff from the libuv thread to fibers and ordinary threads.
◆ Cancel()
| absl::Status a11::net::Http2ResponseStream::Cancel |
( |
absl::Status |
status = absl::CancelledError("HTTP/2 request cancelled") | ) |
|
Cancels the response stream with the given status.
◆ Done()
| a11::Task a11::net::Http2ResponseStream::Done |
( |
| ) |
const |
- Returns
- An awaitable that resolves when the response is done.
◆ Headers()
- Returns
- An awaitable resolving to the response status and headers.
◆ NextPush()
The next response the server pushed alongside this one.
Resolves to nullopt once this response has ended, because HTTP/2 forbids a PUSH_PROMISE after the stream it is associated with completes – so at that point no further push can arrive and a reader can stop asking. Requires Http2Options::enable_push; without it the first call resolves to nullopt as soon as the response ends and no push is ever delivered.
- Returns
- An awaitable resolving to the next pushed response, or nullopt.
◆ Read()
| a11::Future< std::optional< std::string > > a11::net::Http2ResponseStream::Read |
( |
| ) |
|
- Returns
- An awaitable resolving to the next body chunk, or nullopt at end of stream.
◆ stream_id()
| std::int32_t a11::net::Http2ResponseStream::stream_id |
( |
| ) |
const |
- Returns
- The HTTP/2 stream identifier.
◆ Trailers()
The trailer fields that followed the body.
Resolves once the response has ended – with an empty list when the peer sent no trailer section, so awaiting this never depends on having guessed whether one was coming. A stream that failed fails here with the same status rather than reporting an empty section.
- Returns
- An awaitable resolving to the trailer fields.
◆ Http1Connection
| friend class Http1Connection |
|
friend |
◆ Http2Client
◆ Http2Connection
The documentation for this class was generated from the following files: