Closed Bug 934241 Opened 12 years ago Closed 12 years ago

Feeds should support the received date, ie store a Received trace header

Categories

(MailNews Core :: Feed Reader, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 28.0

People

(Reporter: alta88, Assigned: alta88)

Details

Attachments

(1 file, 4 obsolete files)

No description provided.
Attached patch receivedDate.patch (obsolete) — Splinter Review
Assignee: nobody → alta88
Attachment #826553 - Flags: review?(mkmelin+mozilla)
Comment on attachment 826553 [details] [diff] [review] receivedDate.patch Review of attachment 826553 [details] [diff] [review]: ----------------------------------------------------------------- ::: mailnews/extensions/newsblog/content/FeedItem.js @@ +305,5 @@ > openingLine + > 'X-Mozilla-Status: 0000\n' + > 'X-Mozilla-Status2: 00000000\n' + > 'X-Mozilla-Keys: ' + " ".repeat(80) + '\n' + > + 'Received: by Localhost; ' + (new Date().toString()) + '\n' + This won't get you a rfc2822 datestamp (just one fairly similar, that we maybe happen to parse). also maybe lowercase localhost
Attachment #826553 - Flags: review?(mkmelin+mozilla) → review-
2822 has been obsoleted by 5322, so i don't know if you mean that strictly. are you saying Date() is not 5322 compliant? the code defaults to this elsewhere if there's no valid date given: http://mxr.mozilla.org/comm-central/source/mailnews/extensions/newsblog/content/feed-parser.js#786 alternatively, what is your suggestion?
new Date().toString() outputs something like Wed Nov 06 2013 09:45:27 GMT+0200 (FLE Standard Time) .. while the rfc2822/rfc5322 date is something like Wed, 06 Nov 2013 09:45:27 +0200 I don't know what the easiest way to generate an rfc2822 is, but please fix the dateRescue too.
Attached patch receivedDate.patch (obsolete) — Splinter Review
looks like a roll your own necessity.
Attachment #826553 - Attachment is obsolete: true
Attachment #828113 - Flags: review?(mkmelin+mozilla)
Comment on attachment 828113 [details] [diff] [review] receivedDate.patch Review of attachment 828113 [details] [diff] [review]: ----------------------------------------------------------------- ::: mailnews/extensions/newsblog/content/feed-parser.js @@ +773,2 @@ > > + return FeedUtils.getValidRFC5322Date(ds); so, any point even bother testing if it's w3c or not? ::: mailnews/extensions/newsblog/content/utils.js @@ +743,5 @@ > + getValidRFC5322Date: function(aDateString) > + { > + let ds = aDateString ? new Date(aDateString) : null; > + ds = ds == "Invalid Date" || ds == null ? null : aDateString; > + let utcDate = (ds ? new Date(ds) : new Date()).toUTCString(); this is all very hard to read. i'd suggest just something like this (untested) let d = new Date(aDateString || new Date().getTime()); if (isNaN((ds.getTime())) // invalid date d = new Date();
Attachment #828113 - Flags: review?(mkmelin+mozilla) → review+
(In reply to Magnus Melin from comment #6) > Comment on attachment 828113 [details] [diff] [review] > receivedDate.patch > > Review of attachment 828113 [details] [diff] [review]: > ----------------------------------------------------------------- > > ::: mailnews/extensions/newsblog/content/feed-parser.js > @@ +773,2 @@ > > > > + return FeedUtils.getValidRFC5322Date(ds); > > so, any point even bother testing if it's w3c or not? > sure, an iso date can be converted by Date() and retain the publishers intent. > ::: mailnews/extensions/newsblog/content/utils.js > @@ +743,5 @@ > > + getValidRFC5322Date: function(aDateString) > > + { > > + let ds = aDateString ? new Date(aDateString) : null; > > + ds = ds == "Invalid Date" || ds == null ? null : aDateString; > > + let utcDate = (ds ? new Date(ds) : new Date()).toUTCString(); > > this is all very hard to read. i'd suggest just something like this > (untested) > > let d = new Date(aDateString || new Date().getTime()); > if (isNaN((ds.getTime())) // invalid date > d = new Date(); i'll see if i can't name that tune it in fewer notes..
(In reply to alta88 from comment #7) > sure, an iso date can be converted by Date() and retain the publishers > intent. Yes, but if it happens not to be anything date parsing can't handle, we'd still handle that later the same thing as with null, no?
(In reply to Magnus Melin from comment #8) > (In reply to alta88 from comment #7) > > sure, an iso date can be converted by Date() and retain the publishers > > intent. > > Yes, but if it happens not to be anything date parsing can't handle, we'd > still handle that later the same thing as with null, no? oh, i see. yes.
Attached patch receivedDate.patch (obsolete) — Splinter Review
updated for comments.
Attachment #828113 - Attachment is obsolete: true
Attachment #828640 - Flags: review+
Attached patch receivedDate.patch (obsolete) — Splinter Review
updated for comments.
Attachment #828640 - Attachment is obsolete: true
Attachment #828642 - Flags: review+
Keywords: checkin-needed
Status: NEW → RESOLVED
Closed: 12 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 28.0
argh, date needs to be utc but time needs to be local.
Attachment #828642 - Attachment is obsolete: true
Attachment #829527 - Flags: review+
checkin-needed for followup fix, Attachment #829527 [details] [diff].
Keywords: checkin-needed
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: