File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change 19
19
20
20
#include < aws/core/Region.h>
21
21
#include < aws/core/utils/memory/AWSMemory.h>
22
+ #include < aws/core/utils/memory/stl/AWSSet.h>
22
23
#include < aws/core/utils/DateTime.h>
23
24
#include < aws/core/utils/Array.h>
24
25
@@ -130,13 +131,16 @@ namespace Aws
130
131
Aws::String GenerateStringToSign (const Aws::String& dateValue, const Aws::String& simpleDate, const Aws::String& canonicalRequestHash) const ;
131
132
const Aws::Utils::ByteBuffer& ComputeLongLivedHash (const Aws::String& secretKey, const Aws::String& simpleDate) const ;
132
133
133
- static bool ShouldSignHeader (const Aws::String& header);
134
+ bool ShouldSignHeader (const Aws::String& header) const ;
134
135
135
136
std::shared_ptr<Auth::AWSCredentialsProvider> m_credentialsProvider;
136
137
Aws::String m_serviceName;
137
138
Aws::String m_region;
138
139
Aws::UniquePtr<Aws::Utils::Crypto::Sha256> m_hash;
139
140
Aws::UniquePtr<Aws::Utils::Crypto::Sha256HMAC> m_HMAC;
141
+
142
+ Aws::Set<Aws::String> m_unsignedHeaders;
143
+
140
144
// these next four fields are ONLY for caching purposes and do not change
141
145
// the logical state of the signer. They are marked mutable so the
142
146
// interface can remain const.
Original file line number Diff line number Diff line change @@ -129,6 +129,7 @@ AWSAuthV4Signer::AWSAuthV4Signer(const std::shared_ptr<Auth::AWSCredentialsProvi
129
129
m_region(region),
130
130
m_hash(Aws::MakeUnique<Aws::Utils::Crypto::Sha256>(v4LogTag)),
131
131
m_HMAC(Aws::MakeUnique<Aws::Utils::Crypto::Sha256HMAC>(v4LogTag)),
132
+ m_unsignedHeaders({" user-agent" , " x-amzn-trace-id" }),
132
133
m_signPayloads(signPayloads),
133
134
m_urlEscapePath(urlEscapePath)
134
135
{
@@ -141,10 +142,10 @@ AWSAuthV4Signer::~AWSAuthV4Signer()
141
142
// empty destructor in .cpp file to keep from needing the implementation of (AWSCredentialsProvider, Sha256, Sha256HMAC) in the header file
142
143
}
143
144
144
- // If this ever grows, convert to a static hash set initialized on InitAPI
145
- bool AWSAuthV4Signer::ShouldSignHeader (const Aws::String& header)
145
+
146
+ bool AWSAuthV4Signer::ShouldSignHeader (const Aws::String& header) const
146
147
{
147
- return Aws::Utils::StringUtils::ToLower (header.c_str ()) != Aws::String ( " x-amzn-trace-id " );
148
+ return m_unsignedHeaders. find ( Aws::Utils::StringUtils::ToLower (header.c_str ())) == m_unsignedHeaders. cend ( );
148
149
}
149
150
150
151
bool AWSAuthV4Signer::SignRequest (Aws::Http::HttpRequest& request) const
You can’t perform that action at this time.
0 commit comments