|
A11 (C++ runtime)
Native C++ implementation of the A11 streaming action runtime
|
An HTTP/2 client connection, reusable across many streams. More...
#include <cpp/a11/net/http2.h>
Classes | |
| struct | Impl |
Public Member Functions | |
| ~Http2Client () | |
| absl::StatusOr< std::shared_ptr< Http2ResponseStream > > | RequestStream (std::string method, std::string path, HttpHeaders headers={}, std::string body={}, std::string scheme={}) |
| Opens a request and returns a pull-oriented response body stream. | |
| absl::StatusOr< std::shared_ptr< Http2DuplexStream > > | ExtendedConnect (std::string protocol, std::string path, HttpHeaders headers={}, std::string scheme={}) |
| Opens an extended CONNECT duplex stream for bidirectional data. | |
| absl::StatusOr< std::shared_ptr< Http2DuplexStream > > | RequestStreamingBody (std::string method, std::string path, HttpHeaders headers={}, std::string scheme={}) |
| Opens a request whose body is written incrementally. | |
| a11::Future< HttpResponse > | Request (std::string method, std::string path, HttpHeaders headers={}, std::string body={}, std::string scheme={}) |
| absl::Status | Close () |
| Closes the client connection. | |
| std::string | host () const |
| std::uint16_t | port () const |
| bool | connected () const |
| bool | secure () const |
| bool | multiplexed () const |
| Whether this connection can carry several exchanges at once. | |
| void *absl_nullable | GetImpl () const |
Static Public Member Functions | |
| static a11::Future< std::shared_ptr< Http2Client > > | Connect (std::string host, std::uint16_t port, const Http2Options &options={}) |
| Asynchronously connects to an HTTP/2 server. | |
An HTTP/2 client connection, reusable across many streams.
Issues buffered requests, incremental response streams, or extended CONNECT duplex streams over a single connection. Shared as the transport backing HTTP SSE and WebSocket client wire streams.
| a11::net::Http2Client::~Http2Client | ( | ) |
| absl::Status a11::net::Http2Client::Close | ( | ) |
Closes the client connection.
|
static |
Asynchronously connects to an HTTP/2 server.
| host | Server hostname. |
| port | Server port. |
| options | Body limits, buffering, deadline, and TLS settings. |
| bool a11::net::Http2Client::connected | ( | ) | const |
| absl::StatusOr< std::shared_ptr< Http2DuplexStream > > a11::net::Http2Client::ExtendedConnect | ( | std::string | protocol, |
| std::string | path, | ||
| HttpHeaders | headers = {}, |
||
| std::string | scheme = {} |
||
| ) |
Opens an extended CONNECT duplex stream for bidirectional data.
| void *absl_nullable a11::net::Http2Client::GetImpl | ( | ) | const |
| std::string a11::net::Http2Client::host | ( | ) | const |
| bool a11::net::Http2Client::multiplexed | ( | ) | const |
Whether this connection can carry several exchanges at once.
True for HTTP/2 (h2 or h2c), false for HTTP/1.1 – which A11 restricts to one request per connection rather than pipelining. A caller sharing a connection between requests has to know which it got.
| std::uint16_t a11::net::Http2Client::port | ( | ) | const |
| a11::Future< HttpResponse > a11::net::Http2Client::Request | ( | std::string | method, |
| std::string | path, | ||
| HttpHeaders | headers = {}, |
||
| std::string | body = {}, |
||
| std::string | scheme = {} |
||
| ) |
| absl::StatusOr< std::shared_ptr< Http2ResponseStream > > a11::net::Http2Client::RequestStream | ( | std::string | method, |
| std::string | path, | ||
| HttpHeaders | headers = {}, |
||
| std::string | body = {}, |
||
| std::string | scheme = {} |
||
| ) |
Opens a request and returns a pull-oriented response body stream.
| absl::StatusOr< std::shared_ptr< Http2DuplexStream > > a11::net::Http2Client::RequestStreamingBody | ( | std::string | method, |
| std::string | path, | ||
| HttpHeaders | headers = {}, |
||
| std::string | scheme = {} |
||
| ) |
Opens a request whose body is written incrementally.
Where RequestStream() wants the whole body up front, this returns while the request side is still open. Http2DuplexStream::Write() sends more data and Finish() ends the body, while the same handle provides the response. This supports uploads of unknown or unbounded length without content-length: HTTP/2 uses DATA frames and HTTP/1.1 uses a chunked body.
| method | Request method. |
| path | Absolute request path, including any query. |
| headers | Request headers. Do not set content-length: the body's length is not known when the headers are sent. |
| scheme | Request scheme; defaults to the connection's. |
| bool a11::net::Http2Client::secure | ( | ) | const |