A11 (C++ runtime)
Native C++ implementation of the A11 streaming action runtime
Loading...
Searching...
No Matches
a11::net::Http2ResponseStream Class Reference

A pull-oriented HTTP/2 response body stream. More...

#include <cpp/a11/net/http2.h>

Inheritance diagram for a11::net::Http2ResponseStream:
[legend]

Public Member Functions

a11::Future< HttpResponseHead > Headers () const
 
a11::Future< std::optional< std::string > > Read ()
 
a11::Future< HttpHeaders > Trailers () const
 The trailer fields that followed the body.
 
a11::Future< std::optional< HttpPushedResponse > > NextPush ()
 The next response the server pushed alongside this one.
 
a11::Task Done () const
 
absl::Status Cancel (absl::Status status=absl::CancelledError("HTTP/2 request cancelled"))
 Cancels the response stream with the given status.
 
std::int32_t stream_id () const
 

Friends

class Http2Connection
 
class Http1Connection
 
class Http2Client
 

Detailed Description

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.

Member Function Documentation

◆ 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()

a11::Future< HttpResponseHead > a11::net::Http2ResponseStream::Headers ( ) const
Returns
An awaitable resolving to the response status and headers.

◆ NextPush()

a11::Future< std::optional< HttpPushedResponse > > a11::net::Http2ResponseStream::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()

a11::Future< HttpHeaders > a11::net::Http2ResponseStream::Trailers ( ) const

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.

Friends And Related Symbol Documentation

◆ Http1Connection

friend class Http1Connection
friend

◆ Http2Client

friend class Http2Client
friend

◆ Http2Connection

friend class Http2Connection
friend

The documentation for this class was generated from the following files: