2015-11-24 07:47:29 +01:00
|
|
|
#pragma once
|
|
|
|
#ifndef MESSMER_CPPUTILS_NETWORK_HTTPCLIENT_HPP
|
|
|
|
#define MESSMER_CPPUTILS_NETWORK_HTTPCLIENT_HPP
|
|
|
|
|
|
|
|
#include "HttpClient.h"
|
|
|
|
#include "../macros.h"
|
|
|
|
|
|
|
|
namespace cpputils {
|
|
|
|
|
|
|
|
class CurlHttpClient final : public HttpClient {
|
|
|
|
public:
|
|
|
|
CurlHttpClient();
|
|
|
|
|
|
|
|
~CurlHttpClient();
|
|
|
|
|
2015-11-24 08:23:20 +01:00
|
|
|
boost::optional <std::string> get(const std::string &url, boost::optional<long> timeoutMsec = boost::none) override;
|
2015-11-24 07:47:29 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
void *curl;
|
|
|
|
|
|
|
|
static size_t write_data(void *ptr, size_t size, size_t nmemb, std::ostringstream *stream);
|
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(CurlHttpClient);
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|