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

Crash when malformed uri #134

Open
gmg137 opened this issue Jan 2, 2020 · 3 comments
Open

Crash when malformed uri #134

gmg137 opened this issue Jan 2, 2020 · 3 comments
Labels
enhancement New feature or request

Comments

@gmg137
Copy link

gmg137 commented Jan 2, 2020

let res = surf::get("abc").recv_string(data).await;

As above, this will cause the program to crash.

@yoshuawuyts
Copy link
Member

Hi, thanks for raising! I've been thinking of how to solve this, and what we probably want is to be able to take TryInto<Url> as the type parameter. For that purpose I've filed:

This would require the usage to:

let res = surf::get("abc")?.recv_string(data).await;

Which would provide graceful error handling rather than directly panicking.


However the solution to your exact issue is to use a fullly-formed url. E.g.

let res = surf::get("http://my-domain.com/abc").recv_string(data).await;

@yoshuawuyts yoshuawuyts added the enhancement New feature or request label Jan 10, 2020
@wusyong
Copy link

wusyong commented Mar 17, 2020

Do you still want to take TryInto<Url> as parameters? I think this also applies to other methods. I could help a PR if this is what it prefers to be.

@goto-bus-stop
Copy link
Member

It looks like TryInto<Url> support is still waiting for a new release of the url crate.

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

No branches or pull requests

4 participants