User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:22.214.171.124) Gecko/20060508 Firefox/126.96.36.199 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:188.8.131.52) Gecko/20060508 Firefox/184.108.40.206 Even when a server responds to a XMLHttpRequest with status 304, the status property is 200. I want to be able to take additional action if the property is 200 (which should signify that the XMLHttpRequest fetched something that has been modified). Reproducible: Always Steps to Reproduce: 1. Create a XMLHttpRequest that hits a URL that returns status 304. 2. Get the status of the XMLHttpRequest Actual Results: The status was 200. Expected Results: The status should be 304.
Assignee: nobody → xml
Component: General → XML
Product: Firefox → Core
QA Contact: general → ashshbhatt
Version: unspecified → 1.8 Branch
Bug 305420 would seem to indicate that this used to work, at the very least. Are you sure the server is responding with a 304? A malformed response status will also result in a status==200, could that be the problem? http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/netwerk/protocol/http/src/nsHttpResponseHead.cpp&rev=220.127.116.11#166
Thank you for the quick response. I'm using the LiveHTTPHeaders Firefox extension to view the headers. The status line reported is: HTTP/1.x 304 Not Modified (In reply to comment #1) > Bug 305420 would seem to indicate that this used to work, at the very least. > Are you sure the server is responding with a 304? > > A malformed response status will also result in a status==200, could that be > the problem? > > http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/netwerk/protocol/http/src/nsHttpResponseHead.cpp&rev=18.104.22.168#166 >
does this happen if you don't have livehttpheaders installed? i've begun to distrust this creature, i'd suggest temporarily testing w/o it, or installing a logging proxy (there's one written in java which isn't too bad if you don't look at it for more than a few minutes).
Created attachment 227687 [details] test html file When I click the button, "status 200" gets printed out, never "status 304".
cache is transparent to its users, this is invalid IMO. (in 1.0.x XMLHttpRequest accidentally didn't use the cache, so the cache entry didn't mess with the server-sent status)
yeah, the current behavior is valid. it's not a bug that you can't know when the item was taken from the cache vs. being fetched over the network. at most, this is a feature request, which should be taken up with the w3c (email@example.com)
thanks for everyone's responses. whether this is a bug or not sounds like it's up for debate - the web server returns status 304 and the XMLHttpRequest says that the status is 200. not sure whether the 304 response should be reinterpreted as 200. i am interested in this because i'd like to be able to run some additional requests only if the status of the first GET is 200.
With the patch from bug 331825 you can work around this by setting the if-modified-since header field.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 12 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.