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: NameError in cookielib domain check
Type: Stage:
Components: Library (Lib) Versions: Python 2.4
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: rhettinger Nosy List: chadmiller, jjlee, rhettinger
Priority: normal Keywords: patch

Created on 2005-02-05 00:40 by chadmiller, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
cookielib.patch chadmiller, 2005-02-05 00:40 forward context diff
Messages (5)
msg47658 - (view) Author: Chad Miller (chadmiller) Date: 2005-02-05 00:40
Some cookies trigger this cookielib bug.

The bug is analogous to...

if a == ...:
    new_a = a + other_value

if new_a ... :
    foo()

But, "new_a" doesn't exist if the first condition
fails.  I included a lot of lines of context to show
that it's correct without having to see surrounding code.
msg47659 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2005-02-05 01:33
Logged In: YES 
user_id=80475

Applied to Lib/cookielib.py 1.5 and 1.4.2.1

Thanks for the patch.
msg47660 - (view) Author: John J Lee (jjlee) Date: 2005-02-06 02:44
Logged In: YES 
user_id=261020

Well spotted, Chad.  However, I am unable to see how this
bug ever causes an exception in practice: witness
test_cookielib.CookieTests.test_domain_return_ok().

The reason is that neither the request-host nor the
effective request-host ever start with a dot (and it
wouldn't matter if they did, for the purposes of this
method), so the code should be simplified as per patch 1117114.

Clearly, "Some cookies trigger this cookielib bug." implies
my reasoning above is incorrect.  Chad, did you really find
a cookie that triggers this, or do you just have a sharp
eye?  If the former, I'd be very pleased to see a test case
that triggers the bug (even if you can't provide running code).
msg47661 - (view) Author: Chad Miller (chadmiller) Date: 2005-02-06 03:17
Logged In: YES 
user_id=1212466

Yes, jjlee, I found this bug through experiment, not reading
code.  Specifically, a program I'm writing to interface to
Netflix' terrible queue interface discovered it.

I can provide you, jjlee, source code that excercises it, in
a week or so, after the code stabilizes again.  Should I
send it to you then?
msg47662 - (view) Author: John J Lee (jjlee) Date: 2005-02-06 13:48
Logged In: YES 
user_id=261020

Please do.  Thanks.

Looking again, I guess the problem must be that you have a
relative URL but no Host header (so the erhn is just
".local"), which I guess reveals another problem in
somebody's code.
History
Date User Action Args
2022-04-11 14:56:09adminsetgithub: 41527
2005-02-05 00:40:36chadmillercreate