line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#pragma once |
2
|
|
|
|
|
|
|
#include "Fields.h" |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
namespace panda { namespace protocol { namespace http { |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
template |
7
|
0
|
|
|
|
|
|
struct GenericHeaders: Fields { |
8
|
|
|
|
|
|
|
using Fields::Fields; |
9
|
|
|
|
|
|
|
using Fields::operator=; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
GenericHeaders& add (const string& key, const string& value) & { |
12
|
|
|
|
|
|
|
Fields::add(key, value); |
13
|
|
|
|
|
|
|
return *this; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
GenericHeaders&& add (const string& key, const string& value) && { |
17
|
|
|
|
|
|
|
Fields::add(key, value); |
18
|
|
|
|
|
|
|
return std::move(*this); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
uint32_t length () const { |
22
|
|
|
|
|
|
|
uint32_t ret = 0; |
23
|
|
|
|
|
|
|
for (auto& field : fields) ret += field.name.length() + 2 + field.value.length() + 2; |
24
|
|
|
|
|
|
|
return ret; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
string connection () const { return get("Connection", ""); } |
28
|
|
|
|
|
|
|
string date () const { return get("Date", ""); } |
29
|
|
|
|
|
|
|
string host () const { return get("Host", ""); } |
30
|
|
|
|
|
|
|
string location () const { return get("Location", ""); } |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
GenericHeaders& connection (const string& ctype) & { return add("Connection", ctype); } |
33
|
|
|
|
|
|
|
GenericHeaders&& connection (const string& ctype) && { return std::move(*this).add("Connection", ctype); } |
34
|
|
|
|
|
|
|
GenericHeaders& date (const string& date) & { return add("Date", date); } |
35
|
|
|
|
|
|
|
GenericHeaders&& date (const string& date) && { return std::move(*this).add("Date", date); } |
36
|
|
|
|
|
|
|
GenericHeaders& host (const string& host) & { return add("Host", host); } |
37
|
|
|
|
|
|
|
GenericHeaders&& host (const string& host) && { return std::move(*this).add("Host", host); } |
38
|
|
|
|
|
|
|
GenericHeaders& location (const string& location) & { return add("Location", location); } |
39
|
|
|
|
|
|
|
GenericHeaders&& location (const string& location) && { return std::move(*this).add("Location", location); } |
40
|
|
|
|
|
|
|
GenericHeaders& chunked () & { return add("Transfer-Encoding", "chunked"); } |
41
|
|
|
|
|
|
|
GenericHeaders&& chunked () && { return std::move(*this).add("Transfer-Encoding", "chunked"); } |
42
|
|
|
|
|
|
|
GenericHeaders& expect_continue () & { return add("Expect", "100-continue"); } |
43
|
|
|
|
|
|
|
GenericHeaders&& expect_continue () && { return std::move(*this).add("Expect", "100-continue"); } |
44
|
|
|
|
|
|
|
}; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
using Headers = GenericHeaders<15>; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
}}} |