-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHttpHeaders.h
55 lines (41 loc) · 1001 Bytes
/
HttpHeaders.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
50
51
52
53
54
#ifndef HTTPHEADERS_H
#define HTTPHEADERS_H
#include <iostream>
#include <string>
struct NimbleString {
NimbleString() {
length = 0;
string = 0;
}
int length;
const char* string;
void log() {
std::cout << "Header length: " << length << " bytes. Content: '";
std::cout.write(string, length);
std::cout << "'." << std::endl;
}
operator std::string() {
if(length == 0) {
return std::string();
}
std::string asString(string, length);
return asString;
}
};
template <typename T>
struct NimbleArray {
NimbleArray() {
length = 0;
}
T data;
int length;
};
struct HttpHeaders {
NimbleString method;
NimbleString file;
NimbleString extension;
NimbleString queryString;
NimbleString port; // http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html mandatory
NimbleString host;
};
#endif /* HTTPHEADERS_H */