ReCodEx - Task Broker
ReCodEx is complex programmer testing solution, primary targeted to technical universities. It's highly customizable and based on modern technologies.
curl.h
1 #ifndef RECODEX_BROKER_HELPERS_CURL_H
2 #define RECODEX_BROKER_HELPERS_CURL_H
3 
4 #include <curl/curl.h>
5 #include <map>
6 
7 namespace helpers
8 {
12  typedef std::map<std::string, std::string> curl_params;
13 
20  std::string get_http_query(const curl_params &params);
21 
33  std::string curl_get(const std::string &url,
34  const long port,
35  const curl_params &params,
36  const std::string &username = "",
37  const std::string &passwd = "");
38 
50  std::string curl_post(const std::string &url,
51  const long port,
52  const curl_params &params,
53  const std::string &username = "",
54  const std::string &passwd = "");
55 
56 
60  class curl_exception : public std::exception
61  {
62  public:
66  curl_exception() : what_("Generic curl exception")
67  {
68  }
73  curl_exception(const std::string &what) : what_(what)
74  {
75  }
76 
80  virtual ~curl_exception()
81  {
82  }
83 
88  virtual const char *what() const noexcept
89  {
90  return what_.c_str();
91  }
92 
93  protected:
95  std::string what_;
96  };
97 }
98 
99 
100 #endif // RECODEX_BROKER_HELPERS_CURL_H
std::string what_
Definition: curl.h:95
curl_exception(const std::string &what)
Definition: curl.h:73
virtual const char * what() const noexcept
Definition: curl.h:88
Definition: curl.h:7
virtual ~curl_exception()
Definition: curl.h:80