aspnet / HttpAbstractions

[Archived] HTTP abstractions such as HttpRequest, HttpResponse, and HttpContext, as well as common web utilities. Project moved to https://github.com/aspnet/AspNetCore
Apache License 2.0
382 stars 194 forks source link

Add support for HttpCookie expires date format #1053

Closed MerickOWA closed 5 years ago

MerickOWA commented 5 years ago

The format generated by System.Web.HttpCookie when formated is non-standard, a mix between RFC1123 and RFC850 (At least as of .NET Framework 4.6.1)

The exact format string used is "ddd, dd-MMM-yyyy HH':'mm':'ss 'GMT'" as seen here

This doesn't quite match RFC1123 which is "ddd, d MMM yyyy H:m:s 'GMT'" as it uses dashes between the day, month, and year instead of spaces, but doesn't quite match RFC850 which is "dddd, d'-'MMM'-'yy H:m:s 'GMT'" as it uses a short day of the week instead of a longer form.

This change allows the SetCookieHeaderValue to properly parse a response from the an API using the older System.Web.HttpCookie class to generate a HTTP response.

Tratcher commented 5 years ago

Interesting find

  1. Can you add an entry in the tests as well?
  2. Please file a bug for tracking purposes.
  3. Can you rebase on the release/2.2 branch? That's the next branch we're shipping. Otherwise this won't release until 3.0.
MerickOWA commented 5 years ago

Yep, I'll close this one and reopen once I have the tests written and bug filed.