• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.
When {DisplayTimeValues} is set to servertime, mailnotify script generates Date: header that is not RFC-compliant: time zone name is invalid, e.g. Date: Fri, 22 Dec 2006 06:59:47 Local.

I think it would be ok to always use UTC format for http and email in TWiki::Time::formatTime.


The date is entered in a mail several times, using different code. It's not clear which date you are referring to. Assuming it is the date in the mail header (the Date: field) that is giving offence, then that date is generated by TWiki::Time::formatTime. The expanded string is $email which expands identically to the $http format. This code claims
     # HTTP header format, e.g. "Thu, 23 Jul 1998 07:21:56 EST"
     # - based on RFC 2616/1123 and HTTP::Date; also used
     # by TWiki::Net for Date header in emails.
I modified the summary to reflect that this is not specific to mailnotify, but will impact any use of $http or $email in a call to TWiki::Time::formatTime.

Can you be more specific about what is giving offence? Is the the "Local" for the timezone? Which RFC are you referring to? How would you rewrite that code (in lib/TWiki/Time.pm) to work as you expect?

CC


i am referring to the message header field named "Date".

"Local" is not valid time zone specification according to rfc-2822. (and "GMT" is obsolete time zone specification, by the way.)

one possible solution is change line 214 of Time.pm to this:

    my $tz_str = ( $outputTimeZone eq 'servertime' ) ? '-0000' : '+0000';

(that is rfc2822-compliant way to say "Local").

another option is to force UTC time for message headers, as i initially suggested:

--- Time.pm.orig   2006-10-25 04:16:05.000000000 +0300
+++ Time.pm   2006-12-28 07:16:47.406250000 +0200
@@ -167,7 +167,9 @@
     $outputTimeZone ||= $TWiki::cfg{DisplayTimeValues};
 
     my( $sec, $min, $hour, $day, $mon, $year, $wday);
-    if( $outputTimeZone eq 'servertime' ) {
+    if( ( $outputTimeZone eq 'servertime' )
+        and ( $formatString !~ /http|email/i )
+    ) {
         ( $sec, $min, $hour, $day, $mon, $year, $wday ) =
           localtime( $epochSeconds );
     } else {
@@ -183,7 +185,7 @@
         # HTTP header format, e.g. "Thu, 23 Jul 1998 07:21:56 EST"
         # - based on RFC 2616/1123 and HTTP::Date; also used
         # by TWiki::Net for Date header in emails.
-        $formatString = '$wday, $day $month $year $hour:$min:$sec $tz';
+        $formatString = '$wday, $day $month $year $hour:$min:$sec +0000';
     } elsif ( $formatString =~ /iso/i ) {
         # ISO Format, see spec at http://www.w3.org/TR/NOTE-datetime
         # e.g. "2002-12-31T19:30:12Z"

-- als

OK, thanks. This is important to get right, so I think the fix should be in the next release. Unfortunately it just missed 4.1, but could make it for 4.1.1

Analysed, so setting to Actioning. Anyone please pick this up and apply the patch.

CC

OK, I did it slightly differently in the end, but to the same effect.

CC

ItemTemplate
Summary invalid Date: header in mailnotify
ReportedBy TWiki:Main.AlexanderSmishlajev
Codebase 4.0.5
SVN Range TWiki-4.1, Sun, 17 Dec 2006, build 12291
AppliesTo Engine
Component

Priority Normal
CurrentState Closed
WaitingFor

Checkins TWikirev:13398
TargetRelease minor
ReleasedIn 4.2.0
Edit | Attach | Watch | Print version | History: r11 < r10 < r9 < r8 < r7 | Backlinks | Raw View |  Raw edit | More topic actions
Topic revision: r11 - 2008-01-22 - KennethLavrsen
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback