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

Is there a way to add cookies to the request? #3

Closed
kafisatz opened this issue Oct 5, 2023 · 4 comments
Closed

Is there a way to add cookies to the request? #3

kafisatz opened this issue Oct 5, 2023 · 4 comments

Comments

@kafisatz
Copy link

kafisatz commented Oct 5, 2023

might be better to discuss this here instead of JuliaWeb/LibCURL.jl#103

@bluesmoon
Copy link
Owner

Cookies are just HTTP headers, so you will need to add your correctly formatted cookies to the CurlEasy handle using curl_add_headers

There is currently no higher level API, nor is there a cookie jar that will store cookies per domain and send them automatically on subsequent requests.

@kafisatz
Copy link
Author

kafisatz commented Oct 5, 2023

thanks. I will try this out.

I know very little about HTTP, but I noticed that, e.g. HTTP.jl, has different keywords for headers and cookies, thus I am not quite sure whether cookies are just headers.

@bluesmoon
Copy link
Owner

Yes, it's just a header (header name is Cookie). HTTP.jl is a higher level API that probably also maintains a cookie jar.

For the cookie value, you will have multiple cookies as a ; separated list of name=value. If the value has special characters, then it should be enclosed in quotes. eg:

Cookie: foo=bar; foo2="hello world"; name="bluesmoon"

@kafisatz
Copy link
Author

Thanks. This works like a charm.
Appreciate the explanation to add 'Cookie' as header name!.

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