merge PageCompiler changes from poco-1.9.3

This commit is contained in:
Günter Obiltschnig
2019-08-20 22:04:18 +02:00
parent aec24aa4f7
commit 8f96473bde
3 changed files with 43 additions and 34 deletions

View File

@@ -244,6 +244,10 @@ Allows to specify a language tag (e.g., "en") that will be sent in the
response Content-Language header if the client sends an Accept-Language response Content-Language header if the client sends an Accept-Language
header in the request. header in the request.
!contentSecurityPolicy
Allows to specify the value of the HTTP Content-Security-Policy header.
!chunked !chunked
Allows you to specify whether the response is sent using chunked transfer encoding. Allows you to specify whether the response is sent using chunked transfer encoding.

View File

@@ -311,6 +311,7 @@ void CodeWriter::writeResponse(std::ostream& ostr)
{ {
std::string contentType(_page.get("page.contentType", "text/html")); std::string contentType(_page.get("page.contentType", "text/html"));
std::string contentLang(_page.get("page.contentLanguage", "")); std::string contentLang(_page.get("page.contentLanguage", ""));
std::string contentSecurityPolicy(_page.get("page.contentSecurityPolicy", ""));
std::string cacheControl(_page.get("page.cacheControl", "")); std::string cacheControl(_page.get("page.cacheControl", ""));
bool buffered(_page.getBool("page.buffered", false)); bool buffered(_page.getBool("page.buffered", false));
bool chunked(_page.getBool("page.chunked", !buffered)); bool chunked(_page.getBool("page.chunked", !buffered));
@@ -329,6 +330,10 @@ void CodeWriter::writeResponse(std::ostream& ostr)
ostr << "\tif (request.has(\"Accept-Language\"))\n" ostr << "\tif (request.has(\"Accept-Language\"))\n"
<< "\t\tresponse.set(\"Content-Language\", \"" << contentLang << "\");\n"; << "\t\tresponse.set(\"Content-Language\", \"" << contentLang << "\");\n";
} }
if (!contentSecurityPolicy.empty())
{
ostr << "\tresponse.set(\"Content-Secure-Policy\", \"" << contentSecurityPolicy << "\");\n";
}
if (compressed) if (compressed)
{ {
ostr << "\tbool _compressResponse(request.hasToken(\"Accept-Encoding\", \"gzip\"));\n" ostr << "\tbool _compressResponse(request.hasToken(\"Accept-Encoding\", \"gzip\"));\n"

View File

@@ -204,7 +204,7 @@ protected:
helpFormatter.setHeader( helpFormatter.setHeader(
"\n" "\n"
"The POCO C++ Server Page Compiler.\n" "The POCO C++ Server Page Compiler.\n"
"Copyright (c) 2008-2018 by Applied Informatics Software Engineering GmbH.\n" "Copyright (c) 2008-2019 by Applied Informatics Software Engineering GmbH.\n"
"All rights reserved.\n\n" "All rights reserved.\n\n"
"This program compiles web pages containing embedded C++ code " "This program compiles web pages containing embedded C++ code "
"into a C++ class that can be used with the HTTP server " "into a C++ class that can be used with the HTTP server "