forked from pEp.foundation/webserver
31 lines
579 B
C++
31 lines
579 B
C++
|
#pragma once
|
||
|
|
||
|
#include <string>
|
||
|
#include <stdexcept>
|
||
|
|
||
|
namespace pEp
|
||
|
{
|
||
|
class HttpError : public std::runtime_error
|
||
|
{
|
||
|
public:
|
||
|
HttpError(unsigned error_code, const std::string& error_message);
|
||
|
};
|
||
|
|
||
|
|
||
|
class Webclient
|
||
|
{
|
||
|
public:
|
||
|
Webclient(const std::string& server_name, unsigned port=80)
|
||
|
: m_server_name{server_name}
|
||
|
, m_port{port}
|
||
|
{}
|
||
|
|
||
|
std::string get(const std::string& url);
|
||
|
|
||
|
private:
|
||
|
const std::string& m_server_name;
|
||
|
const unsigned m_port;
|
||
|
};
|
||
|
|
||
|
} // end of namespace pEp
|