diff --git a/trpc/client/http/http_service_proxy.h b/trpc/client/http/http_service_proxy.h index cf65732e..b01a637a 100644 --- a/trpc/client/http/http_service_proxy.h +++ b/trpc/client/http/http_service_proxy.h @@ -394,6 +394,7 @@ Status HttpServiceProxy::HttpUnaryInvoke(const ClientContextPtr& context, const if (context->GetStatus().OK()) { auto* ret_rsp = static_cast(rsp_protocol.get()); + ret_rsp->response.SetNonContiguousBufferContent(ret_rsp->GetNonContiguousProtocolBody()); *rsp = std::move(ret_rsp->response); } return context->GetStatus(); @@ -425,6 +426,7 @@ Future HttpServiceProxy::AsyncHttpUnaryInvoke(const ClientConte ProtocolPtr& rsp_protocol = context->GetResponse(); auto* rsp = static_cast(rsp_protocol.get()); + rsp->response.SetNonContiguousBufferContent(rsp->GetNonContiguousProtocolBody()); return MakeReadyFuture(std::move(rsp->response)); } return MakeExceptionFuture(rsp_fut.GetException()); diff --git a/trpc/client/http/http_service_proxy_test.cc b/trpc/client/http/http_service_proxy_test.cc index cdac803a..a3854d34 100644 --- a/trpc/client/http/http_service_proxy_test.cc +++ b/trpc/client/http/http_service_proxy_test.cc @@ -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(ctx->GetRequest().get()); EXPECT_EQ(http_req_protocol->request->GetMethodType(), http::OperationType::POST); @@ -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)); diff --git a/trpc/transport/common/ssl/ssl.cc b/trpc/transport/common/ssl/ssl.cc index 1f62850f..e68eece1 100644 --- a/trpc/transport/common/ssl/ssl.cc +++ b/trpc/transport/common/ssl/ssl.cc @@ -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; } diff --git a/trpc/util/object_pool/object_pool.h b/trpc/util/object_pool/object_pool.h index c3c87f95..4eab0f42 100644 --- a/trpc/util/object_pool/object_pool.h +++ b/trpc/util/object_pool/object_pool.h @@ -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; /// }; @@ -90,6 +91,7 @@ inline void Delete(T* ptr) { /// #endif /// A* a_p = trpc::object_pool::New(); /// trpc::object_pool::Delete(a_p); +/// @endcode template T* New(Args&&... args) { // Remove CV attributes. We do not differentiate between T, const T, volatile T, and const volatile T,