SVGHMI : avoid caching of xhtml file by forcing cache-control header in http response.
--- a/svghmi/svghmi.py Fri Jan 17 16:25:45 2020 +0100
+++ b/svghmi/svghmi.py Tue Jan 21 13:55:03 2020 +0100
@@ -516,7 +516,7 @@
{svghmi_cmds[Watchdog]}
def _runtime_svghmi1_{location}_start():
- svghmi_root.putChild('{view_name}',File('{xhtml}', defaultType='application/xhtml+xml'))
+ svghmi_root.putChild('{view_name}', NoCacheFile('{xhtml}', defaultType='application/xhtml+xml'))
{svghmi_cmds[Start]}
def _runtime_svghmi1_{location}_stop():
--- a/svghmi/svghmi_server.py Fri Jan 17 16:25:45 2020 +0100
+++ b/svghmi/svghmi_server.py Tue Jan 21 13:55:03 2020 +0100
@@ -193,3 +193,11 @@
svghmi_send_thread.join()
svghmi_send_thread = None
+
+class NoCacheFile(File):
+ def render_GET(self, request):
+ request.setHeader(b"Cache-Control", b"no-cache, no-store")
+ return File.render_GET(self, request)
+ render_HEAD = render_GET
+
+