config: Update 2 files
This commit is contained in:
45
tests/ipdemo/src/drogon_stubs.hpp
Normal file
45
tests/ipdemo/src/drogon_stubs.hpp
Normal file
@ -0,0 +1,45 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef DROGON_HEADERS_MISSING
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
// Stub declarations for Drogon when headers aren't available
|
||||
namespace drogon {
|
||||
enum class Get { Get };
|
||||
enum class ReqResult { Ok };
|
||||
|
||||
class HttpRequest {
|
||||
public:
|
||||
static HttpRequest* newHttpRequest();
|
||||
void setMethod(Get method);
|
||||
void setPath(const std::string& path);
|
||||
};
|
||||
|
||||
class HttpResponse {
|
||||
public:
|
||||
int statusCode() const;
|
||||
std::string body() const;
|
||||
};
|
||||
using HttpResponsePtr = std::shared_ptr<HttpResponse>;
|
||||
|
||||
class HttpClient {
|
||||
public:
|
||||
static HttpClient* newHttpClient(const std::string& url, void* loop);
|
||||
static HttpClient* newHttpClient(const std::string& url, void* loop, bool useOldTls, bool validateCert);
|
||||
void setCertPath(const std::string& cert, const std::string& key);
|
||||
void addSSLConfigs(const std::vector<std::pair<std::string, std::string>>& configs);
|
||||
void sendRequest(HttpRequest* req, std::function<void(ReqResult, const HttpResponsePtr&)> callback, double timeout);
|
||||
};
|
||||
}
|
||||
|
||||
namespace trantor {
|
||||
class EventLoop {
|
||||
public:
|
||||
void loop();
|
||||
void quit();
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
@ -4,8 +4,13 @@
|
||||
#include <thread>
|
||||
#include <mutex>
|
||||
#include <condition_variable>
|
||||
|
||||
#ifdef DROGON_HEADERS_MISSING
|
||||
#include "drogon_stubs.hpp"
|
||||
#else
|
||||
#include <drogon/HttpClient.h>
|
||||
#include <trantor/net/EventLoop.h>
|
||||
#endif
|
||||
|
||||
struct HttpResponse {
|
||||
int status_code;
|
||||
|
Reference in New Issue
Block a user