2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
42#ifndef WEB_HTTP_CLIENT_HTTPCONFIG_H
43#define WEB_HTTP_CLIENT_HTTPCONFIG_H
45#include "net/config/ConfigSection.h"
47#ifndef DOXYGEN_SHOULD_SKIP_THIS
53namespace web::http::
client {
57 constexpr static std::string_view
NAME{
"http"};
58 constexpr static std::string_view
DESCRIPTION{
"HTTP behavior"};
#define APPLICATION(req, res)
#define MIDDLEWARE(req, res, next)
Client::MasterRequest MasterRequest
std::deque< TestCase > testCases
void dispatchNextRequest()
std::shared_ptr< MasterRequest > masterRequest
web::http::legacy::in::Client Client
std::shared_ptr< Client > client
Client::Response Response
std::size_t getFailures() const
static void atNextTick(const std::function< void(void)> &callBack)
static void init(int argc, char *argv[])
static int start(const utils::Timeval &timeOut={LONG_MAX, 0})
Config * getConfig() const
static constexpr int DISABLED
bool operator==(const int &state) const
static constexpr int ERROR
static constexpr int FATAL
static Timer singleshotTimer(const std::function< void()> &dispatcher, const utils::Timeval &timeout)
void operator()(const std::string &how="") const
std::map< std::string, std::string > params
void send(const std::string &chunk)
Response & status(int status)
Route & get(const Router &router) const
WebAppT(const std::string &name)
LogMessage(Level level, int verboseLevel=-1, bool withErrno=false)
std::string toString(bool expanded=true) const override
const Super & connect(const std::string &ipOrHostname, uint16_t port, const std::function< void(const SocketAddress &, core::socket::State)> &onStatus) const
const Super & listen(uint16_t port, const std::function< void(const SocketAddress &, core::socket::State)> &onStatus) const
ConfigSocketServer * setReuseAddress(bool reuseAddress=true)
constexpr bool setAttribute(const Attribute &&attribute, const std::string &subKey="", bool overwrite=false)
bool getAttribute(const std::function< void(Attribute &)> &onFound, const std::string &subKey="") const
Client(std::function< void(const std::shared_ptr< MasterRequest > &)> &&onHttpConnected, std::function< void(const std::shared_ptr< MasterRequest > &)> &&onHttpDisconnected)
typename Super::SocketAddress SocketAddress
web::http::client::Request Request
web::http::client::MasterRequest MasterRequest
Client(const std::function< void(SocketConnection *)> &onConnect, const std::function< void(SocketConnection *)> &onConnected, const std::function< void(SocketConnection *)> &onDisconnect, std::function< void(const std::shared_ptr< MasterRequest > &)> &&onHttpConnected, std::function< void(const std::shared_ptr< MasterRequest > &)> &&onHttpDisconnected)
SocketClientT< web::http::client::SocketContextFactory, std::function< void(const std::shared_ptr< MasterRequest > &)>, std::function< void(const std::shared_ptr< MasterRequest > &)>, std::function< net::config::ConfigInstance &()> > Super
Client(const std::string &name, const std::function< void(SocketConnection *)> &onConnect, const std::function< void(SocketConnection *)> &onConnected, const std::function< void(SocketConnection *)> &onDisconnect, std::function< void(const std::shared_ptr< MasterRequest > &)> &&onHttpConnected, std::function< void(const std::shared_ptr< MasterRequest > &)> &&onHttpDisconnected)
Client(const std::string &name, std::function< void(const std::shared_ptr< MasterRequest > &)> &&onHttpConnected, std::function< void(const std::shared_ptr< MasterRequest > &)> &&onHttpDisconnected)
web::http::client::Response Response
typename Super::SocketConnection SocketConnection
ConfigHTTP(utils::SubCommand *parent)
static constexpr std::string_view NAME
CLI::Option * pipelinedRequestsOpt
ConfigHTTP(ConfigHTTP &)=delete
CLI::Option * hostHeaderOpt
static constexpr std::string_view DESCRIPTION
ConfigHTTP(ConfigHTTP &&) noexcept=delete
ConfigHTTP & operator=(ConfigHTTP &)=delete
ConfigHTTP * setPipelinedRequests(bool pipelinedRequests)
ConfigHTTP * setHostHeader(const std::string &hostHeader)
ConfigHTTP & operator=(ConfigHTTP &&)=delete
bool getPipelinedRequests() const
std::string getHostHeader() const
bool end(const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> &onResponseReceived, const std::function< void(const std::shared_ptr< Request > &, const std::string &)> &onResponseParseError)
Request & set(const std::string &field, const std::string &value, bool overwrite=true)
int main(int argc, char *argv[])
net::in::stream::SocketClient< core::socket::stream::legacy::SocketConnector, net::in::stream::legacy::config::ConfigSocketClient, SocketContextFactoryT, Args... > SocketClient
web::http::client::Client< net::in::stream::legacy::SocketClient > Client