-
-
Notifications
You must be signed in to change notification settings - Fork 24
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
Idiomatic way of detecting valid URI? #57
Comments
Good question, I don't think quri provides such a validation function.
Correct me if I'm wrong.
Nyxt did implement its own though:
https://github.com/atlas-engineer/nyxt/blob/2.2.0/source/urls.lisp#L76
I don't think it's exactly RFC 3986, so we might have to update it a little.
Then shall we merge it into quri?
|
snunez1
changed the title
Idomatic way of detecting valid URI?
Idiomatic way of detecting valid URI?
Sep 24, 2021
That would work well, thanks. |
Just came back to see if this was closed. Although the Nyxt implementation and RFC 3986 are unquestionably better solutions, perhaps a quick & dirty checking for http(s) would suffice? That's what I've been using and so far it does the job. |
Sorry, I haven't had time to dedicate to quri.
Pull requests are welcome!
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is there a way of detecting a valid URI given a string representation?
The use case is this:
I have a function that takes multiple input sources and dispatches on the type; stream, string, pathname at the moment. For URLs we have to turn them into a stream at the function invocation level with (dex:get ... :want-stream t) and this is getting tedious as the number of internet based input sources increases.
The challenge is in passing the URI as a string: how do we know that the string is for input itself or designates a URI to retrieve? For this purpose, it is sufficient to detect a valid URI, say RFC 3986, and if it is get a stream via dex, and if it's not a valid URI use the string as input. Something like
valid-uri-p
or similar would be perfect, but I didn't see anything like this in the code.Is there any way of doing this with quri?
The text was updated successfully, but these errors were encountered: