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

CP-49677 CP-49647 Use URI for improved IPv6 in http.ml, newcli.ml #5676

Merged
merged 3 commits into from
Jun 17, 2024

Conversation

lindig
Copy link
Contributor

@lindig lindig commented Jun 7, 2024

We want to get away from string-based URL handling and delegate this to URI and get correct IPv6 handling along the way.

@lindig lindig requested review from robhoes and psafont June 7, 2024 09:13
Copy link

codecov bot commented Jun 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Additional details and impacted files
@@           Coverage Diff            @@
##           master   #5676     +/-   ##
========================================
- Coverage    51.4%   44.8%   -6.6%     
========================================
  Files          13      16      +3     
  Lines        1928    2210    +282     
========================================
+ Hits          991     992      +1     
- Misses        937    1218    +281     

see 4 files with indirect coverage changes

Flag Coverage Δ
python2.7 45.5% <ø> (?)
python3.11 51.4% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

@lindig lindig changed the title CP-49677 CP-49647 Use URI for improve IPv6 in http.ml, newcli.ml CP-49677 CP-49647 Use URI for improved IPv6 in http.ml, newcli.ml Jun 7, 2024
)
debug "%s: %s" __FUNCTION__ url ;
let fail fmt = Printf.ksprintf failwith fmt in
let query = function k, v :: _ -> (k, v) | k, [] -> (k, "") in
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous implementation keeps all values for a key, is it significant, though?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The URI module can represent a key with multiple values but our representation would have to use duplicate keys - which I think is very questionable and something we should avoid. Currently tests are passing, suggesting we don't use multiple values/keys.

Signed-off-by: Christian Lindig <christian.lindig@cloud.com>
@lindig lindig force-pushed the private/christianlin/CP-49677-5 branch from 55d0ab5 to 658a84b Compare June 17, 2024 13:12
in
let reconstruct_uri uri = "/" ^ String.concat "/" uri in
let data_of_uri uri =
let uri, params = parse_uri (reconstruct_uri uri) in
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is parse_uri (defined above) still used now? If not, it can be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still used; should be removed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CP-49953 is a follow-up to remove it

Christian Lindig added 2 commits June 17, 2024 14:56
The struture of Http.Url is unfortunate and we currently can't cange it
but we can use a better and more concise implementation using URI.

Signed-off-by: Christian Lindig <christian.lindig@cloud.com>
Signed-off-by: Christian Lindig <christian.lindig@cloud.com>
@lindig lindig force-pushed the private/christianlin/CP-49677-5 branch from 658a84b to cb0ed6b Compare June 17, 2024 13:57
in
Uri.(
make
let to_string scheme =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scheme here isn't of the same type as in of_string above, which is a little confusing. The type here is type t = scheme * data.

Copy link
Member

@psafont psafont left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should change the base type of Url, in the meantime this adapter is beneficial for parsing urls

@lindig lindig merged commit 6af8250 into xapi-project:master Jun 17, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants