Seastar
High performance C++ framework for concurrent servers
|
Class connection represents an HTTP connection over a given transport.
Check the demos/http_client_demo.cc for usage example
#include <seastar/http/client.hh>
Public Member Functions | |
connection (connected_socket &&fd, internal::client_ref cr) | |
Create an http connection. More... | |
future< reply > | make_request (request rq) |
Send the request and wait for response. More... | |
input_stream< char > | in (reply &rep) |
Get a reference on the connection input stream. More... | |
future | close () |
Closes the connection. More... | |
shared_ptr< connection > | shared_from_this () noexcept |
shared_ptr< const connection > | shared_from_this () const noexcept |
long | use_count () const noexcept |
seastar::http::experimental::connection::connection | ( | connected_socket && | fd, |
internal::client_ref | cr | ||
) |
Create an http connection.
Construct the connection that will work over the provided \fd transport socket
future seastar::http::experimental::connection::close | ( | ) |
Closes the connection.
Connection must be closed regardless of whether there was an exception making the request or not
input_stream< char > seastar::http::experimental::connection::in | ( | reply & | rep | ) |
Get a reference on the connection input stream.
The stream can be used to get back the server response body. After the stream is finished, the reply can be additionally updated with trailing headers and chunk extentions
Send the request and wait for response.
Sends the provided request to the server, and returns a future that will resolve into the server response.
If the request was configured with the set_expects_continue() and the server replied early with some error code, this early reply will be returned back.
The returned reply only contains the status and headers. To get the reply body the caller should read it via the input_stream provided by the connection.in() method.
rq | – request to be sent |