From 1ba0e47373d91e0ace9972fb9b3635b67e1ff7c8 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Khan Date: Sun, 3 Dec 2023 21:50:38 -0800 Subject: [PATCH] Update comment --- source/s3_auto_ranged_get.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/source/s3_auto_ranged_get.c b/source/s3_auto_ranged_get.c index 4504416c2..51e80cd6e 100644 --- a/source/s3_auto_ranged_get.c +++ b/source/s3_auto_ranged_get.c @@ -147,18 +147,13 @@ static bool s_s3_auto_ranged_get_update( auto_ranged_get->synced_data.num_parts_requested > 0) { goto has_work_remaining; } - /* If there exists a range header or we require validation of the response checksum, we currently - * always do a head request first. S3 returns the checksum of the entire object from the HEAD - * response - * - * For the range header value could be parsed client-side, doing so presents a number of - * complications. For example, the given range 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 != 0; - // waahm7 - if (head_object_required) { - /* If the head object request hasn't been sent yet, then send it now. */ + + /* If there exists a range header, we currently always do a head request first. For the range header + * value could be parsed client-side, doing so presents a number of complications. For example, the + * given range 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.*/ + if (auto_ranged_get->initial_message_has_range_header != 0) { request = aws_s3_request_new( meta_request, AWS_S3_AUTO_RANGE_GET_REQUEST_TYPE_HEAD_OBJECT, @@ -170,7 +165,7 @@ static bool s_s3_auto_ranged_get_update( auto_ranged_get->synced_data.head_object_sent = true; } else { - /* Try to download the firstPart of the object */ + /* Get the object range from the first request */ struct aws_s3_buffer_pool_ticket *ticket = aws_s3_buffer_pool_reserve(meta_request->client->buffer_pool, meta_request->part_size); @@ -724,7 +719,9 @@ static void s_s3_auto_ranged_get_request_finished( break; case AWS_S3_AUTO_RANGE_GET_REQUEST_TYPE_GET_PART_NUMBER: auto_ranged_get->synced_data.get_first_part_completed = true; + AWS_LOGF_DEBUG(AWS_LS_S3_META_REQUEST, "id=%p Get Part Number completed.", (void *)meta_request); if (error_code == AWS_ERROR_S3_PART_SIZE_MISMATCH && found_object_size) { + /* Try to fetch the first part again as a ranged get */ break; } ++auto_ranged_get->synced_data.num_parts_requested;