2018-11-03 17:12:20 +01:00
|
|
|
#ifndef HTTPGATEWAY_H
|
|
|
|
#define HTTPGATEWAY_H
|
2022-12-13 10:16:30 +01:00
|
|
|
|
|
|
|
#define CPPHTTPLIB_FORM_URL_ENCODED_PAYLOAD_MAX_LENGTH 65536
|
|
|
|
|
2020-03-18 22:15:06 +01:00
|
|
|
#include <httplib.h>
|
2018-11-03 17:12:20 +01:00
|
|
|
#include "gatewayinterface.h"
|
|
|
|
#include "../requestworker.h"
|
|
|
|
#include "../request.h"
|
|
|
|
#include "../response.h"
|
|
|
|
#include "../utils.h"
|
|
|
|
class HttpGateway : public GatewayInterface
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
Response convertResponse(httplib::Response response);
|
|
|
|
httplib::Response convertResponse(Response response);
|
|
|
|
Request convertRequest(httplib::Request request);
|
|
|
|
// void worker(const httplib::Request& req, httplib::Response& res);
|
2019-02-21 10:47:49 +01:00
|
|
|
|
|
|
|
std::string listenaddr;
|
|
|
|
int listenport;
|
2019-05-04 00:02:17 +02:00
|
|
|
uint64_t maxPayloadLength;
|
2019-02-21 10:47:49 +01:00
|
|
|
|
2018-11-03 17:12:20 +01:00
|
|
|
public:
|
2019-09-29 17:12:36 +02:00
|
|
|
HttpGateway(std::string listenaddr, int port, uint64_t maxPayloadLength);
|
2018-11-03 17:12:20 +01:00
|
|
|
bool keepReading() override;
|
|
|
|
void work(RequestWorker &worker) override;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // HTTPGATEWAY_H
|