dubyte / dir2opds

Serve an OPDS based on a directory
GNU General Public License v3.0
59 stars 12 forks source link

HTTP header Last-Modified not updated #20

Closed thenktor closed 2 months ago

thenktor commented 2 months ago

Hi,

when trying dir2opds I had the following issue:

Result:

Last-Modified: Thu, 13 Jun 2024 07:27:11 GMT
Date: Thu, 13 Jun 2024 07:47:14 GMT

Actually Last-Modified should show ca. 07:47:00 GMT

That may be the cause of problem with the apps not updating their listing.

dubyte commented 2 months ago

Thanks @thenktor I will check this.

dubyte commented 2 months ago

I reproduced what you mentioned, if you load a directory and changes happen it is not refreshed. Unfortunally. I think I dont have much to do becasue base on my tests when you navegate to different folders and return to the initial directory where a change should be reflected the apps are not calling the server. So even if last-modified were updated the app wont read it.

So they are using their cache. Without calling the server. That happen on my tests using moon reader. Could you check on your side? When passing -debug it will print the paths that are being requested to the server.

Thanks and let me know what are the results of your tests.

thenktor commented 2 months ago

I've tested again with Cantook, because it has a "reload" possibility. When reloading it sends a request to the server, that can be seen with -debug option. But the updated listing is not shown in the app. Tried several times, no luck. After restarting dir2opds and reloading again in Cantook it shows the new listing.

I'd just set the Last-Modified header to the current time, because I'd not expect much traffic and a need for any caching in the clients. Still better than delivering obviously wrong outdated values.

To disable all caching also these may be needed:

Cache-Control: no-cache, no-store, must-revalidate
Pragma: no-cache
Expires: 0
dubyte commented 2 months ago

I can create a branch with an option that adds this headers on every response. So you can test if this would resolve the issue.

dubyte commented 2 months ago

Ok there a branch @thenktor add_no_cache, it does not includes pragma because is deprecated. Please test on that branch.

thenktor commented 2 months ago

I've tested the no-cache argument with iOS apps (Cantook and PocketBook): works for both:

👍

dubyte commented 2 months ago

Thanks you for testing.