Comments (6)
I have to admit that the first part of my text ignores the elephant in the room: RFC 3986 was obsolete by WHATWG URL and the latter very explicitly prohibits [
and ]
in the query component.
But the second part still stands and, I imagine, there are plenty of people who are not aware of the fact that their square brackets are now definitely illegal :/.
from modern-uri.
One alternative would be to redefine “modern URI” to mean “modern URL according to WHATWG”. Then disallowing the square brackets is the right behaviour indeed, but I am not sure if this library is actually in compliance. E.g. the parsing algorithms is almost certainly not. Here is the basic URL parser specification for reference.
from modern-uri.
What do other packages do? Let's say network-uri
and uri-bytestring
?
from modern-uri.
I believe, network-uri
implements the RFC naively (i.e. fails on []
).
uri-bytestring
is kinda weird in that it only parses &
-separated key=value
pairs, BUT it uses a customisable predicate for testing the validity of characters and ships two predefined tests, with laxURIParserOptions
allowing unencoded brackets in queries.
from modern-uri.
(Here is the commit that implements this: Soostone/uri-bytestring@b893032.)
from modern-uri.
I realise this issue is a bit cumbersome, since I was doing the research as I was writing it and changed my opinion on the matter a couple of times in the process.
Currently, I think there are two independent actionable items:
- To justify “modern” in the name of this package, update it to follow WHATWG URL instead of the ancient RFC (this might or might not require renaming the package, since the new standard deprecates the term URI 🙂). As a side-effect, this will make it easier to motivate not allowing
[]
. - To account for the state of the real world, adjust the interface to allow the user to override the behaviour that disallows
[]
, e.g. a function that returnsm (Either Url Url)
so that the users have a way of supporting legacy inputs with unencoded brackets but, at the same time, are forced to explicitly admit that this is happening and maybe warn their users.
from modern-uri.
Related Issues (20)
- How to concatenate parts of URI? HOT 7
- Use newtypes instead of `RText` HOT 2
- File URIs are not parsed HOT 2
- A URI with a Query such as '?&height=500&width=500' cannot be parsed HOT 2
- Expose parsers of certain classes of URIs HOT 5
- Support for "data:" URI scheme? HOT 12
- Port numbers validation HOT 5
- Add an `updateQueryParams` function HOT 3
- Doesn't build with GHC-9.0
- Compatibility with bytestring 0.11 HOT 2
- Trailing slashes for URLs with no path HOT 2
- Hashable instance HOT 1
- relativeTo and quasi-quotation
- GHC 9.2/TemplateHaskell 2.18 HOT 1
- Bug parsing numeric subdomains HOT 1
- appending paths to urls HOT 3
- Colons in path are escaped HOT 2
- `mkURI` fails to correctly parse uri when hostname contains a "_" HOT 2
- Empty path with a trailing slash HOT 2
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 modern-uri.