Skip to content

Commit 1d41c4e

Browse files
committed
Merge main after fixing conflicts
2 parents b05ad3f + 9a6fc98 commit 1d41c4e

12 files changed

Lines changed: 1103 additions & 1088 deletions

File tree

.builder/actions/mock_server_setup.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ def run(self, env):
2424

2525
self.env = env
2626
python_path = sys.executable
27+
# ensure pip is available
28+
self.env.shell.exec(python_path, '-m', 'ensurepip', '--upgrade', check=False)
2729
# install dependency for mock server
2830
self.env.shell.exec(python_path,
2931
'-m', 'pip', 'install', 'h11', 'trio', 'proxy.py', check=True)

.github/workflows/ci.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ concurrency:
1111
cancel-in-progress: true
1212

1313
env:
14-
BUILDER_VERSION: v0.9.74
14+
BUILDER_VERSION: v0.9.92
1515
BUILDER_SOURCE: releases
1616
BUILDER_HOST: https://d19elf31gohf1l.cloudfront.net
1717
PACKAGE_NAME: aws-c-s3
@@ -42,7 +42,7 @@ jobs:
4242
role-to-assume: ${{ env.CRT_CI_ROLE }}
4343
aws-region: ${{ env.AWS_DEFAULT_REGION }}
4444
- name: Checkout Sources
45-
uses: actions/checkout@v4
45+
uses: actions/checkout@v6
4646
# We can't use the `uses: docker://image` version yet, GitHub lacks authentication for actions -> packages
4747
- name: Build ${{ env.PACKAGE_NAME }}
4848
run: |
@@ -62,6 +62,7 @@ jobs:
6262
- name: clang-11
6363
- name: clang-15
6464
- name: clang-17
65+
- name: clang-latest
6566
- name: gcc-4.8
6667
- name: gcc-5
6768
- name: gcc-6
@@ -203,7 +204,7 @@ jobs:
203204
role-to-assume: ${{ env.CRT_CI_ROLE }}
204205
aws-region: ${{ env.AWS_DEFAULT_REGION }}
205206
- name: Checkout Sources
206-
uses: actions/checkout@v4
207+
uses: actions/checkout@v6
207208
- name: Build ${{ env.PACKAGE_NAME }} + consumers
208209
run: |
209210
python3 -m venv .venv
@@ -220,7 +221,7 @@ jobs:
220221
role-to-assume: ${{ env.CRT_CI_ROLE }}
221222
aws-region: ${{ env.AWS_DEFAULT_REGION }}
222223
- name: Checkout Sources
223-
uses: actions/checkout@v4
224+
uses: actions/checkout@v6
224225
- name: Build ${{ env.PACKAGE_NAME }} + consumers
225226
run: |
226227
python3 -m venv .venv

.github/workflows/clang-format.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99

1010
steps:
1111
- name: Checkout Sources
12-
uses: actions/checkout@v4
12+
uses: actions/checkout@v6
1313

1414
- name: clang-format lint
1515
run: |

.github/workflows/codecov.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
role-to-assume: ${{ env.CRT_CI_ROLE }}
2626
aws-region: ${{ env.AWS_DEFAULT_REGION }}
2727
- name: Checkout Sources
28-
uses: actions/checkout@v4
28+
uses: actions/checkout@v6
2929
- name: Build ${{ env.PACKAGE_NAME }} + consumers
3030
run: |
3131
python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder')"

include/aws/s3/private/s3_util.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -236,11 +236,6 @@ int aws_xml_get_body_at_path(
236236
const char *path_name_array[],
237237
struct aws_byte_cursor *out_body);
238238

239-
/* replace " with escaped /"
240-
* Returns initialized aws_byte_buf */
241-
AWS_S3_API
242-
struct aws_byte_buf aws_replace_quote_entities(struct aws_allocator *allocator, struct aws_byte_cursor src);
243-
244239
/* strip quotes if string is enclosed in quotes. does not remove quotes if they only appear on either side of the string
245240
*/
246241
AWS_S3_API

source/s3_auto_ranged_put.c

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <aws/common/environment.h>
1616
#include <aws/common/string.h>
1717
#include <aws/common/thread.h>
18+
#include <aws/common/xml_parser.h>
1819
#include <aws/io/stream.h>
1920

2021
/* TODO: better logging of steps */
@@ -1799,13 +1800,20 @@ static void s_s3_auto_ranged_put_request_finished(
17991800
aws_xml_get_body_at_path(meta_request->allocator, xml_doc, xml_path, &etag_header_value);
18001801

18011802
if (etag_header_value.len > 0) {
1802-
struct aws_byte_buf etag_header_value_byte_buf =
1803-
aws_replace_quote_entities(meta_request->allocator, etag_header_value);
1804-
1805-
aws_http_headers_set(
1806-
request->send_data.response_headers,
1807-
g_etag_header_name,
1808-
aws_byte_cursor_from_buf(&etag_header_value_byte_buf));
1803+
struct aws_byte_buf etag_header_value_byte_buf;
1804+
aws_byte_buf_init(&etag_header_value_byte_buf, meta_request->allocator, 20);
1805+
if (aws_byte_buf_append_unescaped_xml(
1806+
meta_request->allocator, etag_header_value, &etag_header_value_byte_buf)) {
1807+
AWS_LOGF_ERROR(
1808+
AWS_LS_S3_META_REQUEST, "Server returned unexpected etag format. skipping etag unescaping");
1809+
aws_http_headers_set(
1810+
request->send_data.response_headers, g_etag_header_name, etag_header_value);
1811+
} else {
1812+
aws_http_headers_set(
1813+
request->send_data.response_headers,
1814+
g_etag_header_name,
1815+
aws_byte_cursor_from_buf(&etag_header_value_byte_buf));
1816+
}
18091817

18101818
aws_byte_buf_clean_up(&etag_header_value_byte_buf);
18111819
}

source/s3_copy_object.c

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "aws/s3/private/s3_request_messages.h"
99
#include "aws/s3/private/s3_util.h"
1010
#include <aws/common/string.h>
11+
#include <aws/common/xml_parser.h>
1112

1213
/* Objects with size smaller than the constant below are bypassed as S3 CopyObject instead of multipart copy */
1314
static const size_t s_multipart_copy_minimum_object_size = GB_TO_BYTES(1);
@@ -569,7 +570,9 @@ static struct aws_string *s_etag_new_from_upload_part_copy_response(
569570
const char *xml_path[] = {"CopyPartResult", "ETag", NULL};
570571
aws_xml_get_body_at_path(allocator, xml_doc, xml_path, &etag_within_xml_quotes);
571572

572-
struct aws_byte_buf etag_within_quotes_byte_buf = aws_replace_quote_entities(allocator, etag_within_xml_quotes);
573+
struct aws_byte_buf etag_within_quotes_byte_buf;
574+
aws_byte_buf_init(&etag_within_quotes_byte_buf, allocator, 20);
575+
aws_byte_buf_append_unescaped_xml(allocator, etag_within_xml_quotes, &etag_within_quotes_byte_buf);
573576

574577
struct aws_string *stripped_etag =
575578
aws_strip_quotes(allocator, aws_byte_cursor_from_buf(&etag_within_quotes_byte_buf));
@@ -770,13 +773,20 @@ static void s_s3_copy_object_request_finished(
770773
const char *xml_path[] = {"CompleteMultipartUploadResult", "ETag", NULL};
771774
aws_xml_get_body_at_path(meta_request->allocator, xml_doc, xml_path, &etag_header_value);
772775
if (etag_header_value.len > 0) {
773-
struct aws_byte_buf etag_header_value_byte_buf =
774-
aws_replace_quote_entities(meta_request->allocator, etag_header_value);
775-
776-
aws_http_headers_set(
777-
request->send_data.response_headers,
778-
g_etag_header_name,
779-
aws_byte_cursor_from_buf(&etag_header_value_byte_buf));
776+
struct aws_byte_buf etag_header_value_byte_buf;
777+
aws_byte_buf_init(&etag_header_value_byte_buf, meta_request->allocator, 20);
778+
if (aws_byte_buf_append_unescaped_xml(
779+
meta_request->allocator, etag_header_value, &etag_header_value_byte_buf)) {
780+
AWS_LOGF_ERROR(
781+
AWS_LS_S3_META_REQUEST, "Server returned unexpected etag format. skipping etag unescaping");
782+
aws_http_headers_set(
783+
request->send_data.response_headers, g_etag_header_name, etag_header_value);
784+
} else {
785+
aws_http_headers_set(
786+
request->send_data.response_headers,
787+
g_etag_header_name,
788+
aws_byte_cursor_from_buf(&etag_header_value_byte_buf));
789+
}
780790

781791
aws_byte_buf_clean_up(&etag_header_value_byte_buf);
782792
}

0 commit comments

Comments
 (0)