Merge branch 'poco-1.10.1' into devel

This commit is contained in:
Günter Obiltschnig 2020-02-10 19:03:31 +01:00
commit f4b68ff430
3 changed files with 14 additions and 13 deletions

View File

@ -68,7 +68,6 @@ void CodeWriter::writeImpl(std::ostream& ostr, const std::string& headerFileName
ostr << "#include \"Poco/StreamCopier.h\"\n"; ostr << "#include \"Poco/StreamCopier.h\"\n";
ostr << "#include <sstream>\n"; ostr << "#include <sstream>\n";
} }
ostr << "\n\n";
std::string decls(_page.implDecls().str()); std::string decls(_page.implDecls().str());
if (!decls.empty()) if (!decls.empty())
@ -76,6 +75,8 @@ void CodeWriter::writeImpl(std::ostream& ostr, const std::string& headerFileName
ostr << decls << "\n\n"; ostr << decls << "\n\n";
} }
ostr << "using namespace std::string_literals;\n\n\n";
beginNamespace(ostr); beginNamespace(ostr);
std::string path = _page.get("page.path", ""); std::string path = _page.get("page.path", "");
@ -328,24 +329,24 @@ void CodeWriter::writeResponse(std::ostream& ostr)
ostr << "\tresponse.setChunkedTransferEncoding(true);\n"; ostr << "\tresponse.setChunkedTransferEncoding(true);\n";
} }
ostr << "\tresponse.setContentType(\"" << contentType << "\");\n"; ostr << "\tresponse.setContentType(\"" << contentType << "\"s);\n";
if (!contentLang.empty()) if (!contentLang.empty())
{ {
ostr << "\tif (request.has(\"Accept-Language\"))\n" ostr << "\tif (request.has(\"Accept-Language\"s))\n"
<< "\t\tresponse.set(\"Content-Language\", \"" << contentLang << "\");\n"; << "\t\tresponse.set(\"Content-Language\"s, \"" << contentLang << "\"s);\n";
} }
if (!contentSecurityPolicy.empty()) if (!contentSecurityPolicy.empty())
{ {
ostr << "\tresponse.set(\"Content-Secure-Policy\", \"" << contentSecurityPolicy << "\");\n"; ostr << "\tresponse.set(\"Content-Secure-Policy\"s, \"" << contentSecurityPolicy << "\"s);\n";
} }
if (compressed) if (compressed)
{ {
ostr << "\tbool _compressResponse(request.hasToken(\"Accept-Encoding\", \"gzip\"));\n" ostr << "\tbool _compressResponse(request.hasToken(\"Accept-Encoding\"s, \"gzip\"s));\n"
<< "\tif (_compressResponse) response.set(\"Content-Encoding\", \"gzip\");\n"; << "\tif (_compressResponse) response.set(\"Content-Encoding\"s, \"gzip\"s);\n";
} }
if (!cacheControl.empty()) if (!cacheControl.empty())
{ {
ostr << "\tresponse.set(\"Cache-Control\", \"" << cacheControl << "\");\n"; ostr << "\tresponse.set(\"Cache-Control\"s, \"" << cacheControl << "\"s);\n";
} }
ostr << "\n"; ostr << "\n";
} }

View File

@ -107,14 +107,14 @@ void OSPCodeWriter::writeSession(std::ostream& ostr)
std::string sessionCode; std::string sessionCode;
if (session.empty()) return; if (session.empty()) return;
if (session[0] == '@') if (session[0] == '@')
sessionCode = "context()->thisBundle()->properties().getString(\"" + session.substr(1) + "\")"; sessionCode = "context()->thisBundle()->properties().getString(\"" + session.substr(1) + "\"s)";
else else
sessionCode = "\"" + session + "\""; sessionCode = "\"" + session + "\"s";
std::string sessionTimeoutCode = page().get("page.sessionTimeout", "30"); std::string sessionTimeoutCode = page().get("page.sessionTimeout", "30");
int sessionTimeout; int sessionTimeout;
if (!Poco::NumberParser::tryParse(sessionTimeoutCode, sessionTimeout)) if (!Poco::NumberParser::tryParse(sessionTimeoutCode, sessionTimeout))
{ {
sessionTimeoutCode = "context()->thisBundle()->properties().getInt(\"" + sessionTimeoutCode + "\")"; sessionTimeoutCode = "context()->thisBundle()->properties().getInt(\"" + sessionTimeoutCode + "\"s)";
} }
ostr << "\tPoco::OSP::Web::WebSession::Ptr session;\n"; ostr << "\tPoco::OSP::Web::WebSession::Ptr session;\n";
ostr << "\t{\n"; ostr << "\t{\n";