Skip to content
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

Revisiting relative IRI resolution API #31

Open
lo48576 opened this issue Sep 16, 2022 · 1 comment
Open

Revisiting relative IRI resolution API #31

lo48576 opened this issue Sep 16, 2022 · 1 comment
Labels

Comments

@lo48576
Copy link
Owner

lo48576 commented Sep 16, 2022

Re: Incompleteness of reference resolution algorithm in RFC 3986 from Roy T. Fielding on 2022-08-25 (uri@w3.org from August 2022)

Summary (IIUC):

  • IRI contexts are hierarchical or not hierarchical, depending on the schema.
    • IRIs like foo:bar is not hierarchical.
  • Relative references (other than same-document fragments) are meaningless against non-hierarchical IRIs.
  • Relative IRI resolutions will result in valid IRIs if it is meaningful, but will result in invalid IRIs if meaningless.
    • In other words, result of relative IRI resolutions are not intended to be always valid as IRIs.
  • Result of meaningless reference resolutions would not be worth defining as IRIs.

Thus, the possible choices are:

  • Return an error for non-hierarchical IRIs.
    • However, the spec does not strictly describe what is considered "hierarchical name space" and what is not. It seems like it should be defined by schema.
  • Return a plain string as a resolution result.
    • I think this could be insecure, since for some special inputs it can result in IRI-like string with unexpected authority component.
  • Return an IRI modified to be valid-ish, and provide predicates to check it is the expected result.
    • Current implementation.
@lo48576
Copy link
Owner Author

lo48576 commented Sep 16, 2022

I think the current API is not so bad, but I can add a note to say "don't resolve against an IRI that does not use hierarchical name space. It is your responsibility to check that (using ensure_rfc3986_normalizable())!".

Another thing to consider is, what is the reasonable fallback for "meaningless" resolution?

Currently provided modes are "prepend /. anyway" mode and "prepend /. if absolute, or do nothing if relative".
I think they will be enough, but is there any other algorithms that are used widely in real world?

@lo48576 lo48576 added the design label Feb 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant