Pylons / Pylons/webob

cookie header with multiple cookies and the same key is handled incorrectly

Open
#182 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
443
Forks
206
PR merge metrics
No merged PRs in 30d

Description

According to this SO answer and the referenced sections from the RFCs, a request can specify multiple values for a cookie. Currently, webob keeps only the last mentioned value, which is wrong, since the order of the cookies sent has the ones with highest priority first. If we were to keep only one version, it should be the first one.

Also, the documentation says that req.cookie is a MultiDict which currently is incorrect.

IMO, it should either keep being a simple dict, but keep the first value as it appears in the header, or become a MultiDict which for each key has a list of the cookie values as it appears in the header.

What do you think?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the req.cookie behavior described in the issue and docs/reference.txt around line 289, then review the linked RFC material and Stack Overflow answer. The issue names no implementation or test file and leaves the desired dict versus MultiDict behavior unresolved; done requires an agreed duplicate-cookie behavior and corresponding documentation.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.