Seastar
High performance C++ framework for concurrent servers
Public Member Functions | List of all members
seastar::http::experimental::connection Class Reference

Detailed Description

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>

Inheritance diagram for seastar::http::experimental::connection:
seastar::enable_shared_from_this< connection > seastar::shared_ptr_count_base

Public Member Functions

 connection (connected_socket &&fd, internal::client_ref cr)
 Create an http connection. More...
 
future< replymake_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< connectionshared_from_this () noexcept
 
shared_ptr< const connectionshared_from_this () const noexcept
 
long use_count () const noexcept
 

Constructor & Destructor Documentation

◆ connection()

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

Member Function Documentation

◆ close()

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

◆ in()

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

◆ make_request()

future<reply> seastar::http::experimental::connection::make_request ( request  rq)

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.

Parameters
rq– request to be sent

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