Closed JK-de closed 6 years ago
Ok yes, that's cool indeed ! Just, I think that's must be an option configurable (True/False) no ? (With a default and an optional date too ?)
How should the config look like?
A global variable like STATIC_CONTENT = True
at top of MicroWebSrv or a setter function?
I think default should be True for speed up page delivery.
Which date you send does not matter. Important is, that is always the same and is far in the past. Suggest an other fix date...
Yes, just a default variable set to True like : self.MaxWebSocketRecvLen = 1024 self.WebSocketThreaded = True self.AcceptWebSocketCallback = None
Added microWebSrv.LetCacheStaticContentLevel to control the level of caching: 0=none, 1=cached, 2=cached even if F5
Till now all static content (CSS, PNG, JS,...) is loaded from IoT-device on each page load. With additional headers 'Last-Modified' the static content is only loaded at the first time (and after 10 years). On refresh in browser (F5) a request is send with header 'Is-Modified-Since' and the IoT-device can answer with 304 (Not modified) to prevent sending all again. This improves loading time of pages dramatically! PyHTML-files are not affected/cached!
Note: Assuming the static files are really static and a new version gets a new name...
Tested with FireFox, Edge, Chrome (on Windows)