#4071: PageCompiler: add referrerPolicy to page directive

This commit is contained in:
Günter Obiltschnig
2023-07-10 21:27:24 +02:00
parent 4c1e83b8e8
commit 64b5a91ca1
3 changed files with 10 additions and 1 deletions

View File

@@ -317,6 +317,7 @@ void CodeWriter::writeResponse(std::ostream& ostr)
std::string contentType(_page.get("page.contentType", "text/html"));
std::string contentLang(_page.get("page.contentLanguage", ""));
std::string contentSecurityPolicy(_page.get("page.contentSecurityPolicy", ""));
std::string referrerPolicy(_page.get("page.referrerPolicy", ""));
std::string cacheControl(_page.get("page.cacheControl", ""));
bool buffered(_page.getBool("page.buffered", false));
bool chunked(_page.getBool("page.chunked", !buffered));
@@ -339,6 +340,10 @@ void CodeWriter::writeResponse(std::ostream& ostr)
{
ostr << "\tresponse.set(\"Content-Security-Policy\"s, \"" << contentSecurityPolicy << "\"s);\n";
}
if (!referrerPolicy.empty())
{
ostr << "\tresponse.set(\"Referrer-Policy\"s, \"" << referrerPolicy << "\"s);\n";
}
if (compressed)
{
ostr << "\tbool _compressResponse(request.hasToken(\"Accept-Encoding\"s, \"gzip\"s));\n"