GithubHelp home page GithubHelp logo

Comments (6)

kirelagin avatar kirelagin commented on June 1, 2024

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.

kirelagin avatar kirelagin commented on June 1, 2024

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.

mrkkrp avatar mrkkrp commented on June 1, 2024

What do other packages do? Let's say network-uri and uri-bytestring?

from modern-uri.

kirelagin avatar kirelagin commented on June 1, 2024

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.

kirelagin avatar kirelagin commented on June 1, 2024

(Here is the commit that implements this: Soostone/uri-bytestring@b893032.)

from modern-uri.

kirelagin avatar kirelagin commented on June 1, 2024

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 returns m (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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.