X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FNetwork%2FHTTPClient.cxx;h=b86f42d82b0090efeab34b6ffa27514b599ef544;hb=a1031b052dd40ca3a4ea68dcd7f572b7d9e4bb24;hp=ca293d83ccb4df26691419a3755d872ff11c7acb;hpb=2218a44ed76def7dcbe9233cfd34488ad66b7752;p=flightgear.git diff --git a/src/Network/HTTPClient.cxx b/src/Network/HTTPClient.cxx index ca293d83c..b86f42d82 100644 --- a/src/Network/HTTPClient.cxx +++ b/src/Network/HTTPClient.cxx @@ -21,30 +21,41 @@ #include "HTTPClient.hxx" #include
+#include -static FGHTTPClient* static_instance = NULL; +FGHTTPClient::FGHTTPClient() +{ +} -FGHTTPClient* FGHTTPClient::instance() +FGHTTPClient::~FGHTTPClient() { - if (!static_instance) { - static_instance = new FGHTTPClient; - } - - return static_instance; } -bool FGHTTPClient::haveInstance() +void FGHTTPClient::init() { - return (static_instance != NULL); + _http.reset(new simgear::HTTP::Client); + + std::string proxyHost(fgGetString("/sim/presets/proxy/host")); + int proxyPort(fgGetInt("/sim/presets/proxy/port")); + std::string proxyAuth(fgGetString("/sim/presets/proxy/auth")); + + if (!proxyHost.empty()) { + _http->setProxy(proxyHost, proxyPort, proxyAuth); + } } -FGHTTPClient::FGHTTPClient() +void FGHTTPClient::shutdown() { - std::string proxyHost(fgGetString("/sim/presets/proxy/host")); - int proxyPort(fgGetInt("/sim/presets/proxy/port")); - std::string proxyAuth(fgGetString("/sim/presets/proxy/auth")); - - if (!proxyHost.empty()) { - setProxy(proxyHost, proxyPort, proxyAuth); - } + _http.reset(); } + +void FGHTTPClient::update(double dt) +{ + SG_UNUSED(dt); + _http->update(); +} + +void FGHTTPClient::makeRequest(const simgear::HTTP::Request_ptr& req) +{ + _http->makeRequest(req); +} \ No newline at end of file