-
Notifications
You must be signed in to change notification settings - Fork 292
CP-49953: Remove parse_uri, switch to using Uri module instead' #5726
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
CP-49953: Remove parse_uri, switch to using Uri module instead' #5726
Conversation
(* Request-Line = Method SP Request-URI SP HTTP-Version CRLF *) | ||
let uri, query = Http.parse_uri uri in | ||
let uri_t = Uri.of_string uri in | ||
let uri = Uri.path uri_t in |
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.
Is this uri
the same as the one on L368? If so, why converting it back?
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.
I would trust Uri
to create standard-conforming URLs. One caveat though and why this needs testing:
utop # let t = Uri.of_string "https://foo.bar" in Uri.path t;;
- : string = ""
This might be surprising and you could have expected "/".
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.
Is this
uri
the same as the one on L368? If so, why converting it back?
L368's uri
is the full path+query.
Here it's split into only the path, L381 further gets only the query part.
Couldn't come up with a more precise name so I just shadowed the other (as it was done before)
for example:
utop # let t = Uri.of_string "https://foo.bar/dir1/dir2?k1=v1" in Uri.path t;;
- : string = "/dir1/dir2"-
utop # let t = Uri.of_string "https://foo.bar/dir1/dir2?k1=v1" in Uri.query t;;
- : (string * string list) list = [("k1", ["v1"])]
453a911
to
7b97685
Compare
059b9de
to
8d92fcd
Compare
…ix-ocaml-ci-pr-5726 Merge master into feature/py3 to fix OCaml CI failures using #5726
Signed-off-by: Andrii Sultanov <[email protected]>
8d92fcd
to
de02e53
Compare
Created a separate ticket (CP-50079) for removing Restored the exception handling over Uri's interface - could someone review this please? (it's one line - L377 in |
Removed unused function, replaced the only other usage of
parse_uri
with thefunctions from the
Uri
module.Suggested here.
The original ticket also mentioned
authorization_of_string
as anothercandidate to switch to Uri, but it parses headers, not Uris, so this
was not undertaken.
This change passed the BST/BVT test suites, and was also tested
manually by interacting with the host from XenCenter.