[Mono-bugs] [Bug 353495] HttpWebResponse.LastModified isn't corrected for time zone

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sun Jan 13 03:21:34 EST 2008


User jdpurcell2 at yahoo.com added comment

--- Comment #1 from James Purcell <jdpurcell2 at yahoo.com>  2008-01-13 01:21:33 MST ---
How about changing MonoHttpDate.Parse to this:

internal static DateTime Parse (string dateStr)
    DateTime d = DateTime.ParseExact(dateStr, 
    return new DateTime(d.Ticks, DateTimeKind.Utc).ToLocalTime();

I see MonoHttpDate.Parse is also used in HttpWebRequest.IfModifiedSince (get)
and it apparently had the same bug (returning UTC time and labeling it local). 
So the above code would fix both HttpWebResponse.LastModified and

A few other things I should mention, in case they are important:

* The result of DateTime.ParseExact, at least with those params, has a
DateTimeKind of Unspecified in MS.NET, but Local in Mono.

* HttpWebRequest.IfModifiedSince (get) in MS.NET returns a DateTime with the
same DateTimeKind as was used to set it, but Mono converts the date/time to
string internally and loses this.

Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.

More information about the mono-bugs mailing list