本文整理汇总了C++中URI::fileName方法的典型用法代码示例。如果您正苦于以下问题:C++ URI::fileName方法的具体用法?C++ URI::fileName怎么用?C++ URI::fileName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类URI
的用法示例。
在下文中一共展示了URI::fileName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addCookieHeader
void CookieJar::addCookieHeader(const URI &uri, const std::string &request)
{
string domain = uri.server();
if (not acceptCookies(domain))
{
// this server is blocked.
return;
}
string path = uri.fileName();
addCookieHeader(domain, path, request);
m_domain = domain;
saveCookiesToDisk();
}
示例2: cookiesForRequest
void CookieJar::cookiesForRequest(
const URI &request,
std::string &headers,
time_t now)
{
loadDomainCookies(request.server());
loadDomainCookies(topLevel(request.server()));
// printf("cookiesForRequest: %s \n",request.asString().c_str());
string domain(request.server());
// find a cookie in the jar that corresponds to the requested domain...
string tmp("Cookie: ");
bool needSep(false);
const static string sep("; ");
bool haveExpired(false);
std::vector<Cookie *>::const_iterator it(m_cookies.begin());
for (; it != m_cookies.end(); ++it)
{
Cookie *c(*it);
if (c->name() == DOMAIN_STR)
continue;
if (c->matchesDomain(domain)) {
if (c->expired(now)) {
haveExpired = true;
continue;
}
if (not c->path().empty())
{
// check to see if the requested path is a sub dir of path
string value = c->path();
string file = request.fileName();
size_t pos = file.find(value);
if (pos != 0)
{
continue;
}
}
// do not send secure cookies to unsecure domains
if (c->secure() and request.protocol() != URI::HTTPS_PROTOCOL)
{
continue;
}
if (needSep)
{
tmp += sep;
}
string value(c->value());
bool needQuotes = value.find_first_of(" ")!=string::npos;
tmp += c->name();
tmp += "=";
if (needQuotes) {
tmp += "\"";
}
tmp += c->value();
if (needQuotes) {
tmp += "\"";
}
needSep = true;
}
}
if (needSep) {
tmp += "\r\n";
headers = tmp;
}
if (haveExpired) {
gcExpiredCookies(now);
}
}