Skip to content

Commit 13b9094

Browse files
committed
address comments
1 parent 197542b commit 13b9094

File tree

3 files changed

+18
-22
lines changed

3 files changed

+18
-22
lines changed

include/aws/s3/private/s3_checksum_context.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ bool aws_s3_upload_request_checksum_context_should_add_header(
111111
const struct aws_s3_upload_request_checksum_context *context);
112112

113113
/**
114-
* Check if checksum should be added as trailer (chunked encoding).
114+
* Check if checksum should be added as trailer (aws-chunked encoding).
115115
* Returns true if the context has a valid algorithm and the location is set to trailer.
116116
*
117117
* @param context The checksum context to check
@@ -133,7 +133,7 @@ struct aws_byte_buf *aws_s3_upload_request_checksum_context_get_output_buffer(
133133
struct aws_s3_upload_request_checksum_context *context);
134134

135135
/**
136-
* Get a cursor to the current checksum value (for use in headers/trailers).
136+
* Get a cursor to the current base64 encoded checksum value (for use in headers/trailers).
137137
* Returns an empty cursor if the checksum has not been calculated yet.
138138
*
139139
* @param context The checksum context

include/aws/s3/private/s3_checksums.h

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -87,31 +87,27 @@ struct aws_input_stream *aws_checksum_stream_new(
8787
* Creates a chunked encoding stream that wraps an existing stream and adds checksum trailers.
8888
*
8989
* This function creates a stream that:
90-
* 1. Encodes the input stream using HTTP chunked transfer encoding
90+
* 1. Encodes the input stream wraps the existing_stream with aws-chunked encoded.
9191
* 2. Calculates a checksum of the stream content (if not already calculated)
92-
* 3. Appends the checksum as a trailer at the end of the chunked stream
93-
*
94-
* The output format follows HTTP chunked encoding with checksum trailers:
95-
* - For non-empty streams: [hex-length]\r\n[data]\r\n0\r\n[checksum-header]:[checksum-value]\r\n\r\n
96-
* - For empty streams: 0\r\n[checksum-header]:[checksum-value]\r\n\r\n
92+
* 3. Appends the checksum as a trailer at the end of the aws-chunked stream
9793
*
9894
* Note: This stream does not support seeking operations, as seeking would prevent
9995
* accurate checksum calculation and corrupt the chunked encoding format.
10096
*
101-
* @param allocator Memory allocator to use for stream creation and internal buffers
102-
* @param existing_stream The input stream to be chunked and checksummed. This stream
103-
* will be acquired by the chunk stream and released when the
104-
* chunk stream is destroyed. Must not be NULL.
105-
* @param checksum_context Context containing checksum configuration and state. Must not be NULL.
106-
* The context contains:
107-
* - algorithm: The checksum algorithm to use (CRC32, CRC32C, etc.)
108-
* - base64_checksum: Buffer for the calculated checksum result
109-
* - checksum_calculated: Whether checksum is pre-calculated or needs calculation
110-
* - encoded_checksum_size: Expected size of the base64-encoded checksum
97+
* @param allocator Memory allocator to use for stream creation and internal buffers
98+
* @param existing_stream The input stream to be chunked and checksummed. This stream
99+
* will be acquired by the chunk stream and released when the
100+
* chunk stream is destroyed. Must not be NULL.
101+
* @param checksum_context Context containing checksum configuration and state. Must not be NULL.
102+
* The context contains:
103+
* - algorithm: The checksum algorithm to use (CRC32, CRC32C, etc.)
104+
* - base64_checksum: Buffer for the calculated checksum result
105+
* - checksum_calculated: Whether checksum is pre-calculated or needs calculation
106+
* - encoded_checksum_size: Expected size of the base64-encoded checksum
111107
*
112-
* If checksum_calculated is false, the stream will wrap existing_stream
113-
* with a checksum stream to calculate the checksum during reading.
114-
* If checksum_calculated is true, the existing checksum value will be used.
108+
* If checksum_calculated is false, the stream will wrap existing_stream
109+
* with a checksum stream to calculate the checksum during reading.
110+
* If checksum_calculated is true, the existing checksum value will be used.
115111
*
116112
* @return A new input stream that provides chunked encoding with checksum trailers,
117113
* or NULL if creation fails. The returned stream must be released with

source/s3_auto_ranged_put.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ static int s_process_part_info_synced(const struct aws_s3_part_info *info, void
161161
part->checksum_context = aws_s3_upload_request_checksum_context_new(
162162
auto_ranged_put->base.allocator, &auto_ranged_put->base.checksum_config);
163163
}
164-
if (!part->checksum_context) {
164+
if (part->checksum_context == NULL) {
165165
aws_mem_release(meta_request->allocator, part);
166166
return AWS_OP_ERR;
167167
}

0 commit comments

Comments
 (0)