Skip to content

Instantly share code, notes, and snippets.

@jakswa
Last active June 23, 2023 21:53
Show Gist options
  • Save jakswa/866778bd6d207a102c3b85153212e102 to your computer and use it in GitHub Desktop.
Save jakswa/866778bd6d207a102c3b85153212e102 to your computer and use it in GitHub Desktop.
showing rustls error case
[package]
name = "rustls_conn_reset"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
error-chain = "*"
reqwest = { version = "0.11.8", default-features=false, features=["rustls-tls", "blocking"]}
# succeeds if you change it to:
# reqwest = { version = "0.11.8", features=["blocking"]}
use error_chain::error_chain;
error_chain! {
foreign_links {
Io(std::io::Error);
HttpRequest(reqwest::Error);
}
}
fn main() -> Result<()> {
let res = reqwest::blocking::get("https://itsmarta.com/google_transit_feed/google_transit.zip")?;
println!("Status: {}", res.status());
println!("Headers:\n{:#?}", res.headers());
Ok(())
}
Status: 200 OK
Headers:
{
"cache-control": "public",
"content-type": "application/zip",
"last-modified": "Wed, 19 Apr 2023 03:39:24 GMT",
"accept-ranges": "bytes",
"server": "Microsoft-IIS/8.5",
"x-aspnet-version": "4.0.30319",
"x-powered-by": "ASP.NET",
"x-frame-options": "SAMEORIGIN",
"date": "Fri, 23 Jun 2023 21:48:26 GMT",
"content-length": "18545429",
}
Error: Error(HttpRequest(reqwest::Error { kind: Request, url: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("itsmarta.com")), port: None, path: "/google_transit_feed/google_transit.zip", query: None, fragment: None }, source: hyper::Error(Connect, Custom { kind: Other, error: Os { code: 104, kind: ConnectionReset, message: "Connection reset by peer" } }) }), State { next_error: None, backtrace: InternalBacktrace { backtrace: None } })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment