-
Notifications
You must be signed in to change notification settings - Fork 18
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
Add a function to resolve URI references relative to a base URI #19
Conversation
Adds a new function, `resolvereference`, that resolves references between a base URI and a reference URI. This function attempts to comply with RFC 3986 Section 5.2 (https://tools.ietf.org/html/rfc3986#section-5.2). Closes JuliaWeb#18.
- Expand the documentation for resolvereference and add some examples for it. - Add resolvereference to the public documentation.
Change the version of `findprev` that `resolvereference` uses from `findprev(::AbstractChar, ::AbstractString, ::Integer)` to `findprev(::AbstractString, ::AbstractString, ::Integer)` (since the former has only been available since Julia 1.3).
I believe that this is what This will also close JuliaWeb/HTTP.jl#435 and JuliaWeb/HTTP.jl#626 and maybe #21 ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
…b#19) Co-authored-by: Fredrik Ekre <[email protected]>
Thanks for the review @fredrikekre, I've applied the changes you've suggested Edit: also, I've tried the example from #21 and I've confirmed that using |
But only if you used |
Yes, correct.
Possibly? If we aren't worried about breaking Base.joinpath(base::URI, parts...) = reduce(resolvereference, [base, parts...]) (or something similar). |
RFC 3986 Section 5.2 (https://tools.ietf.org/html/rfc3986#section-5.2) defines an method for resolving references relative to a base URI. This pull request adds the
resolvereference
function in order to achieve this functionality, which attempts to comply with the algorithm defined in Section 5.2.2.Closes #18.