mirror of https://github.com/kiwix/libkiwix.git
Two private funcs of InternalServer became free
This commit is contained in:
parent
b249edee60
commit
c91df1cb26
|
@ -218,6 +218,24 @@ struct CustomizedResourceData
|
||||||
std::string resourceFilePath;
|
std::string resourceFilePath;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool etag_not_needed(const RequestContext& request)
|
||||||
|
{
|
||||||
|
const std::string url = request.get_url();
|
||||||
|
return kiwix::startsWith(url, "/skin")
|
||||||
|
|| url == "/random";
|
||||||
|
}
|
||||||
|
|
||||||
|
ETag
|
||||||
|
get_matching_if_none_match_etag(const RequestContext& r, const std::string& etagBody)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
const std::string etag_list = r.get_header(MHD_HTTP_HEADER_IF_NONE_MATCH);
|
||||||
|
return ETag::match(etag_list, etagBody);
|
||||||
|
} catch (const std::out_of_range&) {
|
||||||
|
return ETag();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // unnamed namespace
|
} // unnamed namespace
|
||||||
|
|
||||||
std::pair<std::string, Library::BookIdSet> InternalServer::selectBooks(const RequestContext& request) const
|
std::pair<std::string, Library::BookIdSet> InternalServer::selectBooks(const RequestContext& request) const
|
||||||
|
@ -605,24 +623,6 @@ MustacheData InternalServer::get_default_data() const
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InternalServer::etag_not_needed(const RequestContext& request) const
|
|
||||||
{
|
|
||||||
const std::string url = request.get_url();
|
|
||||||
return kiwix::startsWith(url, "/skin")
|
|
||||||
|| url == "/random";
|
|
||||||
}
|
|
||||||
|
|
||||||
ETag
|
|
||||||
InternalServer::get_matching_if_none_match_etag(const RequestContext& r, const std::string& etagBody) const
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
const std::string etag_list = r.get_header(MHD_HTTP_HEADER_IF_NONE_MATCH);
|
|
||||||
return ETag::match(etag_list, etagBody);
|
|
||||||
} catch (const std::out_of_range&) {
|
|
||||||
return ETag();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::unique_ptr<Response> InternalServer::build_homepage(const RequestContext& request)
|
std::unique_ptr<Response> InternalServer::build_homepage(const RequestContext& request)
|
||||||
{
|
{
|
||||||
return ContentResponse::build(*this, m_indexTemplateString, get_default_data(), "text/html; charset=utf-8");
|
return ContentResponse::build(*this, m_indexTemplateString, get_default_data(), "text/html; charset=utf-8");
|
||||||
|
|
|
@ -147,8 +147,6 @@ class InternalServer {
|
||||||
|
|
||||||
MustacheData get_default_data() const;
|
MustacheData get_default_data() const;
|
||||||
|
|
||||||
bool etag_not_needed(const RequestContext& r) const;
|
|
||||||
ETag get_matching_if_none_match_etag(const RequestContext& request, const std::string& etagBody) const;
|
|
||||||
std::pair<std::string, Library::BookIdSet> selectBooks(const RequestContext& r) const;
|
std::pair<std::string, Library::BookIdSet> selectBooks(const RequestContext& r) const;
|
||||||
SearchInfo getSearchInfo(const RequestContext& r) const;
|
SearchInfo getSearchInfo(const RequestContext& r) const;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue