15 static bool parseHeaders(
const std::string &header, std::string &r,
16 std::multimap<std::string, std::string> &res);
19 static const char *mime_type(
const std::string &file_name);
22 static time_t parseDateRfc1123(
const std::string &date);
25 static void trimWSP(std::string &s);
28 static std::vector<std::string> split(
const std::string &s,
29 const std::string &sep);
30 static bool isSubdomain(
const std::string &subdomain,
31 const std::string &domain) {
32 auto s = domain.size();
33 return (subdomain.size() > s &&
34 subdomain[subdomain.size()-s-1] ==
'.' &&
35 subdomain.substr(subdomain.size()-s) == domain);
37 static bool isWithinPath(
const std::string &uri,
38 const std::string &path) {
40 return (!uri.empty() && uri[0] ==
'/');
41 if (path != uri.substr(0, path.size()))
43 if (path.size() < uri.size()) {
44 return path[path.size()-1] ==
'/' ||
45 uri[path.size()] ==
'/';
46 }
else if (path.size() == uri.size()) {
53 static std::string uriPath(std::string uri) {
54 auto qpos = uri.find(
'?');
55 if (qpos != std::string::npos)
57 qpos = uri.rfind(
'/');
58 if (qpos != std::string::npos)
Definition: http_common.h:12