The goal of this task is to demonstrate HTTPS requests with authentication.
Implementations of this task should not use client certificates for this: that is the subject of another task.

 
extern crate reqwest;
 
use reqwest::blocking::Client;
use reqwest::header::CONNECTION;
 
fn main() {
    let client = Client::new();
 
    // reqwest uses strongly-typed structs for creating headers
    let res = client
        .get("https://www.example.com")
        .basic_auth("user", Some("password"))
        .header(CONNECTION, "close")
        .send()
        .unwrap();
 
    let body = res.text().unwrap();
 
    println!("{}", body);
}
 