You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
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.
Repository owner locked and limited conversation to collaborators on Oct 5, 2026
Activity
sagebind commentedon Feb 21, 2023
Welcome to Rust!
curl-rust is not an application that can be run, so you cannot use
cargo runas there is nomainfunction 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 usingcargo newand then add curl-rust as a dependency to your project usingcargo 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.bhaijiyunus commentedon Feb 23, 2023
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
sagebind commentedon Feb 24, 2023
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
--libcurlflag 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 theEasystruct will generally have the exact same name as the C equivalentCURLOPT_*name.