-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHttpRequestParse.h
More file actions
42 lines (35 loc) · 911 Bytes
/
HttpRequestParse.h
File metadata and controls
42 lines (35 loc) · 911 Bytes
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
#ifndef __HTTP_REQUEST_H_
#define __HTTP_REQUEST_H_
typedef map<string, string> http_header;
typedef struct tagRequestInfo
{
string method;
string url;
string version;
http_header http_headers;
string body;
}RequestInfo;
class CHttpRequestParse
{
public:
CHttpRequestParse();
~CHttpRequestParse();
int Input(string strInput, RequestInfo& stRequestInfo);
string GetContentType(string strFileExtName);
private:
int Reset();
int parse_http_request(string header, RequestInfo &stRequestInfo);
string get_method(string &header);
string get_url(string &header);
string get_http_version(string &header);
bool is_valid_http_method(string method);
http_header parse_http_headers(string &header);
int get_content_length(RequestInfo &stRequestInfo);
private:
string m_strRequestHeader;
bool m_bHasbody;
int m_nContentLen;
void init_map_file_type();
map<string, string> m_mapFileType;
};
#endif