Skip to content

Commit

Permalink
Fixing warning related to bitfield (#131)
Browse files Browse the repository at this point in the history
* Fixing warning related to bitfield

* Fixing one-off test failure
  • Loading branch information
rccarper authored Jun 1, 2021
1 parent ed7a5ac commit bd1f691
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion source/s3_auto_ranged_get.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ static bool s_s3_auto_ranged_get_update(
* could be an unsatisfiable range, and might not even specify a complete range. To keep things simple, we
* are currently relying on the service to handle turning the Range header into a Content-Range response
* header.*/
bool head_object_required = auto_ranged_get->initial_message_has_range_header;
bool head_object_required = auto_ranged_get->initial_message_has_range_header != 0;

if (head_object_required) {
if (out_request == NULL) {
Expand Down
22 changes: 22 additions & 0 deletions tests/s3_data_plane_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -3056,6 +3056,8 @@ static int s_test_s3_range_requests(struct aws_allocator *allocator, void *ctx)
AWS_BYTE_CUR_INIT_FROM_STRING_LITERAL("bytes=-8192"),
};

/* List of headers that should have matching values between the auto_ranged_get and default (which sends the HTTP
* request as-is to S3) meta request.*/
const struct aws_byte_cursor headers_that_should_match[] = {
AWS_BYTE_CUR_INIT_FROM_STRING_LITERAL("ETag"),
AWS_BYTE_CUR_INIT_FROM_STRING_LITERAL("Accept-Ranges"),
Expand All @@ -3067,6 +3069,12 @@ static int s_test_s3_range_requests(struct aws_allocator *allocator, void *ctx)
AWS_BYTE_CUR_INIT_FROM_STRING_LITERAL("x-amz-server-side-encryption-aws-kms-key"),
};

/* List of headers that are okay to be in the auto_ranged_get response and not in the default response, or vice
* versa.*/
const struct aws_byte_cursor headers_to_ignore[] = {
AWS_BYTE_CUR_INIT_FROM_STRING_LITERAL("Connection"),
};

struct aws_s3_tester_client_options client_options = {
.part_size = 16 * 1024,
};
Expand Down Expand Up @@ -3154,6 +3162,20 @@ static int s_test_s3_range_requests(struct aws_allocator *allocator, void *ctx)
struct aws_http_header verify_header;
ASSERT_SUCCESS(aws_http_headers_get_index(verify_range_get_headers, i, &verify_header));

bool ignore_header = false;

for (size_t j = 0; j < sizeof(headers_to_ignore) / sizeof(headers_to_ignore[0]); ++j) {
if (aws_byte_cursor_eq_ignore_case(&headers_to_ignore[j], &verify_header.name)) {
ignore_header = true;
break;
}
}

if (ignore_header) {
aws_http_headers_erase(range_get_headers, verify_header.name);
continue;
}

AWS_LOGF_INFO(
AWS_LS_S3_GENERAL,
"%d,%d Checking for header " PRInSTR,
Expand Down

0 comments on commit bd1f691

Please sign in to comment.