Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cookies fail #18

Open
arobertn opened this issue Oct 9, 2012 · 1 comment
Open

Cookies fail #18

arobertn opened this issue Oct 9, 2012 · 1 comment

Comments

@arobertn
Copy link

arobertn commented Oct 9, 2012

I experienced the following issues with cookies:

  1. "Set-Cookie" not searched for in headers case-insensitively. Not sure what the RFCs say, but reality is reality and some servers send "set-cookie".

  2. Some kind of confusion in the Response object code between 'cookies' and 'cookiesjar' led to cookies not being made available in resp.cookiesjar. (Found with resp = hurl.post(...)).

  3. URL-encoding the ('+' and '=' characters in) a cookie value was causing problems with a server that was not expecting the value to be altered.

This patch fixes these, but I am not submitting it formally since I'm not sure how you want to clean up (2), and (3) is not a final solution either.

--- core.py~ 2012-10-09 11:12:41.000000000 -0400
+++ core.py 2012-10-09 12:11:44.373158314 -0400
@@ -519,7 +519,8 @@
## if isinstance(value, unicode):
## value = value.encode("utf-8")
name = urllib.quote_plus(name)

  •            value = urllib.quote_plus(value)
    
  •            #value = urllib.quote_plus(value)
             chunks.append('%s=%s;' % (name, value))
         if chunks:
             opener.setopt(pycurl.COOKIE, ''.join(chunks))
    

    @@ -621,14 +622,16 @@
    # Response headers
    self._headers = None

     # Cookies dictionary
    
  •    self._cookies = None
    

    +# self._cookies = None
    if isinstance(cookies, CookieJar):
    self._cookies_jar = cookies
    elif isinstance(cookies, (TupleType, DictType)):
    self._cookies_jar = to_cookiejar(cookies)
    else:

  •        self._cookies_jar = None
    
  •        self._cookies_jar = CookieJar()
    
  •    self._cookies = self._cookies_jar
    
     # Seconds from request start to finish
     self.request_time = None
    
@Lispython
Copy link
Owner

Thanks for feedback, I will think over these problems.

Can you creat patch as pull request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants