Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Troubled Proxy Parsing? #1538

Closed
Coding-Badly opened this issue May 4, 2022 · 0 comments · Fixed by #1539
Closed

Troubled Proxy Parsing? #1538

Coding-Badly opened this issue May 4, 2022 · 0 comments · Fixed by #1539

Comments

@Coding-Badly
Copy link
Contributor

Coding-Badly commented May 4, 2022

Hello Sean!

I believe this error handler is troubled.

I expected the call to reqwest::Proxy::http to return Err(InvalidIpv4Address) as the call to reqwest::Url::parse does.

fn main() -> Result<(), Box<dyn std::error::Error>> {
    println!();

    const BAD_NEWS: &str = "http://257.317.406.832";

    println!("{:?}", reqwest::Url::parse(BAD_NEWS));
    // Err(InvalidIpv4Address)

    println!("{:?}", reqwest::Proxy::http(BAD_NEWS));
    // Ok(Proxy(Http(http://http), None))

    println!();
    Ok(())
}

I think a not - trim_start - starts_with for http:// and https:// will solve the problem.

But, I believe the ideal solution is to remove the automatic error handling. In my mind adjusting the URL belongs exclusively to the library user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant