@@ -3922,6 +3922,7 @@ static int s_test_s3_round_trip_default_get_fc_helper(
39223922 struct aws_allocator * allocator ,
39233923 void * ctx ,
39243924 bool via_header ,
3925+ uint32_t object_size_mb ,
39253926 enum aws_s3_tester_full_object_checksum full_object_checksum ) {
39263927 (void )ctx ;
39273928
@@ -3943,8 +3944,9 @@ static int s_test_s3_round_trip_default_get_fc_helper(
39433944 snprintf (
39443945 object_path_sprintf_buffer ,
39453946 sizeof (object_path_sprintf_buffer ),
3946- "/prefix/round_trip/test_default_fc_%d.txt" ,
3947- algorithm );
3947+ "/prefix/round_trip/test_default_fc_%d_%d.txt" ,
3948+ algorithm ,
3949+ object_size_mb );
39483950
39493951 ASSERT_SUCCESS (aws_s3_tester_upload_file_path_init (
39503952 allocator , & path_buf , aws_byte_cursor_from_c_str (object_path_sprintf_buffer )));
@@ -3960,7 +3962,7 @@ static int s_test_s3_round_trip_default_get_fc_helper(
39603962 .checksum_via_header = via_header ,
39613963 .put_options =
39623964 {
3963- .object_size_mb = 1 ,
3965+ .object_size_mb = object_size_mb ,
39643966 .object_path_override = object_path ,
39653967 },
39663968 };
@@ -4000,18 +4002,22 @@ static int s_test_s3_round_trip_default_get_fc_helper(
40004002
40014003AWS_TEST_CASE (test_s3_round_trip_default_get_fc , s_test_s3_round_trip_default_get_fc )
40024004static int s_test_s3_round_trip_default_get_fc (struct aws_allocator * allocator , void * ctx ) {
4003- return s_test_s3_round_trip_default_get_fc_helper (allocator , ctx , false, AWS_TEST_FOC_NONE );
4005+ return s_test_s3_round_trip_default_get_fc_helper (allocator , ctx , false, 1 /*object_size_mb*/ , AWS_TEST_FOC_NONE );
4006+ }
4007+ AWS_TEST_CASE (test_s3_round_trip_empty_fc , s_test_s3_round_trip_empty_fc )
4008+ static int s_test_s3_round_trip_empty_fc (struct aws_allocator * allocator , void * ctx ) {
4009+ return s_test_s3_round_trip_default_get_fc_helper (allocator , ctx , false, 0 , AWS_TEST_FOC_NONE );
40044010}
40054011
40064012AWS_TEST_CASE (test_s3_round_trip_default_get_fc_header , s_test_s3_round_trip_default_get_fc_header )
40074013static int s_test_s3_round_trip_default_get_fc_header (struct aws_allocator * allocator , void * ctx ) {
4008- return s_test_s3_round_trip_default_get_fc_helper (allocator , ctx , true, AWS_TEST_FOC_NONE );
4014+ return s_test_s3_round_trip_default_get_fc_helper (allocator , ctx , true, 1 , AWS_TEST_FOC_NONE );
40094015}
40104016AWS_TEST_CASE (
40114017 test_s3_round_trip_default_get_full_object_checksum_fc ,
40124018 s_test_s3_round_trip_default_get_full_object_checksum_fc )
40134019static int s_test_s3_round_trip_default_get_full_object_checksum_fc (struct aws_allocator * allocator , void * ctx ) {
4014- return s_test_s3_round_trip_default_get_fc_helper (allocator , ctx , false, AWS_TEST_FOC_HEADER );
4020+ return s_test_s3_round_trip_default_get_fc_helper (allocator , ctx , false, 1 , AWS_TEST_FOC_HEADER );
40154021}
40164022
40174023static int s_test_s3_round_trip_multipart_get_fc_helper (struct aws_allocator * allocator , void * ctx , bool via_header ) {
@@ -8049,3 +8055,62 @@ static int s_test_s3_upload_review_checksum_location_none_async_noop_part(struct
80498055 aws_s3_tester_clean_up (& tester );
80508056 return 0 ;
80518057}
8058+
8059+ static struct aws_http_stream * s_http_connection_make_request_patch (
8060+ struct aws_http_connection * client_connection ,
8061+ const struct aws_http_make_request_options * options ) {
8062+
8063+ struct aws_http_message * message = options -> request ;
8064+ struct aws_http_headers * headers = aws_http_message_get_headers (message );
8065+ struct aws_byte_cursor out_value ;
8066+ int e = aws_http_headers_get (headers , aws_byte_cursor_from_c_str ("Content-Length" ), & out_value );
8067+ AWS_FATAL_ASSERT (e == AWS_OP_ERR ); // Assert that the header is not present
8068+ AWS_FATAL_ASSERT (aws_last_error () == AWS_ERROR_HTTP_HEADER_NOT_FOUND );
8069+
8070+ return aws_http_connection_make_request (client_connection , options );
8071+ }
8072+
8073+ AWS_TEST_CASE (test_s3_default_get_without_content_length , s_test_s3_default_get_without_content_length )
8074+ static int s_test_s3_default_get_without_content_length (struct aws_allocator * allocator , void * ctx ) {
8075+ (void )ctx ;
8076+
8077+ struct aws_s3_tester tester ;
8078+ ASSERT_SUCCESS (aws_s3_tester_init (allocator , & tester ));
8079+
8080+ struct aws_s3_client * client = NULL ;
8081+ struct aws_s3_tester_client_options client_options ;
8082+ AWS_ZERO_STRUCT (client_options );
8083+
8084+ ASSERT_SUCCESS (aws_s3_tester_client_new (& tester , & client_options , & client ));
8085+ struct aws_s3_client_vtable * patched_client_vtable = aws_s3_tester_patch_client_vtable (& tester , client , NULL );
8086+ patched_client_vtable -> http_connection_make_request = s_http_connection_make_request_patch ;
8087+
8088+ struct aws_s3_meta_request_test_results meta_request_test_results ;
8089+ aws_s3_meta_request_test_results_init (& meta_request_test_results , allocator );
8090+
8091+ struct aws_string * host_name =
8092+ aws_s3_tester_build_endpoint_string (allocator , & g_test_public_bucket_name , & g_test_s3_region );
8093+
8094+ /* Put together a simple S3 Get Object request. */
8095+ struct aws_http_message * message = aws_s3_test_get_object_request_new (
8096+ allocator , aws_byte_cursor_from_string (host_name ), g_pre_existing_object_1MB );
8097+
8098+ struct aws_s3_meta_request_options options ;
8099+ AWS_ZERO_STRUCT (options );
8100+ /* Send default type */
8101+ options .type = AWS_S3_META_REQUEST_TYPE_DEFAULT ;
8102+ options .message = message ;
8103+ options .operation_name = aws_byte_cursor_from_c_str ("GetObject" );
8104+
8105+ ASSERT_SUCCESS (aws_s3_tester_send_meta_request (
8106+ & tester , client , & options , & meta_request_test_results , AWS_S3_TESTER_SEND_META_REQUEST_EXPECT_SUCCESS ));
8107+ ASSERT_SUCCESS (aws_s3_tester_validate_get_object_results (& meta_request_test_results , 0 ));
8108+
8109+ aws_s3_meta_request_test_results_clean_up (& meta_request_test_results );
8110+ aws_string_destroy (host_name );
8111+ aws_http_message_release (message );
8112+ aws_s3_client_release (client );
8113+ aws_s3_tester_clean_up (& tester );
8114+
8115+ return AWS_OP_SUCCESS ;
8116+ }
0 commit comments