forked from sl950313/SEDA-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhttp_request.h
39 lines (33 loc) · 831 Bytes
/
http_request.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
#ifndef _HTTP_REQUEST_H
#define _HTTP_REQUEST_H
#include "buffer.h"
#include "struct.h"
#include <string>
#include <string.h>
#include <map>
class http_request {
public:
read_http_status rhs;
buffer *buf;
http_request() : rhs(READ_HTTP_START), buf(new buffer()) {
memset(url, 0, 64);
}
~http_request() {delete buf;}
read_http_status read_http_status_machine(const char *_buf, int nread);
void print_request_info();
std::map<std::string, std::string> &get_map_contents();
char *getUrl() {
//memcpy(_url, url, 64);
return url;
}
private:
http_method method;
http_proto proto;
//std::string url;
char url[64];
std::map<std::string, std::string> content;
void get_params(char *content, int len);
void get_params_from_url();
void print_param();
};
#endif //