Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
TingDaoK committed Nov 27, 2024
1 parent 41d1381 commit 1f1a844
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions source/s3_meta_request.c
Original file line number Diff line number Diff line change
Expand Up @@ -1048,6 +1048,20 @@ static void s_s3_meta_request_request_on_signed(
goto finish;
}

/**
* Add "x-amz-content-sha256: STREAMING-UNSIGNED-PAYLOAD-TRAILER" header to support trailing checksum.
*/
if (request->send_data.require_streaming_unsigned_payload_header) {
struct aws_http_headers *headers = aws_http_message_get_headers(request->send_data.message);
if (aws_http_headers_set(
headers,
aws_byte_cursor_from_c_str("x-amz-content-sha256"),
g_aws_signed_body_value_streaming_unsigned_payload_trailer)) {
error_code = aws_last_error_or_unknown();
goto finish;
}
}

if (request->send_data.metrics) {
struct aws_s3_request_metrics *metric = request->send_data.metrics;
aws_high_res_clock_get_ticks((uint64_t *)&metric->time_metrics.sign_end_timestamp_ns);
Expand All @@ -1056,17 +1070,6 @@ static void s_s3_meta_request_request_on_signed(
metric->time_metrics.sign_end_timestamp_ns - metric->time_metrics.sign_start_timestamp_ns;
}

/**
* Add "x-amz-content-sha256: STREAMING-UNSIGNED-PAYLOAD-TRAILER" header to support trailing checksum.
*/
if (request->send_data.require_streaming_unsigned_payload_header) {
struct aws_http_headers *headers = aws_http_message_get_headers(request->send_data.message);
error_code = aws_http_headers_set(
headers,
aws_byte_cursor_from_c_str("x-amz-content-sha256"),
g_aws_signed_body_value_streaming_unsigned_payload_trailer);
}

finish:

if (error_code != AWS_ERROR_SUCCESS) {
Expand Down

0 comments on commit 1f1a844

Please sign in to comment.