#include <fastmm/net/http_client.hpp>
|
| | HttpClient (Reactor &reactor, Stream &&stream, std::string host, std::uint16_t port, bool tls, const HttpClientConfig &cfg={}) |
| |
| | ~HttpClient () override |
| |
| | HttpClient (const HttpClient &)=delete |
| |
| HttpClient & | operator= (const HttpClient &)=delete |
| |
| bool | start () |
| |
| bool | request (std::string_view method, std::string_view target, std::string_view extra_headers, std::string_view body, HttpResponseCallback cb) |
| | Queues a request.
|
| |
| bool | request (std::string_view method, HttpTargetMaker make_target, std::string_view extra_headers, std::string_view body, HttpResponseCallback cb) |
| | The same, with the target made by make_target when the request is written rather than now: a request waiting behind others (one in flight per connection) carries what is true when it leaves, such as a signed query's timestamp, which the venue checks against a window.
|
| |
| void | close () noexcept |
| | Tears the connection down; every queued/in-flight request gets NetError::Canceled.
|
| |
| HttpClientState | state () const noexcept |
| |
| bool | is_ready () const noexcept |
| |
| bool | in_flight () const noexcept |
| |
| std::size_t | queued () const noexcept |
| |
| void | set_max_queue (std::size_t n) noexcept |
| | Requests queued already stay queued when this is lowered below their number.
|
| |
| const HttpClientStats & | stats () const noexcept |
| |
| Stream & | stream () noexcept |
| |
| void | on_readable () override |
| |
| void | on_writable () override |
| |
| void | on_error (int) override |
| | POLLERR (or a poll request the kernel refused).
|
| |
Public Member Functions inherited from fastmm::net::IoHandler |
| virtual | ~IoHandler ()=default |
| |
◆ HttpClient() [1/2]
template<ByteStream Stream>
◆ ~HttpClient()
template<ByteStream Stream>
◆ HttpClient() [2/2]
template<ByteStream Stream>
◆ operator=()
template<ByteStream Stream>
◆ start()
template<ByteStream Stream>
The connect and the TLS handshake are bounded like a request: a peer that accepts the TCP connection and never answers the ClientHello would otherwise hold every request queued.
◆ request() [1/2]
template<ByteStream Stream>
Queues a request.
extra_headers is a pre-formatted "Name: value\\r\\n" block. Returns false if the client is closed or the queue is full (callback not invoked).
◆ request() [2/2]
template<ByteStream Stream>
The same, with the target made by make_target when the request is written rather than now: a request waiting behind others (one in flight per connection) carries what is true when it leaves, such as a signed query's timestamp, which the venue checks against a window.
◆ close()
template<ByteStream Stream>
Tears the connection down; every queued/in-flight request gets NetError::Canceled.
◆ state()
template<ByteStream Stream>
◆ is_ready()
template<ByteStream Stream>
◆ in_flight()
template<ByteStream Stream>
◆ queued()
template<ByteStream Stream>
◆ set_max_queue()
template<ByteStream Stream>
Requests queued already stay queued when this is lowered below their number.
◆ stats()
template<ByteStream Stream>
◆ stream()
template<ByteStream Stream>
◆ on_readable()
template<ByteStream Stream>
◆ on_writable()
template<ByteStream Stream>
◆ on_error()
template<ByteStream Stream>
POLLERR (or a poll request the kernel refused).
err is the socket's SO_ERROR when retrievable (the refused request's errno for the latter), else 0.
Implements fastmm::net::IoHandler.