-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrequest.cpp
41 lines (36 loc) · 1 KB
/
request.cpp
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
#include "request.h"
SLOWSReq::SLOWSReq() {}
SLOWSReq::SLOWSReq(std::string method, std::string uri,
std::string protocolVersion)
: Method(method), ProtocolVersion(protocolVersion) {
std::regex backPath("\\.\\./");
Uri = std::regex_replace(uri, backPath, "");
}
void SLOWSReq::setMethod(std::string method) {
Method = method;
}
void SLOWSReq::setUri(std::string uri) {
Uri = uri;
}
void SLOWSReq::setProtocolVersion(std::string protocolVersion) {
ProtocolVersion = protocolVersion;
}
std::string SLOWSReq::getMethod() {
return Method;
}
std::string SLOWSReq::getUri() {
return Uri;
}
std::string SLOWSReq::getProtocolVersion() {
return ProtocolVersion;
}
std::map<std::string, std::string> SLOWSReq::getHeaders() {
return Headers;
}
void SLOWSReq::pushHeader(std::string name, std::string value) {
auto search = Headers.find(name);
if (search != Headers.end())
Headers.erase(search);
Headers.insert({name, value});
}
SLOWSReq::~SLOWSReq() {}