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
60
61
|
#pragma once
#include <map>
#include <BString.h>
#include <Handle.h>
#ifdef _MSC_VER
// SERIOUSLY ?!
#undef DELETE
#undef ERROR
#endif
namespace Balau {
namespace Http {
const char * getStatusMsg(int httpStatus);
const char * getContentType(const String & extension);
typedef std::map<String, String> StringMap;
typedef std::map<String, IO<Handle> > FileList;
struct Request {
int method;
String host;
String uri;
StringMap variables;
StringMap headers;
FileList files;
bool persistent;
bool upgrade;
String version;
};
enum {
GET,
HEAD,
POST,
PUT,
DELETE,
TRACE,
OPTIONS,
CONNECT,
BREW,
PROPFIND,
WHEN,
REDIRECT = 301,
BAD_REQUEST = 400,
UNAUTHORIZED = 401,
FORBIDDEN = 403,
NOT_FOUND = 404,
ERROR = 500,
};
};
};
|