Closed Bug 116598 Opened 23 years ago Closed 22 years ago

document.lastModified doesn't show the "date" header if no "last-modified" header is sent

Categories

(Core :: DOM: Core & HTML, defect, P5)

defect

Tracking

()

RESOLVED FIXED
mozilla1.4beta

People

(Reporter: primorec, Unassigned)

References

()

Details

(Whiteboard: [HAVE FIX])

Attachments

(1 file, 1 obsolete file)

From Bugzilla Helper: User-Agent: Mozilla/4.72 [en] (X11; U; Linux 2.2.14-5.0 i686) BuildID: Mozilla 0.9.7 Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.7) Gecko/20011221 The following java script code is not interpreted correctly. Mozilla 0.9.7 shows: The document was last modified: January 1, 1970 GMT. instead The document was last modified: December 22, 2001 GMT. MSIE shows: The document was last modified: 12/22/01 10:03:33. offending java script code: <script language="javascript"> var lm = document.lastModified; document.write("<BR>The document was last modified: <B>" +lm+ "</B>.") </script> Reproducible: Always Steps to Reproduce: 1. click with mozilla 0.9.7 on this link http://www.furlan.org/misc/tips_and_tricks/Sony_Vaio_PCG-FXA32/step_by_step_instructions.html Actual Results: Date is not shown correctly Expected Results: I should see the correct date NS4.X on Linux has the same problem
document.lastModified is a DOM feature -- sending off to our DOM friends, please triage as needed.
Assignee: rogerl → jst
Status: UNCONFIRMED → NEW
Component: Javascript Engine → DOM HTML
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.
Priority: -- → P5
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...)
Target Milestone: mozilla1.2beta → mozilla1.3alpha
Target Milestone: mozilla1.3alpha → mozilla1.3final
*** Bug 198205 has been marked as a duplicate of this bug. ***
Mass-reassigning bugs.
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?
IE appears to return the current time. I set my calendar to 4/1/2003 and did a wget on devedge.netscape.com (which doesn't have modified times) HTTP/1.1 200 OK Server: Netscape-Enterprise/6.0 AOL Date: Fri, 25 Apr 2003 13:50:19 GMT Vary: Accept-language Content-type: text/html Connection: close javascript:document.lastModified gave in IE6 04/01/2003 09:51:19 Which is the date setting on my PC in my local timezone (Eastern)
This should make us compatible with IE.
Attachment #62647 - Attachment is obsolete: true
Attachment #121740 - Flags: superreview?(bzbarsky)
Attachment #121740 - Flags: review?(caillon)
Attachment #121740 - Flags: superreview?(bzbarsky) → superreview+
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: 22 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.

Attachment

General

Created:
Updated:
Size: