-
-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Needs E-TAG header. May serve incorrect content on server restart #318
Comments
#191 is about ETag. We definitely do want to add this. (What does this have to do with server restart though?) |
Ooops, shoulda done my homework. It has to do with restart / SIGUSR1 because if you change the config file such that it points to a different directory, you can't tell that the config file successfully reloaded. It looks like it's reading the old config... until you examine the headers. |
Can you elaborate on this?
Config != web page. I'm still confused. |
The device starts up in a
Once the API gets the master passphrase from the device owner the device unlocks and the config is changed (and caddy gets SIGUSR1 (v0.8) or SIGTERM and then restarted (v0.7))
The lock screen then issues a refresh of the page (after the api call to unlock the device).... and it's still at the lock screen... WHAT!? Oh, it's because the html files for the lock screen I just updated (because that's the app I'm working on) and the coolaj86.com app is "older". So I restart the server with a new config file, and the web page I'm looking at is a completely different web page than what is on disk due to the 304 cache. |
Just manual testing updating the config with SIGUSR1 and it looked like it was even working. However, I found that it's actually sending
304 Not Modified
for content that has been modified.The issue is that it sends
last-modified
headers with the date of the file, but if the file is swapped out with an earlier file, it sees theif-modified-since
header and can't tell that the file has been modified.Instead it should send an etag which could be as simple as a sha1sum of the file attributes (created at, modified at, size, inode, permissions) or actually performing a sha1 on the file.
To reduce overhead, the sha1 could be stored in memory or a temporary file - if you want to check full contents rather than just attributes that is.
The text was updated successfully, but these errors were encountered: