libinet++
A networking library for humans that code in C++
 All Classes Functions
http.h
1 
8 #ifndef LIBINET_HTTP_H_
9 #define LIBINET_HTTP_H_
10 
11 #include <string>
12 #include <vector>
13 
14 #include "sockets.h"
15 
17  public:
18  std::string raw;
19  unsigned int status_code;
20  std::string status_message;
21 
22  std::vector<std::vector<std::string> > headers;
23  std::string body;
24 
25  HTTP_Response();
26 };
27 
28 class HTTP {
29  private:
30  Socket socket;
31 
32  static std::string raw_response;
33  static bool socket_data_callback(std::string data);
34 
35  public:
36  std::string server;
37  unsigned int port;
38  std::vector<std::vector<std::string> > headers;
39 
40  HTTP();
41  HTTP(std::string _server, unsigned int _port);
42 
43  void add_header(std::string name, std::string value);
44  std::vector<std::vector<std::string> > parse_headers();
45 
46  HTTP_Response request(std::string type, std::string location, std::string body = "");
47 };
48 
49 #endif
50