Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

Fix Last Modified Date Comparison #147

Open
panesofglass opened this issue Dec 26, 2015 · 4 comments
Open

Fix Last Modified Date Comparison #147

panesofglass opened this issue Dec 26, 2015 · 4 comments

Comments

@panesofglass
Copy link
Contributor

See notes from @ForNeVeR discussion on gitter.

@ForNeVeR
Copy link
Contributor

Quoting myself from gitter chat, so the future readers could understand the problem:

Consider I have defined my resource modification date as File.GetLastWriteTimeUtc "filename.txt". It could be, for example, 2015-01-01T12:34:56.001Z (note the .001 millisecond part, that's important).

When Freya sends that date to client, it truncates milliseconds, so the date becomes Last-Modified: Smt, 1 Jan 2015, 12:34:56 GMT.

And here's the problem. When client wants to check if resource was modified, it sends that date back. And Freya tries to compare the dates 2015-01-01T12:34:56.001Z and 2015-01-01T12:34:56Z. They are almost never equal! So Freya (almost) always will send the page to client, caching is effectively disabled.

So, the problem is that the server loses some time precision due to common format usage.

Currently I had to solve this problem with the following function: https://github.com/ForNeVeR/fornever.me/blob/096e17041822ee09d05c1769302defb32d9a6704/ForneverMind/Common.fs#L30-L40

@kolektiv
Copy link
Member

@ForNeVeR - many thanks! You're right, this is definitely something we should address, we need to make this easier in some form. That's possible, I'll take a look soon!

@panesofglass
Copy link
Contributor Author

Thanks, @ForNeVeR. I couldn't copy on my phone and forgot to come back and do it when I got back to my laptop.

@ForNeVeR
Copy link
Contributor

No problems, guys, I am always glad to help.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants