reqwest icon indicating copy to clipboard operation
reqwest copied to clipboard

IncompleteMessage when getting URL

Open troelsarvin opened this issue 2 years ago • 2 comments

The following code results in Result: HTTP error: reqwest::Error { kind: Request, url: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("aarsdalehoeker.dk")), port: None, path: "/", query: None, fragment: None }, source: hyper::Error(IncompleteMessage) }

fn main() {
    let url="https://aarsdalehoeker.dk/";
    let resp = reqwest::blocking::get(url);
    let res = match resp {
        Ok(_) => "ok".to_string(),
        Err(e) => format!("HTTP error: {:?}", e).to_string()
    };
    println!("Result: {}", res);
}

Curl is OK with the URL, and so is both Firefox and Chrome, so I suspect it's a bug in reqwest (or one of the libraries which reqwest relies on).

OS: Fedora 35. Rust version 1.57 in 2021 edition mode.

troelsarvin avatar Dec 26 '21 21:12 troelsarvin

Visiting https://aarsdalehoeker.dk/ with curl or Chrome involves a redirect to https://www.aarsdalehoeker.dk/ If I use url *www.*aarsdalehoeker.dk in my code instead, things work. However, according to the documentation, reqwest is supposed to follow a single redirect like this. So I wonder why reqwest isn't following the redirect in this case.

troelsarvin avatar Jan 01 '22 17:01 troelsarvin

https://www.nordvigbb.dk/ is another URL which results in IncompleteMessage. That URL does not involve a redirect.

troelsarvin avatar Jan 01 '22 21:01 troelsarvin