m8

A general-purpose preprocessor for metaprogramming.


m8

/

src

/

ob

/

http.hh

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
#ifndef OB_HTTP_HH
#define OB_HTTP_HH

#include <string>
#include <vector>

class Http
{
public:

  Http();
  ~Http();

  int run();

  struct Req
  {
    std::string method {"GET"};
    std::string url;
    std::vector<std::string> headers;
    std::string data;
  } req;

  struct Res
  {
    int status {0};
    std::vector<std::string> headers;
    std::string body;
  } res;

private:

  static size_t cb_header(void *contents, size_t size, size_t nmemb, void *userp);
  static size_t cb_write(void *contents, size_t size, size_t nmemb, void *userp);
};

#endif // OB_HTTP_HH
Back to Top