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

Adapt to XML API changes #332

Merged
merged 4 commits into from
Jul 18, 2023
Merged

Adapt to XML API changes #332

merged 4 commits into from
Jul 18, 2023

Conversation

graebm
Copy link
Contributor

@graebm graebm commented Jul 13, 2023

Issue
The XML API was hard to use right, leading to bugs like this: #328

Description of changes:

  • Adapt to API changes from: Simplify error handling in XML API - BREAKING CHANGE aws-c-common#1043
  • Break up node traversal functions, to ensure we're processing the correct XML elements.
    • Previously, the same callback would be used for all XML elements. This could cause error if an element with the same name occurred at different parts of the document tree.
  • Improved error checking
    • Previously, many calls to aws_xml_node_as_body() weren't being checked for error.
  • Replace aws_xml_get_top_level_tag() and aws_xml_get_top_level_tag_with_root_name() with aws_xml_get_body_at_path()
    • aws_xml_get_top_level_tag() didn't check the name of the root node
    • aws_xml_get_top_level_tag_with_root_name() was clunky to use (IMHO)
    • so replace with an API that can retrieve an element at any depth (not just 2), checking names the whole way, and with a nicer API (IMHO).
    • new function gives aws_byte_cursor instead of aws_string, the user was usually just deleting it afterwards, which made their error-handling more complicated.
  • Trivial stuff:
    • Remove unused functions aws_s3_list_objects_operation_new() and aws_s3_initiate_list_parts()
    • aws_replace_quote_entities() returns aws_byte_buf by value, instead of as out-param
    • Some functions take aws_byte_cursor by value, instead taking aws_string * or aws_byte_buf * or aws_byte_cursor * by pointer

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@graebm graebm marked this pull request as ready for review July 13, 2023 21:40
@codecov-commenter
Copy link

codecov-commenter commented Jul 13, 2023

Codecov Report

Merging #332 (c08cd14) into main (bc9c8b2) will increase coverage by 0.48%.
The diff coverage is 93.64%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #332      +/-   ##
==========================================
+ Coverage   88.93%   89.42%   +0.48%     
==========================================
  Files          17       17              
  Lines        4972     4888      -84     
==========================================
- Hits         4422     4371      -51     
+ Misses        550      517      -33     
Impacted Files Coverage Δ
source/s3.c 96.15% <ø> (ø)
source/s3_paginator.c 88.23% <80.76%> (-2.50%) ⬇️
source/s3_list_parts.c 92.70% <88.23%> (+17.89%) ⬆️
source/s3_auto_ranged_put.c 92.19% <88.88%> (-0.25%) ⬇️
source/s3_auto_ranged_get.c 98.55% <100.00%> (-0.01%) ⬇️
source/s3_copy_object.c 81.14% <100.00%> (-0.13%) ⬇️
source/s3_list_objects.c 92.38% <100.00%> (+12.07%) ⬆️
source/s3_meta_request.c 92.73% <100.00%> (-0.61%) ⬇️
source/s3_util.c 98.66% <100.00%> (-0.07%) ⬇️

@graebm graebm merged commit 2311881 into main Jul 18, 2023
30 checks passed
@graebm graebm deleted the xml-error-handling branch July 18, 2023 23:17
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.

3 participants