Skip to content

Commit

Permalink
Fix some checks
Browse files Browse the repository at this point in the history
  • Loading branch information
waahm7 committed Dec 3, 2023
1 parent af631fe commit 6913cd3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 3 additions & 0 deletions include/aws/s3/private/s3_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ extern const struct aws_byte_cursor g_content_range_header_name;
AWS_S3_API
extern const struct aws_byte_cursor g_accept_ranges_header_name;

AWS_S3_API
extern const struct aws_byte_cursor g_mp_parts_count_header_name;

AWS_S3_API
extern const struct aws_byte_cursor g_post_method;

Expand Down
7 changes: 3 additions & 4 deletions source/s3_meta_request.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,8 @@ static int s_meta_request_get_response_headers_checksum_callback(
}
const struct aws_byte_cursor *algorithm_header_name = aws_get_http_header_name_from_algorithm(i);
// waahm7: TODO need information here to find out if this object was MPU or Not
const struct aws_byte_cursor parts_count_header_name = aws_byte_cursor_from_c_str("x-amz-mp-parts-count");
if (aws_http_headers_has(headers, *algorithm_header_name) &&
!aws_http_headers_has(headers, parts_count_header_name)) {
!aws_http_headers_has(headers, g_mp_parts_count_header_name)) {
struct aws_byte_cursor header_sum;
aws_http_headers_get(headers, *algorithm_header_name, &header_sum);
size_t encoded_len = 0;
Expand Down Expand Up @@ -1284,8 +1283,8 @@ static int s_s3_meta_request_headers_block_done(
request->request_tag == AWS_S3_AUTO_RANGE_GET_REQUEST_TYPE_GET_PART_NUMBER &&
header_block == AWS_HTTP_HEADER_BLOCK_MAIN) {
uint64_t content_length;
if (aws_s3_parse_content_length_response_header(
request->allocator, request->send_data.response_headers, &content_length) ||
if (!aws_s3_parse_content_length_response_header(
request->allocator, request->send_data.response_headers, &content_length) &&
content_length > meta_request->part_size) {
return aws_raise_error(AWS_ERROR_S3_PART_TOO_LARGE_FOR_GET_PART);
}
Expand Down
2 changes: 2 additions & 0 deletions source/s3_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ const struct aws_byte_cursor g_sha1_complete_mpu_name = AWS_BYTE_CUR_INIT_FROM_S
const struct aws_byte_cursor g_sha256_complete_mpu_name = AWS_BYTE_CUR_INIT_FROM_STRING_LITERAL("ChecksumSHA256");
const struct aws_byte_cursor g_accept_ranges_header_name = AWS_BYTE_CUR_INIT_FROM_STRING_LITERAL("accept-ranges");
const struct aws_byte_cursor g_acl_header_name = AWS_BYTE_CUR_INIT_FROM_STRING_LITERAL("x-amz-acl");
const struct aws_byte_cursor g_mp_parts_count_header_name =
AWS_BYTE_CUR_INIT_FROM_STRING_LITERAL("x-amz-mp-parts-count");
const struct aws_byte_cursor g_post_method = AWS_BYTE_CUR_INIT_FROM_STRING_LITERAL("POST");
const struct aws_byte_cursor g_head_method = AWS_BYTE_CUR_INIT_FROM_STRING_LITERAL("HEAD");
const struct aws_byte_cursor g_delete_method = AWS_BYTE_CUR_INIT_FROM_STRING_LITERAL("DELETE");
Expand Down

0 comments on commit 6913cd3

Please sign in to comment.