-
-
Notifications
You must be signed in to change notification settings - Fork 273
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 starting with quotation marks get mangled #414
Comments
If I understand correctly, this is what the RFC states:
DQUOTE( |
Well, I don't really know what to tell you. If I look at the headers requests is sending, they have quotation marks at the start/front, as do the values shown in browser dev tools. I found this while investigating a larger issue where a certain POST request just wouldn't go through, and comparing curl_cffi and requests in Fiddler, this was the only difference. |
Does your cookie value happen to contain spaces, semicolons or any other
characters that mentioned above?
Again, please follow the issue template and include a reproducible snippet,
otherwise it wastes both your and my time in this Q&A style discussion.
来自手机回复
vevv ***@***.***>于2024年10月22日 周二22:54写道:
… Well, I don't really know what to tell you. If I look at the headers
requests is sending, they have quotation marks at the start/front, as do
the values shown in browser dev tools.
I found this while investigating a larger issue where a certain POST
request just wouldn't go through, and comparing curl_cffi and requests in
Fiddler, this was the only difference.
—
Reply to this email directly, view it on GitHub
<#414 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAH4ZX5DYBRUYBMGQUWJHFTZ4ZRIRAVCNFSM6AAAAABQMTJVCOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMRZGUYTEMJVHA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
I can't easily provide any example snippets, it's authenticating with a service. I can confirm that adding the quotes in Fiddler to the curl request makes it work, it's the only difference. And I apologize for not following the template, but it's the third time today where I ran into an issue I can't easily debug (because I do not control the remote server), where it's curl_cffi silently modifying requests in a way that prevents them from working, it's extremely frustrating. |
from curl_cffi import requests
session = requests.Session()
resp = session.get('https://httpbin.org/cookies/set/test/"quoted"')
print(f'httpbin: {resp.json()} <-- appears quoted correctly')
print(f'resp: {resp.cookies} <-- appears quoted correctly')
print(f'store: {session.cookies} <-- appears quoted correctly')
print()
resp = session.get('https://httpbin.dev')
print(f'store: {session.cookies} <-- after making a request (even to an unrelated site), it gets mangled')
print()
resp = session.get('https://httpbin.org/cookies/set/test2/unquoted')
print(f'resp: {resp.cookies} <-- incorrect')
print(f'store: {session.cookies} <-- incorrect')
print()
resp = session.get('https://httpbin.org/cookies')
print(f'httpbin: {resp.json()} <-- incorrect') This demonstrates it well. |
I see. It seems that the escaped quoted cookies got unquoted twice. Something like this is needed. |
v0.7.3:
Cookies which start with quotation marks, e.g.
"value"
, get stripped and are sent asvalue
.The text was updated successfully, but these errors were encountered: