Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions trpc/client/http/http_service_proxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ Status HttpServiceProxy::HttpUnaryInvoke(const ClientContextPtr& context, const

if (context->GetStatus().OK()) {
auto* ret_rsp = static_cast<HttpResponseProtocol*>(rsp_protocol.get());
ret_rsp->response.SetNonContiguousBufferContent(ret_rsp->GetNonContiguousProtocolBody());
*rsp = std::move(ret_rsp->response);
}
return context->GetStatus();
Expand Down Expand Up @@ -425,6 +426,7 @@ Future<ResponseMessage> HttpServiceProxy::AsyncHttpUnaryInvoke(const ClientConte

ProtocolPtr& rsp_protocol = context->GetResponse();
auto* rsp = static_cast<HttpResponseProtocol*>(rsp_protocol.get());
rsp->response.SetNonContiguousBufferContent(rsp->GetNonContiguousProtocolBody());
return MakeReadyFuture<ResponseMessage>(std::move(rsp->response));
}
return MakeExceptionFuture<ResponseMessage>(rsp_fut.GetException());
Expand Down
2 changes: 2 additions & 0 deletions trpc/client/http/http_service_proxy_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3335,6 +3335,7 @@ TEST_F(HttpServiceProxyTest, HttpUnaryInvoke) {
EXPECT_EQ(reply.GetVersion(), rep.GetVersion());
EXPECT_EQ(reply.GetStatus(), rep.GetStatus());
EXPECT_EQ(str, rep.GetContent());
EXPECT_EQ(str, FlattenSlow(rep.GetNonContiguousBufferContent()));

HttpRequestProtocol* http_req_protocol = static_cast<HttpRequestProtocol*>(ctx->GetRequest().get());
EXPECT_EQ(http_req_protocol->request->GetMethodType(), http::OperationType::POST);
Expand All @@ -3354,6 +3355,7 @@ TEST_F(HttpServiceProxyTest, HttpUnaryInvoke) {
EXPECT_EQ(reply.GetVersion(), rep.GetVersion());
EXPECT_EQ(reply.GetStatus(), rep.GetStatus());
EXPECT_EQ(str, rep.GetContent());
EXPECT_EQ(str, FlattenSlow(rep.GetNonContiguousBufferContent()));
return MakeReadyFuture<>();
});
future::BlockingGet(std::move(async_unary_invoke_fut));
Expand Down
14 changes: 11 additions & 3 deletions trpc/transport/common/ssl/ssl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -636,11 +636,19 @@ bool SslContext::SetSslVerifyPeerOptions(const std::string& cert_path, int verif
} else {
SSL_CTX_set_verify(ssl_ctx_, SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT, nullptr);
SSL_CTX_set_verify_depth(ssl_ctx_, verify_depth);
if (!cert_path.empty() && SSL_CTX_load_verify_locations(ssl_ctx_, cert_path.c_str(), nullptr) == 0) {
TRPC_LOG_ERROR("SSL_CTX_load_verify_locations() failed, cert path:" << cert_path);
return false;
if (!cert_path.empty()) {
if (SSL_CTX_load_verify_locations(ssl_ctx_, cert_path.c_str(), nullptr) == 0) {
TRPC_LOG_ERROR("SSL_CTX_load_verify_locations() failed, cert path:" << cert_path);
return false;
}
} else { // 用户没有设置CA证书路径时,使用系统默认的证书
if (SSL_CTX_set_default_verify_paths(ssl_ctx_) == 0) {
TRPC_LOG_ERROR("SSL_CTX_set_default_verify_paths() failed");
return false;
}
}
}

return true;
}

Expand Down
4 changes: 3 additions & 1 deletion trpc/util/object_pool/object_pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ inline void Delete(T* ptr) {
} // namespace detail

/// @brief Allocate and construct an object (thread-safe).
/// @example
/// @code
/// example
/// struct A {
/// int a;
/// };
Expand All @@ -90,6 +91,7 @@ inline void Delete(T* ptr) {
/// #endif
/// A* a_p = trpc::object_pool::New<A>();
/// trpc::object_pool::Delete(a_p);
/// @endcode
template <class T, class... Args>
T* New(Args&&... args) {
// Remove CV attributes. We do not differentiate between T, const T, volatile T, and const volatile T,
Expand Down