amphp / amphp/http-server-static-content
Issue with If-Modified-Since HTTP header
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 22
- Forks
- 12
- PR merge metrics
- No merged PRs in 30d
Description
Hi there 👋🙂
I noticed that when I modify a file served by DocumentRoot, I have to force the refresh in my browser to actually see the updated file.
After some debugging, I think there is an inversion in the order of comparison:
https://github.com/amphp/http-server-static-content/blob/2.x/src/DocumentRoot.php#L304C49-L304C66
The code returns "unmodified" status if $mtime > $ifModifiedSince, but if I understand correctly it's the opposite, if $mtime > $ifModifiedSince it means that the file has been updated. (Corresponding doc for reference)
I'm currently running version 1, but as far as I can see the bug is present on branch 2 as well.
It doesn't seem to be covered by tests.
By the way, thank you very much for your work on this awesome library 😊
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at src/DocumentRoot.php around line 304 and compare the If-Modified-Since handling with the linked HTTP header documentation. Add coverage for a modified DocumentRoot file, then run the relevant test suite; done means updated files are not reported as unmodified while unchanged files still are.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100