-
Notifications
You must be signed in to change notification settings - Fork 1
/
HttpRequest.h
49 lines (40 loc) · 1.44 KB
/
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
44
45
46
47
48
49
#ifndef HTTPREQUEST_H
#define HTTPREQUEST_H
#include "base/String.h"
#include "base/ByteBuffer.h"
#include "base/HashTable.h"
#include "Client.h"
/*
Control Data: request-method request-target protocol-version
*/
/*enum HTTP_METHOD {
GET, //Transfer a current representation of the target resource. 9.3.1
HEAD, //Same as GET, but do not transfer the response content. 9.3.2
POST, //Perform resource-specific processing on the request content. 9.3.3
PUT //Replace all current representations of the target resource with the request content. 9.3.4
DELETE, //Remove all current representations of the target resource. 9.3.5
CONNECT, //Establish a tunnel to the server identified by the target resource. 9.3.6
OPTIONS, //Describe the communication options for the target resource. 9.3.7
TRACE //Perform a message loop-back test along the path to the target resource.
};*/
enum HTTP_METHOD { GET, HEAD, POST, PUT, DELETE_, CONNECT, OPTIONS, TRACE };
class HttpRequest {
public:
HashTable<String,String> params;
HttpRequest(char*,Client);
int parse();
String getMethod();
char* getPath();
private:
struct ControlData {
HTTP_METHOD method;
String request_target;
String protocol_version;
};
Client client;
String raw_request;
ControlData control_data;
HashTable<String,String> header_fields;
ByteBuffer body;
};
#endif // HTTPREQUEST_H