This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: CookieLib: MozillaCookieJar.py uses case-sensitive regex to validate cookies file
Type: behavior Stage: patch review
Components: Library (Lib) Versions: Python 3.9, Python 3.8, Python 3.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: ashleyharvey
Priority: normal Keywords: patch

Created on 2019-08-14 20:14 by ashleyharvey, last changed 2022-04-11 14:59 by admin.

Pull Requests
URL Status Linked Edit
PR 15673 open ashleyharvey, 2019-09-04 19:13
PR 15679 closed ashleyharvey, 2019-09-04 19:17
PR 15680 closed ashleyharvey, 2019-09-04 19:29
Messages (2)
msg349743 - (view) Author: Ashley Harvey (ashleyharvey) * Date: 2019-08-14 20:14
I'm on macOS 10.14.6, wget 1.20.3, python 2.7.

Command line:
$ wget --save-cookies cookies.txt --keep-session-cookies --post-data
'username=myUserName&password=myPassword' --delete-after <url>

Line 39 of _MozillaCookieJar.py (cookielib) shows it looking for 'magic_re = "#( Netscape)? HTTP Cookie File"' in order to validate the supplied cookies file.  Unlike cURL, wget however, produces a cookies file that begins with "# HTTP cookie file".  Note the lower-case c and f.  I reported this as a bug to the wget team who looked for the spec to say that that line must follow a certain format and couldn't find any such mention.  (See: https://savannah.gnu.org/bugs/?56755)

The lack of upper-case c and f cause cookielib to choke and stop processing
the cookies file, and so here I am reporting it as a bug that the regex is case-sensitive.
msg349744 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2019-08-14 20:21
(removing the macOS component since presumably this behavior is not platform-dependent)
History
Date User Action Args
2022-04-11 14:59:19adminsetgithub: 82039
2019-09-04 21:02:38ned.deilysetversions: - Python 2.7, Python 3.5, Python 3.6
2019-09-04 19:29:30ashleyharveysetpull_requests: + pull_request15340
2019-09-04 19:17:10ashleyharveysetpull_requests: + pull_request15339
2019-09-04 19:13:27ashleyharveysetkeywords: + patch
stage: patch review
pull_requests: + pull_request15338
2019-09-04 03:28:13ashleyharveysetversions: + Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9
2019-08-14 20:22:14ned.deilysetnosy: - ned.deily
2019-08-14 20:21:48ned.deilysetnosy: - ronaldoussoren
messages: + msg349744
components: - macOS
2019-08-14 20:14:54ashleyharveycreate