Bug 25100 - Cookie Date Parsing Broken
Summary: Cookie Date Parsing Broken
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: System ()
Version: master
Hardware: PC Windows
: --- normal
Target Milestone: Untriaged
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2014-12-05 08:14 UTC by Sebastian
Modified: 2015-01-20 11:27 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Sebastian 2014-12-05 08:14:19 UTC
Both CookieContainer and CookieParser can't parse cookie dates correctly.

Example cookie:
XYZ=ABC; expires=Sat, 03 Dec 2016 12:46:30 GMT; path=/; Domain=.example.de

RFC 6265 shows how to parse cookies. -> http://tools.ietf.org/html/rfc6265#section-5.1.1

Maybe just implementing it at one place and not in CookieContainer and CookieParser would be sensible too.

https://github.com/mono/mono/blob/master/mcs/class/System/System.Net/CookieContainer.cs
https://github.com/mono/mono/blob/master/mcs/class/System/System.Net/CookieParser.cs
Comment 1 Marek Safar 2015-01-14 12:19:52 UTC
Mono matches .net implementation which is not fully RFC 6265 compatible
Comment 2 Sebastian 2015-01-17 14:41:49 UTC
Nice try, but no cookie.
I do not know about the compatibility of .net with RFC 6265. In any case the example cookie given in my bug report just parses fine in Microsoft .net (4.0.30319.18444).
Comment 3 Marek Safar 2015-01-20 11:27:28 UTC
Mono master has new cookie implementation. I used following to test it and it works now

var cc = new CookieContainer ();
cc.SetCookies (new Uri ("http://www.example.de"), "XYZ =ABC; expires=Sat, 03 Dec 2016 12:46:30 GMT; path=/; Domain=.example.de");