ENTS-tock
Environmental NeTworked Sensor firmware on Tock OS
Loading...
Searching...
No Matches
http.hpp
Go to the documentation of this file.
1
8#ifndef LIB_DIRTVIZ_INCLUDE_HTTP_HPP_
9#define LIB_DIRTVIZ_INCLUDE_HTTP_HPP_
10
11#include <map>
12#include <string>
13
29 public:
35 HttpClient();
36
42 explicit HttpClient(const std::string& resp);
43
48
56 std::string Version();
57
63 unsigned int ResponseCode();
64
72 std::string Header(std::string header);
73
79 std::string Data();
80
81 private:
83 std::string version;
84
86 unsigned int code = 0;
87
89 std::map<std::string, std::string> headers;
90
92 std::string data;
93
94 const std::string LINE_END = "\r\n";
103 void DecodeStatus(std::string status_str);
104
114 void DecodeHeaders(std::string headers_str);
115
121 void RemoveLeadingSpace(std::string* str);
122
128 void RemoveTrailingSpace(std::string* str);
129
135 void ExtractText(std::string* str);
136
142 void RemoveSpace(std::string* str);
143};
144
149#endif // LIB_DIRTVIZ_INCLUDE_HTTP_HPP_
HTTP request parser library.
Definition http.hpp:28
HttpClient()
Default constructor.
Definition http.cpp:8
~HttpClient()
Default destructor.
Definition http.cpp:27
std::string Version()
Get the Http version.
Definition http.cpp:29
unsigned int ResponseCode()
Get the http response code.
Definition http.cpp:31
std::string Header(std::string header)
Get value of header.
Definition http.cpp:33
std::string Data()
Get data from Http request.
Definition http.cpp:35