jjlee / mechanize

Stateful programmatic web browsing in Python, after Andy Lester's Perl module WWW::Mechanize .
http://wwwsearch.sourceforge.net/mechanize/
618 stars 123 forks source link

Mechanize doesn`t work with cookies with an empty "path" attribute #31

Open dss09 opened 13 years ago

dss09 commented 13 years ago

If cookie has path attribute set to empty, mechanize thinks that it is incorrect and bypass them. But all modern browser (ie, firefox, chrome) work correctly with empty path attributes. I have a quick patch:

diff --git a/mechanize/_clientcookie.py b/mechanize/_clientcookie.py index 2ed4c87..2af778a 100644 --- a/mechanize/_clientcookie.py +++ b/mechanize/_clientcookie.py @@ -1291,6 +1291,9 @@ class CookieJar:

is a request to discard (old and new) cookie, though.

                 k = "expires"
                 v = self._now + v