forked from qdaxb/httpserver
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrequest.h
More file actions
59 lines (59 loc) · 1.01 KB
/
request.h
File metadata and controls
59 lines (59 loc) · 1.01 KB
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
50
51
52
53
54
55
56
57
58
59
#ifndef _REQUEST_
#define _REQUEST_
#include <stdlib.h>
#include <stdio.h>
#include "common.h"
enum RequestMethod{UNKNOWN,GET,POST};
class HttpConnection;
class Request
{
public:
void reuse();
inline const char* getRequestHost(){return '\0';};
inline const char* getFullPath(){return '\0';};
inline const char* getPath()
{
if(path==NULL)
printf("a%s\n",path);
return path;
};
inline const char* getExtension()
{
//return extension;
return "exe";
}
Request(){
bufferPos=0;
readPos=0;
header=NULL;
extension=NULL;
}
inline RequestMethod getMethod(){return method;};
Request(HttpConnection *conn)
{
this->conn=conn;
bufferPos=0;
readPos=0;
header=NULL;
};
int read(char* requestheader,int len);
void init();
virtual ~Request(){
free(header);
header=NULL;
};
private:
HttpConnection *conn;
void parsePath(char* req);
char* header;
char* host;
char* fullPath;
char* path;
char* refer;
char* useragent;
char* extension;
RequestMethod method;
int bufferPos;
int readPos;
};
#endif