Skip to content
New issue

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

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

Already on GitHub? # to your account

Uri parses "example.com" but fails to parse "example.com/foo" #311

Closed
jsdw opened this issue Apr 27, 2019 · 2 comments
Closed

Uri parses "example.com" but fails to parse "example.com/foo" #311

jsdw opened this issue Apr 27, 2019 · 2 comments

Comments

@jsdw
Copy link

jsdw commented Apr 27, 2019

The title says it all really; I am using http::Uri to parse things that look like URIs, and I was surprised to find that "example.com" parses successfully, but "example.com/foo" fails with an InvalidUri(InvalidFormat) error. "http://example.com/foo" parses successfully.

Is this deliberate (there could be a subtlety I'm missing here) or a bug?

This is using http 0.1.17.

@jsdw
Copy link
Author

jsdw commented Apr 27, 2019

Looking at the spec linked elsewhere, I can see why this is the case I believe (though I'd be interested to hear your views before closing the issue).

My intention was to use this Uri object to parse things that look like HTTP URLs, for example:

http://foo.com/bar
127.0.0.1:8080
foo.com/bar
foo.com:8080/bar
/bar

Perhaps this is not the right crate for the job? I tried using the url crate initially, but that is far broader in scope and I was looking for something restricted to HTTP URLs, which led me here.

@jsdw
Copy link
Author

jsdw commented Apr 27, 2019

I ended up using the url crate but adding some rules to handle the not-quite-urls I wanted to deal with. It feels like this Uri object was not really intended for my use case. Sorry for the noise :)

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

No branches or pull requests

1 participant