@@ -48,6 +48,7 @@ struct aws_s3express_session_creator {
48
48
/* The region and host of the session we are creating */
49
49
struct aws_string * region ;
50
50
struct aws_string * host ;
51
+ struct aws_http_headers * headers ;
51
52
52
53
struct {
53
54
/* Protected by the impl lock */
@@ -66,6 +67,7 @@ static struct aws_s3express_session *s_aws_s3express_session_new(
66
67
const struct aws_string * hash_key ,
67
68
const struct aws_string * region ,
68
69
const struct aws_string * host ,
70
+ struct aws_http_headers * headers ,
69
71
struct aws_credentials * credentials ) {
70
72
71
73
struct aws_s3express_session * session =
@@ -74,6 +76,8 @@ static struct aws_s3express_session *s_aws_s3express_session_new(
74
76
session -> impl = provider -> impl ;
75
77
session -> hash_key = aws_string_new_from_string (provider -> allocator , hash_key );
76
78
session -> host = aws_string_new_from_string (provider -> allocator , host );
79
+ aws_http_headers_acquire (headers );
80
+ session -> headers = headers ;
77
81
if (region ) {
78
82
session -> region = aws_string_new_from_string (provider -> allocator , region );
79
83
}
@@ -94,6 +98,7 @@ static void s_aws_s3express_session_destroy(struct aws_s3express_session *sessio
94
98
aws_string_destroy (session -> hash_key );
95
99
aws_string_destroy (session -> region );
96
100
aws_string_destroy (session -> host );
101
+ aws_http_headers_release (session -> headers );
97
102
aws_credentials_release (session -> s3express_credentials );
98
103
aws_mem_release (session -> allocator , session );
99
104
}
@@ -368,6 +373,7 @@ static void s_on_request_finished(
368
373
session_creator -> hash_key ,
369
374
session_creator -> region ,
370
375
session_creator -> host ,
376
+ session_creator -> headers ,
371
377
credentials );
372
378
aws_cache_put (impl -> synced_data .cache , session -> hash_key , session );
373
379
}
@@ -434,6 +440,7 @@ static struct aws_s3express_session_creator *s_aws_s3express_session_creator_des
434
440
aws_string_destroy (session_creator -> hash_key );
435
441
aws_string_destroy (session_creator -> region );
436
442
aws_string_destroy (session_creator -> host );
443
+ aws_http_headers_release (session_creator -> headers );
437
444
438
445
aws_byte_buf_clean_up (& session_creator -> response_buf );
439
446
aws_mem_release (session_creator -> allocator , session_creator );
@@ -447,8 +454,9 @@ static struct aws_s3express_session_creator *s_aws_s3express_session_creator_des
447
454
struct aws_string * aws_encode_s3express_hash_key_new (
448
455
struct aws_allocator * allocator ,
449
456
const struct aws_credentials * original_credentials ,
450
- struct aws_byte_cursor host_value ) {
451
-
457
+ struct aws_byte_cursor host_value ,
458
+ struct aws_http_headers * headers ) {
459
+ (void )headers ;
452
460
struct aws_byte_buf combine_key_buf ;
453
461
454
462
/* 1. Combine access_key and secret_access_key into one buffer */
@@ -500,6 +508,8 @@ static struct aws_s3express_session_creator *s_session_creator_new(
500
508
session_creator -> provider = provider ;
501
509
session_creator -> host = aws_string_new_from_cursor (session_creator -> allocator , & s3express_properties -> host );
502
510
session_creator -> region = aws_string_new_from_cursor (session_creator -> allocator , & s3express_properties -> region );
511
+ aws_http_headers_acquire (s3express_properties -> headers );
512
+ session_creator -> headers = s3express_properties -> headers ;
503
513
504
514
struct aws_signing_config_aws s3express_signing_config = {
505
515
.credentials = original_credentials ,
@@ -556,8 +566,8 @@ static int s_s3express_get_creds(
556
566
557
567
uint64_t current_stamp = UINT64_MAX ;
558
568
aws_sys_clock_get_ticks (& current_stamp );
559
- struct aws_string * hash_key =
560
- aws_encode_s3express_hash_key_new ( provider -> allocator , original_credentials , s3express_properties -> host );
569
+ struct aws_string * hash_key = aws_encode_s3express_hash_key_new (
570
+ provider -> allocator , original_credentials , s3express_properties -> host , s3express_properties -> headers );
561
571
uint64_t now_seconds = aws_timestamp_convert (current_stamp , AWS_TIMESTAMP_NANOS , AWS_TIMESTAMP_SECS , NULL );
562
572
563
573
s_credentials_provider_s3express_impl_lock_synced_data (impl );
@@ -764,7 +774,8 @@ static void s_refresh_session_list(
764
774
struct aws_string * current_creds_hash = aws_encode_s3express_hash_key_new (
765
775
provider -> allocator ,
766
776
current_original_credentials ,
767
- aws_byte_cursor_from_string (session -> host ));
777
+ aws_byte_cursor_from_string (session -> host ),
778
+ session -> headers );
768
779
bool creds_match = aws_string_eq (current_creds_hash , hash_key );
769
780
aws_string_destroy (current_creds_hash );
770
781
if (!creds_match ) {
@@ -784,6 +795,7 @@ static void s_refresh_session_list(
784
795
785
796
struct aws_credentials_properties_s3express s3express_properties = {
786
797
.host = aws_byte_cursor_from_string (session -> host ),
798
+ .headers = session -> headers ,
787
799
};
788
800
if (session -> region ) {
789
801
s3express_properties .region = aws_byte_cursor_from_string (session -> region );
0 commit comments