CurlAsyncHTTPClient can not save cookie using pycurl.COOKIEJAR

Open
#2,485 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
backend

Research direction

Start by reproducing the issue with CurlAsyncHTTPClient, the prepare_curl_callback, and pycurl.COOKIEFILE/COOKIEJAR while following a 301 or 302 redirect. Trace how cookies are handled across the redirect and compare the final cookie jar with the response headers. Done means cookies are automatically saved and remain available after redirected requests.

Written by the indexing model from the issue text.

Description

httpclient

When I use CurlAsyncHTTPClient, it can not save cookies automatically, If I use the response header
to parse cookies myself, I can not get cookies if it's a 302/301 redirection, since the header is from the following url. How can I solve this problem?

my code is here:

`
def callback(curl):
curl.setopt(pycurl.COOKIEFILE, 'cookies.txt')
curl.setopt(pycurl.COOKIEJAR, 'cookies.txt')

http = CurlAsyncHTTPClient()
loop = asyncio.get_event_loop()
loop.run_until_complete(http.fetch(url, prepare_curl_callback=callback))
`

Dominant language
Python
Stars
22.2k
Forks
5.6k
Avg merge
3h 42m
Merged PRs (30d)
16

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.

More from tornadoweb/tornado

All issues in tornadoweb/tornado

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.