-
Notifications
You must be signed in to change notification settings - Fork 0
/
HttpRequest.h
43 lines (35 loc) · 959 Bytes
/
HttpRequest.h
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
38
39
40
41
42
43
#ifndef HTTPREQUEST_H
#define HTTPREQUEST_H
#include <string>
#include <map>
class HttpRequest
{
public:
typedef std::multimap<std::string, std::string> HeaderMap;
HttpRequest();
static void toLower(std::string& s);
size_t parse(const std::string& buffer);
bool isKeepAlive() const;
const std::string& getPath() const;
int getHttpError() const;
void setHttpError(int httpError);
const std::string& getUserAgent() const;
std::string getHeader(const std::string& headerName) const;
time_t getIfModifiedSince() const;
private:
static const std::string SPACES;
static const std::string NEWLINES;
static const std::string SEPARATOR;
unsigned long long m_contentLength;
bool m_keepAlive;
std::string m_method;
std::string m_path;
std::string m_httpVersion;
HeaderMap m_headers;
std::string m_body;
std::string m_queryString;
int m_httpError;
std::string m_userAgent;
time_t m_ifModifiedSince;
};
#endif