Skip to content

Commit 63a4178

Browse files
committed
todo - no content-length will not work
1 parent e0cc062 commit 63a4178

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

include/aws/s3/private/s3_request.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ struct aws_s3_request {
140140
struct aws_byte_buf request_body;
141141
struct aws_input_stream *request_stream;
142142
bool parallel;
143-
int64_t content_length;
143+
uint64_t content_length;
144144

145145
/**
146146
* Ticket to acquire the buffer.

source/s3_auto_ranged_put.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,7 +1003,7 @@ struct aws_future_http_message *s_s3_prepare_upload_part(struct aws_s3_request *
10031003
/* Add part to array-list */
10041004
struct aws_s3_mpu_part_info *part =
10051005
aws_mem_calloc(meta_request->allocator, 1, sizeof(struct aws_s3_mpu_part_info));
1006-
part->size = request->request_body.len;
1006+
part->size = request->content_length;
10071007
aws_array_list_set_at(&auto_ranged_put->synced_data.part_list, &part, request->part_number - 1);
10081008
}
10091009
aws_s3_meta_request_unlock_synced_data(meta_request);
@@ -1075,6 +1075,7 @@ static void s_s3_prepare_upload_part_on_read_done(void *user_data) {
10751075
request->request_body.capacity);
10761076
goto on_done;
10771077
}
1078+
request->content_length = request->request_body.len;
10781079
/* Reading succeeded. */
10791080
bool is_body_stream_at_end = aws_future_bool_get_result(part_prep->asyncstep_read_part);
10801081

@@ -1666,7 +1667,7 @@ static void s_s3_auto_ranged_put_request_finished(
16661667
/* Send progress_callback for delivery on io_event_loop thread */
16671668
if (meta_request->progress_callback != NULL) {
16681669
struct aws_s3_meta_request_event event = {.type = AWS_S3_META_REQUEST_EVENT_PROGRESS};
1669-
event.u.progress.info.bytes_transferred = request->request_body.len;
1670+
event.u.progress.info.bytes_transferred = request->content_length;
16701671
event.u.progress.info.content_length = auto_ranged_put->content_length;
16711672
aws_s3_meta_request_add_event_for_delivery_synced(meta_request, &event);
16721673
}

source/s3_parallel_input_stream.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ static int s_aws_s3_mmap_part_streaming_input_stream_read(struct aws_input_strea
319319
/* We finished reading the reading buffer, reset it. */
320320
aws_byte_buf_reset(impl->reading_chunk_buf, false);
321321
impl->in_chunk_offset = SIZE_MAX;
322-
if (impl->eos_loaded) {
322+
if (impl->eos_loaded || impl->total_length_read == impl->total_length) {
323323
/* We reached the end of the stream. */
324324
impl->eos_reached = true;
325325
}

0 commit comments

Comments
 (0)