Closed Bug 116598 Opened 19 years ago Closed 17 years ago
.last Modified doesn't show the "date" header if no "last-modified" header is sent
document.lastModified is a DOM feature -- sending off to our DOM friends, please triage as needed.
Assignee: rogerl → jst
Status: UNCONFIRMED → NEW
Ever confirmed: true
QA Contact: pschwartau → stummala
Summary: "document.lastModified" not correctly shown → "document.lastModified" not correctly shown
The reason document.lastModified is incorrect in this case is that the server doesn't send the information (the "last-modified" HTTP header), so there's no way for mozilla to know when the file was last modified. IE seems to use the "date" header if the "last-modified" header isn't sent, mozilla could do that too, but that's WRONG! That's not what document.lastModified should say. The "date" header just contains the current date (AFAIK), which has nothing to do with the last modified time. What do other people think? I'm Futuring this for now, but if someone has a good reason to make document.lastModified contain the value of the "date" header if there's no "last-modified" header let me know and I'll "fix" this. I already have a patch (will attach).
Severity: major → minor
OS: Linux → All
Hardware: PC → All
Summary: "document.lastModified" not correctly shown → document.lastModified doesn't show the "date" header if no "last-modified" header is sent
Target Milestone: --- → Future
Note that IE gives document.lastModified in this case in the local timezone/locale, whereas this patch makes mozilla simply return the value of the header which in this case contains the date in GMT.
The following URI says that the 'Date' header field is for the creation date of the object OR the last modified date. Obviously it would be better to keep these two things discrete, but if 'Last-Modified' is missing, I think it should be assumed that 'Date' is the last modified date. http://www.w3.org/Protocols/HTTP/Object_Headers.html#date
Attachment #62647 - Attachment description: Make document.lastModified contain the "data" header if no "last-modified" header is sent. → Make document.lastModified contain the "date" header if no "last-modified" header is sent.
yes... that is the right way to go
With some difinition of "right", yeah :-)
Comment on attachment 62647 [details] [diff] [review] Make document.lastModified contain the "date" header if no "last-modified" header is sent. r=caillon
Attachment #62647 - Flags: review+
Status: NEW → ASSIGNED
Whiteboard: [HAVE FIX]
Target Milestone: Future → mozilla1.2beta
Tghat URL actually says: Creation date of object. (or last modified, and separately have a Created: field?) Note the ? - this was obviously for a draft/white paper/etc rfc2616 makes it clear that these are not the same - date-Age (if present) may give you something closer, but if the last modified header isn't present, then theres not much you can do about it.
OTOH, if IE does it.... I still think its wrong - we should just return null, or something. Does IE do this for http/1.1 responses? Does it take the Age header into account? http://www.xs4all.nl/~ppk/js/lastmod.html suggests that IE uses today's date, while ns/opera use January 1 1970. IS this true (ie if the date string was from yesterday) Is this just a different fallback string? (In which case I prefer our one...)
*** Bug 198205 has been marked as a duplicate of this bug. ***
Assignee: jst → dom_bugs
Status: ASSIGNED → NEW
What if the Date header value is used only when there is no Last-Modified header AND there is no Content-Length header? It seem that just about every http server sends a Content-Length except for CGI/dynamic content, and in the case of CGI, using the Date header as the Last-Modified header seems appropriate. But just about anything is better than "January 1, 1970 GMT". If the using the Date header is wrong, how about using null, undefined, "unknown", or an empty string?
Anyone have a problem with just reporting the date if no last-modified header is returned? "January 1, 1970 GMT" just looks bad. This is for IE compatibility if nothing else. I ran into this when someone wondered why we handled http://webmaster.info.aol.com/ differently.
Bob, that sounds reasonable to me. Does IE use the date header, or does it just return the current time, if so, in what timezone?
This should make us compatible with IE.
Attachment #62647 - Attachment is obsolete: true
Attachment #121740 - Flags: superreview?(bzbarsky) → superreview+
18 years ago
Attachment #121740 - Flags: review?(caillon) → review+
Status: NEW → ASSIGNED
Target Milestone: mozilla1.3final → mozilla1.4beta
Comment on attachment 121740 [details] [diff] [review] Make document.lastModified = now when no last-modified header is sent. Requesting 1.4b approval, this matters for compatibility with IE, not a huge issue, but should IMO be fixed.
Attachment #121740 - Flags: approval1.4b?
Comment on attachment 121740 [details] [diff] [review] Make document.lastModified = now when no last-modified header is sent. a=asa (on behalf of drivers) for checkin to 1.4b
Attachment #121740 - Flags: approval1.4b? → approval1.4b+
Fix checked in. FIXED.
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Component: DOM: HTML → DOM: Core & HTML
QA Contact: stummala → general
You need to log in before you can comment on or make changes to this bug.