mirror of
				https://github.com/pocoproject/poco.git
				synced 2025-10-25 18:22:59 +02:00 
			
		
		
		
	PageCompiler: add support for Cache-Control header
This commit is contained in:
		| @@ -272,6 +272,11 @@ is actually written to a string stream (<[std::ostringstream]>). | ||||
| Sending of the HTTP response back to the client is deferred to | ||||
| when the page is complete. | ||||
|  | ||||
| !cacheControl | ||||
|  | ||||
| If set to a non-empty string (e.g., "no-cache, no-store"), adds a "Cache-Control" | ||||
| header to the response with the given argument as value. | ||||
|  | ||||
| !session (OSP only) | ||||
|  | ||||
| For use with the POCO Open Service Platform only. | ||||
|   | ||||
| @@ -311,6 +311,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 cacheControl(_page.get("page.cacheControl", "")); | ||||
| 	bool buffered(_page.getBool("page.buffered", false)); | ||||
| 	bool chunked(_page.getBool("page.chunked", !buffered)); | ||||
| 	bool compressed(_page.getBool("page.compressed", false)); | ||||
| @@ -333,6 +334,10 @@ void CodeWriter::writeResponse(std::ostream& ostr) | ||||
| 		ostr << "\tbool _compressResponse(request.hasToken(\"Accept-Encoding\", \"gzip\"));\n" | ||||
| 		     << "\tif (_compressResponse) response.set(\"Content-Encoding\", \"gzip\");\n"; | ||||
| 	} | ||||
| 	if (!cacheControl.empty()) | ||||
| 	{ | ||||
| 		ostr << "\tresponse.set(\"Cache-Control\", \"" << cacheControl << "\");\n"; | ||||
| 	} | ||||
| 	ostr << "\n"; | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Günter Obiltschnig
					Günter Obiltschnig