@@ -6937,6 +6937,9 @@ static int s_test_s3_range_requests(struct aws_allocator *allocator, void *ctx)
69376937
69386938 // Last 8K
69396939 AWS_BYTE_CUR_INIT_FROM_STRING_LITERAL ("bytes=-8192" ),
6940+
6941+ // 1MiB - 8K to the end.
6942+ AWS_BYTE_CUR_INIT_FROM_STRING_LITERAL ("bytes=1040384-" ),
69406943 };
69416944
69426945 /* List of headers that should have matching values between the auto_ranged_get and default (which sends the HTTP
@@ -7130,6 +7133,54 @@ static int s_test_s3_range_requests(struct aws_allocator *allocator, void *ctx)
71307133 return 0 ;
71317134}
71327135
7136+ /* Using the range to fetch the object that has less than 1 part. */
7137+ AWS_TEST_CASE (test_s3_range_requests_less_than_a_part , s_test_s3_range_requests_less_than_a_part )
7138+ static int s_test_s3_range_requests_less_than_a_part (struct aws_allocator * allocator , void * ctx ) {
7139+ (void )ctx ;
7140+
7141+ struct aws_s3_tester tester ;
7142+ ASSERT_SUCCESS (aws_s3_tester_init (allocator , & tester ));
7143+
7144+ struct aws_s3_tester_client_options client_options = {
7145+ .part_size = MB_TO_BYTES (1 ), // Use 1 MiB as the part.
7146+ };
7147+
7148+ struct aws_s3_client * client = NULL ;
7149+ ASSERT_SUCCESS (aws_s3_tester_client_new (& tester , & client_options , & client ));
7150+ const struct aws_byte_cursor ranges [] = {
7151+ // 0.5 MB - 2 MB range. This overlaps and goes beyond the 1 MB test file size.
7152+ AWS_BYTE_CUR_INIT_FROM_STRING_LITERAL ("bytes=524288-2097151" ),
7153+
7154+ // Get everything after the first 0.5 MB
7155+ AWS_BYTE_CUR_INIT_FROM_STRING_LITERAL ("bytes=524288-" ),
7156+ };
7157+ const size_t num_ranges = AWS_ARRAY_SIZE (ranges );
7158+
7159+ for (size_t range_index = 0 ; range_index < num_ranges ; ++ range_index ) {
7160+ struct aws_s3_tester_meta_request_options options = {
7161+ .allocator = allocator ,
7162+ .client = client ,
7163+ .meta_request_type = AWS_S3_META_REQUEST_TYPE_GET_OBJECT ,
7164+ .validate_type = AWS_S3_TESTER_VALIDATE_TYPE_EXPECT_SUCCESS ,
7165+ .get_options =
7166+ {
7167+ .object_path = g_pre_existing_object_1MB ,
7168+ .object_range = ranges [range_index ],
7169+ },
7170+ };
7171+ struct aws_s3_meta_request_test_results results ;
7172+ aws_s3_meta_request_test_results_init (& results , allocator );
7173+
7174+ ASSERT_SUCCESS (aws_s3_tester_send_meta_request_with_options (& tester , & options , & results ));
7175+ aws_s3_meta_request_test_results_clean_up (& results );
7176+ }
7177+
7178+ aws_s3_client_release (client );
7179+ aws_s3_tester_clean_up (& tester );
7180+
7181+ return 0 ;
7182+ }
7183+
71337184AWS_TEST_CASE (test_s3_not_satisfiable_range , s_test_s3_not_satisfiable_range )
71347185static int s_test_s3_not_satisfiable_range (struct aws_allocator * allocator , void * ctx ) {
71357186 (void )ctx ;
0 commit comments