Comments (3)
I’m not sure this exact functionality belongs in this crate, since there may be many variations of kind-URL-like things that people might want to parse.
My recommendation is to use this regexp or some equivalent hand-written parser: ^(.*?)(:\d+)?$
(where *?
is non-greedy repetition), then url::Host::parse
(which deals with IP addresses and IDNA).
from rust-url.
Perhaps HostAndPort
could implement FromStr
?
from rust-url.
I don’t have much to add beyond my previous response. The question is not what the API would look like, but what the exact behavior be and what is in scope for this crate. I think this is not in scope.
from rust-url.
Related Issues (20)
- Url::parse regression HOT 1
- Unable to encode + decode URL HOT 2
- Please could you export `SchemeType` or add `is_special()` method to `Url` HOT 1
- Add `ParseError.description() -> &'static str` method like already implemented on `SyntaxViolation` HOT 1
- non-special domain is never an `Ipv4` HOT 2
- DB_URL Password complexity is not supported. For example, the password is QAZwsx123@# HOT 2
- Question: How to convert `Host`/`Origin` to `URL`? HOT 4
- Bug: parser should not add trailing slash unconditionally HOT 9
- Ensure URL roundtrips for opaque paths
- set scheme with non-tab/newline C0 controls should result in no-op
- Origin port as an `Option<u16>`
- percent ("%) character must be percent-encoded as "%25" HOT 1
- Optional API to convert to http::Uri HOT 3
- Wrongly resolves ip to domain. HOT 2
- feature request: more complicated percent-encoding rules HOT 2
- feature: expose pathname publicly HOT 3
- Please add an option to not remove wellknown default ports from URL HOT 1
- Feature Proposal: Builder for Constructing New URL Instances from Parts HOT 2
- The program crashed after using the "join" function.
- Program Crash in fuzzing (assert failed in parse_path)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rust-url.