Skip to content
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

net/http: FileServer returns 304 Not Modified on modified index pages #3414

Closed
gopherbot opened this issue Mar 28, 2012 · 4 comments
Closed

Comments

@gopherbot
Copy link

by haavid@falch.net:

What steps will reproduce the problem?
1. Create a new FileServer to serve from a directory containing an index.html file.
2. Load the directory "/" or file "/index.html" in a browser.
3. Make changes to index.html and reload it in the browser.

What is the expected output?
The new version of index.html.

What do you see instead?
The old version of index.html.

Which compiler are you using (5g, 6g, 8g, gccgo)?
6g

Which operating system are you using?
Linux x86_64

Which version are you using?  (run 'go version')
weekly.2012-03-22

Please provide any additional information below.
If you also add or remove files in the same directory as index.html, or similar
operations, the problem will not occur. The bug also depends on the browser having a
cached version, and sending a "If-Modified-Since" header in the request.
This is happening because checkLastModified() is being called a few lines too early in
serveFile(), causing it to check the modification time of the directory rather than the
index file.
Short fix has been submitted for review, but will wait until after Go 1.
@rsc
Copy link
Contributor

rsc commented Mar 28, 2012

Comment 1:

http://golang.org/cl/5901045/

Labels changed: added priority-later, removed priority-triage.

Status changed to Started.

@bradfitz
Copy link
Contributor

Comment 2:

Issue #3722 has been merged into this issue.

@bradfitz
Copy link
Contributor

Comment 3:

http://golang.org/cl/5901045/ reportedly has too few tests.
http://golang.org/cl/6300081/ reportedly has too many.

@bradfitz
Copy link
Contributor

Comment 4:

This issue was closed by revision 4596982.

Status changed to Fixed.

bradfitz added a commit that referenced this issue May 11, 2015
… for If-Modified-Since

««« backport c536f328c34b
net/http: use index.html modtime (not directory) for If-Modified-Since

Thanks to Håvid Falch for finding the problem.

Fixes #3414

R=r, rsc
CC=golang-dev
https://golang.org/cl/6300081

»»»
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
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