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

[QUESTION] Can this library be used with a libcurl multi handle? c++ instructions? #84

Closed
eaziz4 opened this issue Nov 15, 2024 · 6 comments

Comments

@eaziz4
Copy link

eaziz4 commented Nov 15, 2024

I currently have a c++ custom http client that uses a curl multi handle for session reuse and to make my calls asynchronous. I want to utilize this library for all of my network calls since my use case is web scraping, but I'm wondering how I should go about that. I also don't see any instructions on how to include this for a c++ project. I would assume I could just replace including libcurl and instead link against the prebuilt static library for my os in my cmake project and that would be that? Any insight would be appreciated. Thanks!

@eaziz4 eaziz4 changed the title Can this library be used with a libcurl multi handle? [QUESTION] Can this library be used with a libcurl multi handle? Nov 15, 2024
@eaziz4 eaziz4 changed the title [QUESTION] Can this library be used with a libcurl multi handle? [QUESTION] Can this library be used with a libcurl multi handle? c++ instructions? Nov 15, 2024
@lexiforest
Copy link
Owner

lexiforest commented Nov 15, 2024

uses a curl multi handle for session reuse and to make my calls asynchronous

If you already uses the curl multi interface, I think you can continue using the same API.

I could just replace including libcurl and instead link against the prebuilt static library

Yes. check out this comment: lwthiker#80 (comment)

@eaziz4
Copy link
Author

eaziz4 commented Nov 15, 2024

I don't see any header files with the prebuilt libraries so I'm having trouble calling the curl_easy_impersonate() method. I tried to build the library natively on mac with the ./configure --enable-static but I got the following error configure: error: --enable-ech ignored: No ECH support found gmake: *** [Makefile:245: curl-8_7_1/.chrome] Error 1
I managed to build it with the configure script on ubuntu, but I also don't see where any header files would be for me to include so I'm getting the error error: use of undeclared identifier 'curl_easy_impersonate'
I'm not sure if I'm thinking of this the wrong way? On ubuntu I can successfully run this command in my terminal so it looks like curl is fine, but how I'm trying to include + link the libcurl-impersonate library is wrong curl-impersonate-chrome https://www.wikipedia.org

@lexiforest
Copy link
Owner

For macOS, you can download the prebuilt binaries on the release page. If you can not somehow call curl_easy_impersonate, you can still use environment vairables to indicate which version you want to impersonate.

@eaziz4
Copy link
Author

eaziz4 commented Nov 16, 2024

sorry for the basic questions but appreciate the help. Looks like I don't actually call that method as it happens internally. I just need to set the CURL_IMPERSONATE environment variables and everything should work automatically using libcurl like normal? Also I see on linux you can use LD_PRELOAD. Is there a mac alternative?

@eaziz4
Copy link
Author

eaziz4 commented Nov 16, 2024

My networking client is currently like this and I'm looking to be able to have custom headers in my requests. I'm still a little confused on how to accomplish that. https://gist.github.com/eaziz4/8d28d8c8a41c37205b77e0efbdedf29b

@lexiforest
Copy link
Owner

Also I see on linux you can use LD_PRELOAD. Is there a mac alternative?

ChatGPT is better at this question.

My networking client is currently like this and I'm looking to be able to have custom headers in my requests. I'm still a little confused on how to accomplish that. https://gist.github.com/eaziz4/8d28d8c8a41c37205b77e0efbdedf29b

What is your confusion exactly?

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