curl-rust icon indicating copy to clipboard operation
curl-rust copied to clipboard

How to Build This Project On Ubuntu Linux

Open bhaijiyunus opened this issue 2 years ago • 3 comments

HI,

From the README it seems that the steps mentioned is to build on Window's system. Can you share or add how to build this project on Ubuntu Linux.

I just clone this project on Ubuntu Linux & simply did, but stuck with some error. image

Please help to build this project on Linux. FYI, I am new to the Rust world, just beginner.

Thanks, Yunus

bhaijiyunus avatar Feb 21 '23 05:02 bhaijiyunus

Welcome to Rust!

curl-rust is not an application that can be run, so you cannot use cargo run as there is no main function to run. Rather, curl-rust is a library that you can add as a dependency to your application to use. For example, you can create a new Cargo project using cargo new and then add curl-rust as a dependency to your project using cargo add curl. See also this section in The Cargo Book. You do not need to clone this repository in order to use it as a dependency in your code.

That said, if you just want to compile curl-rust by itself, you can do so with cargo build.

sagebind avatar Feb 21 '23 14:02 sagebind

Hey Sagebind,

Thanks for the response. Can we do client certificate based HTTPS API call with curl-rust? I have the end point which require the client certificate & key for authentication. I am able to test the API with simple curl command but looking for help to do in Rust.

Thanks, Yunus

bhaijiyunus avatar Feb 23 '23 15:02 bhaijiyunus

Sure, you can supply client certificates using the appropriate options in your request. curl-rust is a pretty thin wrapper around the libcurl C API, so generally any examples using libcurl you can find will translate pretty easily to Rust.

Pro tip: If you add the --libcurl flag to whatever curl command you want to replicate, and it will output a full C program that uses the libcurl API to perform a request equivalent to the CLI command. The methods on the Easy struct will generally have the exact same name as the C equivalent CURLOPT_* name.

sagebind avatar Feb 24 '23 02:02 sagebind