diff options
Diffstat (limited to 'vendor/curl/examples/https.rs')
-rw-r--r-- | vendor/curl/examples/https.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/vendor/curl/examples/https.rs b/vendor/curl/examples/https.rs new file mode 100644 index 000000000..2c34c4817 --- /dev/null +++ b/vendor/curl/examples/https.rs @@ -0,0 +1,23 @@ +//! Simple HTTPS GET +//! +//! This example is a Rust adaptation of the [C example of the same +//! name](https://curl.se/libcurl/c/https.html). + +extern crate curl; + +use curl::easy::Easy; +use std::io::{stdout, Write}; + +fn main() -> Result<(), curl::Error> { + let mut curl = Easy::new(); + + curl.url("https://example.com/")?; + curl.write_function(|data| { + stdout().write_all(data).unwrap(); + Ok(data.len()) + })?; + + curl.perform()?; + + Ok(()) +} |