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
net/url: ResolveReference ignores Opaque value #66084
Comments
CC @neild |
I was able to reproduce the issue and from my research on the reference resolution algorithm specified in RFC 3986 section 5.2, the given example should, in fact, print The code for Lines 1114 to 1118 in b38b1b2
I believe the solution would be to check for this case before reaching the referenced piece of code and setting the URI parameters accordingly. |
…thod The current implementation doesn't resolve as per spec RFC 3986 the case where the base URL has an opaque value, and the reference doesn't have either a scheme, authority or path. Currently, this specific case falls back to the "abs_path" or "rel_path" cases, where the final path results of the base_path being resolved relatively to the reference's, but since the opaque value is stored independently, it needs a case of its own. The algorith for resolving references is defined in RFC 3986 section 5.2.2: https://www.rfc-editor.org/rfc/rfc3986.html#section-5.2.2 Fixes golang#66084
Change https://go.dev/cl/572915 mentions this issue: |
Go version
go version go1.21.1 darwin/arm64
Output of
go env
in your module/workspace:What did you do?
run the code https://go.dev/play/p/QndsQIeIA73
What did you see happen?
prints:
urn:#abcd
What did you expect to see?
print:
urn:uuid:deadbeef-1234-ffff-ffff-4321feebdaed#abcd
The text was updated successfully, but these errors were encountered: