Hacker Read top | best | new | newcomments | leaders | about | bookmarklet login

libcurl is open source, I would imagine it'd not be difficult to make it "lie."


sort by: page size:

I’d suggest learning what libcurl is used for before throwing it out with the bath water ¯\_(?)_/¯

That's all waaaaayyyy way too much (and too technical) information to throw at someone. Nobody cares what libcurl is or what it does or if its given away for free or not. Keep it simple and to the point. 1) Sorry I can't help you and 2) here's who can. Thats it.

Someone should buy libcurl.com and make it return the source code to generate a request to itself. Bonus points for setting the same headers and options as the triggering request.

As someone else mentioned, this is actually built into Curl with the "--libcurl file.c" option.

You can use hurl which uses libcurl. You can save it to git and commit your hurl testa in the same repo.

curl has a --libcurl option which you can add to a curl command line, and then it'll generate a libcurl-using C code template for that same operation...

SEE ALSO: curl --libcurl

A lot of stuff depends on cURL/libcurl. IIRC, php these days has it enabled by default.

Libcurl is the only sane way I know to access the web from a C or C++ environment. I expect that most C programs needing to do web requests will link in libcurl.

Backblaze CTO here....

> I found libcurl difficult to use in 'C'

Umm.... it is literally the most simple API that could possibly exist? Here are the four lines in 'C' to fetch a URL:

curl_global_init(CURL_GLOBAL_SSL); // do this once inside of "main()"

CURL ch = curl_easy_init();

curl_easy_setopt(ch, CURLOPT_URL, "http://www.google.com");

int res = curl_easy_perform(ch);

I'm not sure how you could fetch a URL without initializing the library or specifying the URL?? It is like profoundly the most simple API that could possibly exist, I challenge you to specify any imagined API that is shorter or more simple or more straight-forward??!

The nice thing about the libcurl API is the above works and is the "base" concept, but if you want to specify something like a "network throttle" to be polite to other things on the network, you just start adding one extra line at a time to the above code:

curl_easy_setopt(ch, CURLOPT_MAX_SEND_SPEED_LARGE, (curl_off_t) (256 * 1024)); // 256 kbits/sec


Well, http://github.com/carllerche/curl-rust has been working great for me. Sure, it uses libcurl so it isn't pure Rust, but that doesn't make it not work :-)

I once saw him at a conference and he said curl even has an option to emit the C code to call libcurl and do the curl request you did.

I wish I had known this before.

However I mostly use wget from shell, and since I mostly work with python aiohttp/standard library/just writing the request on the socket.


Presumably so. You'd just need to compile the curl-impersonate for the appropriate browser you want to impersonate, and then link it in to a proxy that used libcurl for its https traffic.

How would it be? It's just using cURL to send a file to a URL.

this may not be as useful as it appears since different requests are for different different URLs, unless you redirect a request to libcurl.com

libcurl wrapper - https://github.com/sepisoad/jurl

json encoder/decoder - https://github.com/janet-lang/json

Not aware of any HTML parsers/traverses (if that's what you mean with "Crawler") but interfacing with C libraries is easy so grab any C library you'd like for that task.


Since there's no interactivity or logins or anything complex curl would probably do the job.

As a maintainer, I feel obligated to mention Hurl [1], a tool for testing HTTP with plain text and curl. It’s a wrapper around libcurl, in a single binary, with syntactic sugar for asserts. You can use it also like curl to give you an HTTP output.

[1] https://hurl.dev


Apart from the oodles of software that depends on curl/libcurl, my favourite thing is to "Copy as cURL" from a Chrome request.
next

Legal | privacy