Skip to content

[Cookie] CookieContainer has issues with cookies set to a different path than the current request uri path #22372

Closed

Description

@javiercn

When a server sends back a cookie with a path different than the current request uri, CookieContainer throws an exception indicating that the path portion of the cookie is invalid. For example:

I believe this is due to the fact that an old version of the spec required any path on any cookie set by the server to be a prefix path of the current request URI. This doesn't seem to be the case in the latest version of the standard.

https://tools.ietf.org/html/rfc6265 (new version)
https://tools.ietf.org/html/rfc2109 (old version)

For reference, this works fine on all major browsers (Chrome, Firefox, Edge,...)

We ran into this on our authentication tests (that run the scenario mentioned above).

Limiting the path check in the code linked above to only the case when the cookie refers to an old version of the spec should be enough.

Activity

  1. javiercn commented on Jun 20, 2017

    @javiercn
    MemberAuthor
  2. davidsh commented on Jun 20, 2017

    @davidsh
    Contributor

    Current .NET Framework and .NET Core System.Net.Cookie does not handle RFC6265 yet.

    related to: https://github.com/dotnet/corefx/issues/18013

  3. changed the title [-]CookieContainer has issues with cookies set to a different path than the current request uri path[/-] [+][Cookie] CookieContainer has issues with cookies set to a different path than the current request uri path[/+] on May 8, 2018
  4. caesar-chen commented on May 11, 2018

    @caesar-chen
    Contributor

    Tracked in dotnet/corefx#29651.

  5. transferred this issue fromdotnet/corefxon Jan 31, 2020
  6. added this to the 3.0 milestone on Jan 31, 2020
  7. ghost locked as resolved and limited conversation to collaborators on Dec 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-System.Netenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions