Skip to content

Commit 5bb0545

Browse files
committed
changing the streambuff type to a vector
1 parent 3834efd commit 5bb0545

File tree

4 files changed

+11
-32
lines changed

4 files changed

+11
-32
lines changed

src/aws-cpp-sdk-core/include/smithy/client/AwsSmithyClientBase.h

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -100,18 +100,12 @@ namespace client
100100
m_serviceName(std::move(serviceName)),
101101
m_serviceUserAgentName(std::move(serviceUserAgentName)),
102102
m_httpClient(std::move(httpClient)),
103-
m_errorMarshaller(std::move(errorMarshaller))
103+
m_errorMarshaller(std::move(errorMarshaller)),
104+
m_interceptors({
105+
Aws::MakeShared<ChecksumInterceptor>("AwsSmithyClientBase", *m_clientConfig),
106+
Aws::MakeShared<features::ChunkingInterceptor>("AwsSmithyClientBase", *m_clientConfig, m_httpClient->IsDefaultAwsHttpClient())
107+
})
104108
{
105-
// Create modified config for chunking interceptor
106-
Aws::Client::ClientConfiguration chunkingConfig(*m_clientConfig);
107-
if (!m_httpClient->IsDefaultAwsHttpClient()) {
108-
chunkingConfig.httpClientChunkedMode = Aws::Client::HttpClientChunkedMode::CLIENT_IMPLEMENTATION;
109-
}
110-
111-
m_interceptors = {
112-
Aws::MakeShared<ChecksumInterceptor>("AwsSmithyClientBase", *m_clientConfig),
113-
Aws::MakeShared<features::ChunkingInterceptor>("AwsSmithyClientBase", chunkingConfig)
114-
};
115109

116110
baseInit();
117111
}

src/aws-cpp-sdk-core/include/smithy/client/features/ChunkingInterceptor.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ class AwsChunkedStreamBuf : public std::streambuf {
4242
if (m_request == nullptr) {
4343
AWS_LOGSTREAM_ERROR("AwsChunkedStream", "request is null");
4444
}
45-
46-
setg(nullptr, nullptr, nullptr);
4745
}
4846

4947
protected:
@@ -134,8 +132,8 @@ class AwsChunkedIOStream : public Aws::IOStream {
134132
*/
135133
class ChunkingInterceptor : public smithy::interceptor::Interceptor {
136134
public:
137-
explicit ChunkingInterceptor(const Aws::Client::ClientConfiguration& config)
138-
: m_httpClientChunkedMode(config.httpClientChunkedMode) {}
135+
explicit ChunkingInterceptor(const Aws::Client::ClientConfiguration& config, bool isDefaultHttpClient = true)
136+
: m_httpClientChunkedMode(isDefaultHttpClient ? config.httpClientChunkedMode : Aws::Client::HttpClientChunkedMode::CLIENT_IMPLEMENTATION) {}
139137
~ChunkingInterceptor() override = default;
140138

141139
ModifyRequestOutcome ModifyBeforeSigning(smithy::interceptor::InterceptorContext& context) override {

src/aws-cpp-sdk-core/source/client/AWSClient.cpp

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,7 @@ struct RequestInfo
118118
}
119119
};
120120

121-
static ClientConfiguration GetChunkingConfig(const ClientConfiguration& config, const std::shared_ptr<HttpClient>& httpClient)
122-
{
123-
ClientConfiguration chunkingConfig(config);
124-
if (!httpClient->IsDefaultAwsHttpClient()) {
125-
chunkingConfig.httpClientChunkedMode = HttpClientChunkedMode::CLIENT_IMPLEMENTATION;
126-
}
127-
return chunkingConfig;
128-
}
121+
129122

130123
AWSClient::AWSClient(const Aws::Client::ClientConfiguration& configuration,
131124
const std::shared_ptr<Aws::Client::AWSAuthSigner>& signer,
@@ -149,7 +142,7 @@ AWSClient::AWSClient(const Aws::Client::ClientConfiguration& configuration,
149142
m_enableClockSkewAdjustment(configuration.enableClockSkewAdjustment),
150143
m_requestCompressionConfig(configuration.requestCompressionConfig),
151144
m_userAgentInterceptor{Aws::MakeShared<smithy::client::UserAgentInterceptor>(AWS_CLIENT_LOG_TAG, configuration, m_retryStrategy->GetStrategyName(), m_serviceName)},
152-
m_interceptors{Aws::MakeShared<smithy::client::ChecksumInterceptor>(AWS_CLIENT_LOG_TAG), Aws::MakeShared<smithy::client::features::ChunkingInterceptor>(AWS_CLIENT_LOG_TAG, GetChunkingConfig(configuration, m_httpClient)), m_userAgentInterceptor}
145+
m_interceptors{Aws::MakeShared<smithy::client::ChecksumInterceptor>(AWS_CLIENT_LOG_TAG), Aws::MakeShared<smithy::client::features::ChunkingInterceptor>(AWS_CLIENT_LOG_TAG, configuration, m_httpClient->IsDefaultAwsHttpClient()), m_userAgentInterceptor}
153146
{
154147
}
155148

@@ -175,7 +168,7 @@ AWSClient::AWSClient(const Aws::Client::ClientConfiguration& configuration,
175168
m_enableClockSkewAdjustment(configuration.enableClockSkewAdjustment),
176169
m_requestCompressionConfig(configuration.requestCompressionConfig),
177170
m_userAgentInterceptor{Aws::MakeShared<smithy::client::UserAgentInterceptor>(AWS_CLIENT_LOG_TAG, configuration, m_retryStrategy->GetStrategyName(), m_serviceName)},
178-
m_interceptors{Aws::MakeShared<smithy::client::ChecksumInterceptor>(AWS_CLIENT_LOG_TAG, configuration), Aws::MakeShared<smithy::client::features::ChunkingInterceptor>(AWS_CLIENT_LOG_TAG, GetChunkingConfig(configuration, m_httpClient)), m_userAgentInterceptor}
171+
m_interceptors{Aws::MakeShared<smithy::client::ChecksumInterceptor>(AWS_CLIENT_LOG_TAG, configuration), Aws::MakeShared<smithy::client::features::ChunkingInterceptor>(AWS_CLIENT_LOG_TAG, configuration, m_httpClient->IsDefaultAwsHttpClient()), m_userAgentInterceptor}
179172
{
180173
}
181174

src/aws-cpp-sdk-core/source/smithy/client/AwsSmithyClientBase.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,9 @@ void AwsSmithyClientBase::baseCopyAssign(const AwsSmithyClientBase& other,
104104
m_httpClient = std::move(httpClient);
105105
m_errorMarshaller = std::move(errorMarshaller);
106106

107-
// Create modified config for chunking interceptor
108-
Aws::Client::ClientConfiguration chunkingConfig(*m_clientConfig);
109-
if (!m_httpClient->IsDefaultAwsHttpClient()) {
110-
chunkingConfig.httpClientChunkedMode = Aws::Client::HttpClientChunkedMode::CLIENT_IMPLEMENTATION;
111-
}
112-
113107
m_interceptors = Aws::Vector<std::shared_ptr<interceptor::Interceptor>>{
114108
Aws::MakeShared<ChecksumInterceptor>("AwsSmithyClientBase", *m_clientConfig),
115-
Aws::MakeShared<features::ChunkingInterceptor>("AwsSmithyClientBase", chunkingConfig)
109+
Aws::MakeShared<features::ChunkingInterceptor>("AwsSmithyClientBase", *m_clientConfig, m_httpClient->IsDefaultAwsHttpClient())
116110
};
117111

118112
baseCopyInit();

0 commit comments

Comments
 (0)