Merge master

pull/37053/head
tanvi-jagtap 5 months ago
commit 54224e3d63
  1. 4
      src/core/BUILD
  2. 28
      src/core/ext/transport/chaotic_good/chaotic_good_transport.h
  3. 4
      src/core/ext/transport/chaotic_good/client/chaotic_good_connector.cc
  4. 6
      src/core/ext/transport/chaotic_good/client_transport.cc
  5. 12
      src/core/ext/transport/chaotic_good/server/chaotic_good_server.cc
  6. 69
      src/core/ext/transport/chaotic_good/server_transport.cc
  7. 7
      src/core/ext/transport/cronet/client/secure/cronet_channel_create.cc
  8. 16
      src/core/ext/transport/cronet/transport/cronet_transport.cc
  9. 8
      src/core/ext/transport/inproc/inproc_transport.cc
  10. 36
      src/core/handshaker/handshaker.cc
  11. 10
      src/core/handshaker/http_connect/http_connect_handshaker.cc
  12. 40
      src/core/handshaker/http_connect/http_proxy_mapper.cc
  13. 20
      src/core/handshaker/security/secure_endpoint.cc

@ -7167,7 +7167,7 @@ grpc_cc_library(
"ext/transport/inproc/legacy_inproc_transport.h",
],
external_deps = [
"absl/log",
"absl/log:log",
"absl/log:check",
"absl/status",
"absl/status:statusor",
@ -7517,6 +7517,7 @@ grpc_cc_library(
"absl/container:flat_hash_map",
"absl/functional:any_invocable",
"absl/log:check",
"absl/log:log",
"absl/random",
"absl/random:bit_gen_ref",
"absl/status",
@ -7959,6 +7960,7 @@ grpc_cc_library(
],
external_deps = [
"absl/log:check",
"absl/log:log",
"absl/random",
"absl/random:bit_gen_ref",
"absl/status",

@ -18,6 +18,7 @@
#include <cstdint>
#include <utility>
#include "absl/log/log.h"
#include "absl/random/random.h"
#include <grpc/support/port_platform.h>
@ -56,11 +57,10 @@ class ChaoticGoodTransport : public RefCounted<ChaoticGoodTransport> {
auto buffers = frame.Serialize(&encoder_, saw_encoding_errors);
// ignore encoding errors: they will be logged separately already
if (GRPC_TRACE_FLAG_ENABLED(chaotic_good)) {
gpr_log(GPR_INFO, "CHAOTIC_GOOD: WriteFrame to:%s %s",
ResolvedAddressToString(control_endpoint_.GetPeerAddress())
.value_or("<<unknown peer address>>")
.c_str(),
frame.ToString().c_str());
LOG(INFO) << "CHAOTIC_GOOD: WriteFrame to:"
<< ResolvedAddressToString(control_endpoint_.GetPeerAddress())
.value_or("<<unknown peer address>>")
<< " " << frame.ToString();
}
return TryJoin<absl::StatusOr>(
control_endpoint_.Write(std::move(buffers.control)),
@ -77,13 +77,13 @@ class ChaoticGoodTransport : public RefCounted<ChaoticGoodTransport> {
FrameHeader::Parse(reinterpret_cast<const uint8_t*>(
GRPC_SLICE_START_PTR(read_buffer.c_slice())));
if (GRPC_TRACE_FLAG_ENABLED(chaotic_good)) {
gpr_log(GPR_INFO, "CHAOTIC_GOOD: ReadHeader from:%s %s",
ResolvedAddressToString(control_endpoint_.GetPeerAddress())
.value_or("<<unknown peer address>>")
.c_str(),
frame_header.ok()
? frame_header->ToString().c_str()
: frame_header.status().ToString().c_str());
LOG(INFO) << "CHAOTIC_GOOD: ReadHeader from:"
<< ResolvedAddressToString(
control_endpoint_.GetPeerAddress())
.value_or("<<unknown peer address>>")
<< " "
<< (frame_header.ok() ? frame_header->ToString()
: frame_header.status().ToString());
}
// Read header and trailers from control endpoint.
// Read message padding and message from data endpoint.
@ -126,8 +126,8 @@ class ChaoticGoodTransport : public RefCounted<ChaoticGoodTransport> {
auto s = frame.Deserialize(&parser_, header, bitgen_, arena,
std::move(buffers), limits);
if (GRPC_TRACE_FLAG_ENABLED(chaotic_good)) {
gpr_log(GPR_INFO, "CHAOTIC_GOOD: DeserializeFrame %s",
s.ok() ? frame.ToString().c_str() : s.ToString().c_str());
LOG(INFO) << "CHAOTIC_GOOD: DeserializeFrame "
<< (s.ok() ? frame.ToString() : s.ToString());
}
return s;
}

@ -19,6 +19,7 @@
#include <utility>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/random/bit_gen_ref.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
@ -319,8 +320,7 @@ void ChaoticGoodConnector::OnHandshakeDone(
EventEngineWakeupScheduler(event_engine_),
[self = RefAsSubclass<ChaoticGoodConnector>()](absl::Status status) {
if (GRPC_TRACE_FLAG_ENABLED(chaotic_good)) {
gpr_log(GPR_INFO, "ChaoticGoodConnector::OnHandshakeDone: %s",
status.ToString().c_str());
LOG(INFO) << "ChaoticGoodConnector::OnHandshakeDone: " << status;
}
if (status.ok()) {
MutexLock lock(&self->mu_);

@ -22,6 +22,7 @@
#include <utility>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/random/bit_gen_ref.h"
#include "absl/random/random.h"
#include "absl/status/status.h"
@ -29,7 +30,6 @@
#include <grpc/event_engine/event_engine.h>
#include <grpc/slice.h>
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
#include "src/core/ext/transport/chaotic_good/chaotic_good_transport.h"
@ -281,8 +281,8 @@ auto ChaoticGoodClientTransport::CallOutboundLoop(uint32_t stream_id,
call_handler.PullClientInitialMetadata(),
[send_fragment](ClientMetadataHandle md) mutable {
if (GRPC_TRACE_FLAG_ENABLED(chaotic_good)) {
gpr_log(GPR_INFO, "CHAOTIC_GOOD: Sending initial metadata: %s",
md->DebugString().c_str());
LOG(INFO) << "CHAOTIC_GOOD: Sending initial metadata: "
<< md->DebugString();
}
ClientFragmentFrame frame;
frame.headers = std::move(md);

@ -30,7 +30,6 @@
#include <grpc/event_engine/event_engine.h>
#include <grpc/grpc.h>
#include <grpc/slice.h>
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
#include "src/core/ext/transport/chaotic_good/frame.h"
@ -114,8 +113,7 @@ absl::StatusOr<int> ChaoticGoodServerListener::Bind(
};
auto shutdown_cb = [](absl::Status status) {
if (!status.ok()) {
gpr_log(GPR_ERROR, "Server accept connection failed: %s",
StatusToString(status).c_str());
LOG(ERROR) << "Server accept connection failed: " << status;
}
};
CHECK_NE(event_engine_, nullptr);
@ -303,10 +301,10 @@ auto ChaoticGoodServerListener::ActiveConnection::HandshakingState::
[self](PromiseEndpoint ret) -> absl::Status {
MutexLock lock(&self->connection_->listener_->mu_);
if (GRPC_TRACE_FLAG_ENABLED(chaotic_good)) {
gpr_log(
GPR_INFO, "%p Data endpoint setup done: shutdown=%s",
self->connection_.get(),
self->connection_->listener_->shutdown_ ? "true" : "false");
LOG(INFO) << self->connection_.get()
<< " Data endpoint setup done: shutdown="
<< (self->connection_->listener_->shutdown_ ? "true"
: "false");
}
if (self->connection_->listener_->shutdown_) {
return absl::UnavailableError("Server shutdown");

@ -19,6 +19,7 @@
#include <tuple>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/random/bit_gen_ref.h"
#include "absl/random/random.h"
#include "absl/status/status.h"
@ -27,7 +28,6 @@
#include <grpc/event_engine/event_engine.h>
#include <grpc/grpc.h>
#include <grpc/slice.h>
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
#include "src/core/ext/transport/chaotic_good/chaotic_good_transport.h"
@ -76,8 +76,8 @@ auto ChaoticGoodServerTransport::PushFragmentIntoCall(
uint32_t stream_id) {
DCHECK(frame.headers == nullptr);
if (GRPC_TRACE_FLAG_ENABLED(chaotic_good)) {
gpr_log(GPR_INFO, "CHAOTIC_GOOD: PushFragmentIntoCall: frame=%s",
frame.ToString().c_str());
LOG(INFO) << "CHAOTIC_GOOD: PushFragmentIntoCall: frame="
<< frame.ToString();
}
return Seq(If(
frame.message.has_value(),
@ -89,7 +89,7 @@ auto ChaoticGoodServerTransport::PushFragmentIntoCall(
[this, call_initiator, end_of_stream = frame.end_of_stream,
stream_id](StatusFlag status) mutable -> StatusFlag {
if (!status.ok() && GRPC_TRACE_FLAG_ENABLED(chaotic_good)) {
gpr_log(GPR_INFO, "CHAOTIC_GOOD: Failed PushFragmentIntoCall");
LOG(INFO) << "CHAOTIC_GOOD: Failed PushFragmentIntoCall";
}
if (end_of_stream || !status.ok()) {
call_initiator.FinishSends();
@ -124,10 +124,8 @@ auto ChaoticGoodServerTransport::MaybePushFragmentIntoCall(
// already been removed from the stream_map and hence the EOF frame
// cannot be pushed into the call. No need to log such frames.
if (!frame.end_of_stream) {
gpr_log(
GPR_INFO,
"CHAOTIC_GOOD: Cannot pass frame to stream. Error:%s Frame:%s",
error.ToString().c_str(), frame.ToString().c_str());
LOG(INFO) << "CHAOTIC_GOOD: Cannot pass frame to stream. Error:"
<< error.ToString() << " Frame:" << frame.ToString();
}
return Immediate(std::move(error));
});
@ -137,8 +135,7 @@ auto ChaoticGoodServerTransport::SendFragment(
ServerFragmentFrame frame, MpscSender<ServerFrame> outgoing_frames,
CallInitiator call_initiator) {
if (GRPC_TRACE_FLAG_ENABLED(chaotic_good)) {
gpr_log(GPR_INFO, "CHAOTIC_GOOD: SendFragment: frame=%s",
frame.ToString().c_str());
LOG(INFO) << "CHAOTIC_GOOD: SendFragment: frame=" << frame.ToString();
}
// Capture the call_initiator to ensure the underlying call spine is alive
// until the outgoing_frames.Send promise completes.
@ -189,9 +186,8 @@ auto ChaoticGoodServerTransport::SendCallInitialMetadataAndBody(
[stream_id, outgoing_frames, call_initiator,
this](absl::optional<ServerMetadataHandle> md) mutable {
if (GRPC_TRACE_FLAG_ENABLED(chaotic_good)) {
gpr_log(GPR_INFO,
"CHAOTIC_GOOD: SendCallInitialMetadataAndBody: md=%s",
md.has_value() ? (*md)->DebugString().c_str() : "null");
LOG(INFO) << "CHAOTIC_GOOD: SendCallInitialMetadataAndBody: md="
<< (md.has_value() ? (*md)->DebugString() : "null");
}
return If(
md.has_value(),
@ -211,28 +207,26 @@ auto ChaoticGoodServerTransport::SendCallInitialMetadataAndBody(
auto ChaoticGoodServerTransport::CallOutboundLoop(
uint32_t stream_id, CallInitiator call_initiator) {
auto outgoing_frames = outgoing_frames_.MakeSender();
return Seq(Map(SendCallInitialMetadataAndBody(stream_id, outgoing_frames,
call_initiator),
[stream_id](absl::Status main_body_result) {
if (GRPC_TRACE_FLAG_ENABLED(chaotic_good)) {
gpr_log(GPR_DEBUG,
"CHAOTIC_GOOD: CallOutboundLoop: stream_id=%d "
"main_body_result=%s",
stream_id, main_body_result.ToString().c_str());
}
return Empty{};
}),
call_initiator.PullServerTrailingMetadata(),
// Capture the call_initator to ensure the underlying call_spine
// is alive until the SendFragment promise completes.
[stream_id, outgoing_frames,
call_initiator](ServerMetadataHandle md) mutable {
ServerFragmentFrame frame;
frame.trailers = std::move(md);
frame.stream_id = stream_id;
return SendFragment(std::move(frame), outgoing_frames,
call_initiator);
});
return Seq(
Map(SendCallInitialMetadataAndBody(stream_id, outgoing_frames,
call_initiator),
[stream_id](absl::Status main_body_result) {
if (GRPC_TRACE_FLAG_ENABLED(chaotic_good)) {
VLOG(2) << "CHAOTIC_GOOD: CallOutboundLoop: stream_id="
<< stream_id << " main_body_result=" << main_body_result;
}
return Empty{};
}),
call_initiator.PullServerTrailingMetadata(),
// Capture the call_initator to ensure the underlying call_spine
// is alive until the SendFragment promise completes.
[stream_id, outgoing_frames,
call_initiator](ServerMetadataHandle md) mutable {
ServerFragmentFrame frame;
frame.trailers = std::move(md);
frame.stream_id = stream_id;
return SendFragment(std::move(frame), outgoing_frames, call_initiator);
});
}
auto ChaoticGoodServerTransport::DeserializeAndPushFragmentToNewCall(
@ -347,9 +341,8 @@ auto ChaoticGoodServerTransport::OnTransportActivityDone(
return [self = RefAsSubclass<ChaoticGoodServerTransport>(),
activity](absl::Status status) {
if (GRPC_TRACE_FLAG_ENABLED(chaotic_good)) {
gpr_log(GPR_INFO,
"CHAOTIC_GOOD: OnTransportActivityDone: activity=%s status=%s",
std::string(activity).c_str(), status.ToString().c_str());
LOG(INFO) << "CHAOTIC_GOOD: OnTransportActivityDone: activity="
<< activity << " status=" << status;
}
self->AbortWithError();
};

@ -18,10 +18,10 @@
#include "src/core/ext/transport/cronet/client/secure/cronet_channel_create.h"
#include "absl/log/log.h"
#include "absl/status/statusor.h"
#include <grpc/impl/channel_arg_names.h>
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
#include "src/core/ext/transport/cronet/transport/cronet_transport.h"
@ -38,9 +38,8 @@
GRPCAPI grpc_channel* grpc_cronet_secure_channel_create(
void* engine, const char* target, const grpc_channel_args* args,
void* reserved) {
gpr_log(GPR_DEBUG,
"grpc_create_cronet_transport: stream_engine = %p, target=%s", engine,
target);
VLOG(2) << "grpc_create_cronet_transport: stream_engine = " << engine
<< ", target=" << target;
// Disable client authority filter when using Cronet
auto channel_args = grpc_core::CoreConfiguration::Get()

@ -27,6 +27,7 @@
#include <utility>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/status/status.h"
#include "absl/strings/match.h"
#include "absl/strings/str_cat.h"
@ -39,7 +40,6 @@
#include <grpc/slice.h>
#include <grpc/status.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
#include <grpc/support/sync.h>
@ -446,11 +446,9 @@ static void convert_cronet_array_to_metadata(
}
mds->Append(header_array->headers[i].key, grpc_core::Slice(value),
[&](absl::string_view error, const grpc_core::Slice& value) {
gpr_log(GPR_DEBUG, "Failed to parse metadata: %s",
absl::StrCat("key=", header_array->headers[i].key,
" error=", error,
" value=", value.as_string_view())
.c_str());
VLOG(2) << "Failed to parse metadata: key="
<< header_array->headers[i].key << " error=" << error
<< " value=" << value.as_string_view();
});
}
}
@ -459,7 +457,7 @@ static void convert_cronet_array_to_metadata(
// Cronet callback
//
static void on_failed(bidirectional_stream* stream, int net_error) {
gpr_log(GPR_ERROR, "on_failed(%p, %d)", stream, net_error);
LOG(ERROR) << "on_failed(" << stream << ", " << net_error << ")";
grpc_core::ApplicationCallbackExecCtx callback_exec_ctx;
grpc_core::ExecCtx exec_ctx;
@ -1486,8 +1484,8 @@ grpc_core::Transport* grpc_create_cronet_transport(
if (0 ==
strcmp(args->args[i].key, GRPC_ARG_USE_CRONET_PACKET_COALESCING)) {
if (GPR_UNLIKELY(args->args[i].type != GRPC_ARG_INTEGER)) {
gpr_log(GPR_ERROR, "%s ignored: it must be an integer",
GRPC_ARG_USE_CRONET_PACKET_COALESCING);
LOG(ERROR) << GRPC_ARG_USE_CRONET_PACKET_COALESCING
<< " ignored: it must be an integer";
} else {
ct->use_packet_coalescing = (args->args[i].value.integer != 0);
}

@ -18,10 +18,10 @@
#include <memory>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/status/status.h"
#include <grpc/grpc.h>
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
#include "src/core/ext/transport/inproc/legacy_inproc_transport.h"
@ -77,8 +77,7 @@ class InprocServerTransport final : public ServerTransport {
void SetPollset(grpc_stream*, grpc_pollset*) override {}
void SetPollsetSet(grpc_stream*, grpc_pollset_set*) override {}
void PerformOp(grpc_transport_op* op) override {
gpr_log(GPR_INFO, "inproc server op: %s",
grpc_transport_op_string(op).c_str());
LOG(INFO) << "inproc server op: " << grpc_transport_op_string(op);
if (op->start_connectivity_watch != nullptr) {
connected_state()->AddWatcher(op->start_connectivity_watch_state,
std::move(op->start_connectivity_watch));
@ -240,8 +239,7 @@ InprocServerTransport::MakeClientTransport() {
RefCountedPtr<Channel> MakeLameChannel(absl::string_view why,
absl::Status error) {
gpr_log(GPR_ERROR, "%s: %s", std::string(why).c_str(),
std::string(error.message()).c_str());
LOG(ERROR) << why << ": " << error.message();
intptr_t integer;
grpc_status_code status = GRPC_STATUS_INTERNAL;
if (grpc_error_get_int(error, StatusIntProperty::kRpcStatus, &integer)) {

@ -25,6 +25,7 @@
#include "absl/functional/any_invocable.h"
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/strings/str_format.h"
@ -33,7 +34,6 @@
#include <grpc/event_engine/event_engine.h>
#include <grpc/slice_buffer.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
#include "src/core/lib/channel/channel_args.h"
@ -142,17 +142,15 @@ void HandshakeManager::Shutdown(absl::Status error) {
MutexLock lock(&mu_);
if (!is_shutdown_) {
if (GRPC_TRACE_FLAG_ENABLED(handshaker)) {
gpr_log(GPR_INFO, "handshake_manager %p: Shutdown() called: %s", this,
error.ToString().c_str());
LOG(INFO) << "handshake_manager " << this
<< ": Shutdown() called: " << error;
}
is_shutdown_ = true;
// Shutdown the handshaker that's currently in progress, if any.
if (index_ > 0) {
if (GRPC_TRACE_FLAG_ENABLED(handshaker)) {
gpr_log(
GPR_INFO,
"handshake_manager %p: shutting down handshaker at index %" PRIuPTR,
this, index_ - 1);
LOG(INFO) << "handshake_manager " << this
<< ": shutting down handshaker at index " << index_ - 1;
}
handshakers_[index_ - 1]->Shutdown(std::move(error));
}
@ -161,11 +159,9 @@ void HandshakeManager::Shutdown(absl::Status error) {
void HandshakeManager::CallNextHandshakerLocked(absl::Status error) {
if (GRPC_TRACE_FLAG_ENABLED(handshaker)) {
gpr_log(GPR_INFO,
"handshake_manager %p: error=%s shutdown=%d index=%" PRIuPTR
", args=%s",
this, error.ToString().c_str(), is_shutdown_, index_,
HandshakerArgsString(&args_).c_str());
LOG(INFO) << "handshake_manager " << this << ": error=" << error
<< " shutdown=" << is_shutdown_ << " index=" << index_
<< ", args=" << HandshakerArgsString(&args_);
}
CHECK(index_ <= handshakers_.size());
// If we got an error or we've been shut down or we're exiting early or
@ -178,10 +174,10 @@ void HandshakeManager::CallNextHandshakerLocked(absl::Status error) {
args_.endpoint.reset();
}
if (GRPC_TRACE_FLAG_ENABLED(handshaker)) {
gpr_log(GPR_INFO,
"handshake_manager %p: handshaking complete -- scheduling "
"on_handshake_done with error=%s",
this, error.ToString().c_str());
LOG(INFO) << "handshake_manager " << this
<< ": handshaking complete -- scheduling "
"on_handshake_done with error="
<< error;
}
// Cancel deadline timer, since we're invoking the on_handshake_done
// callback now.
@ -202,11 +198,9 @@ void HandshakeManager::CallNextHandshakerLocked(absl::Status error) {
// Call the next handshaker.
auto handshaker = handshakers_[index_];
if (GRPC_TRACE_FLAG_ENABLED(handshaker)) {
gpr_log(
GPR_INFO,
"handshake_manager %p: calling handshaker %s [%p] at index %" PRIuPTR,
this, std::string(handshaker->name()).c_str(), handshaker.get(),
index_);
LOG(INFO) << "handshake_manager " << this << ": calling handshaker "
<< handshaker->name() << " [" << handshaker.get() << "] at index "
<< index_;
}
++index_;
handshaker->DoHandshake(&args_, [self = Ref()](absl::Status error) mutable {

@ -26,6 +26,7 @@
#include <utility>
#include "absl/base/thread_annotations.h"
#include "absl/log/log.h"
#include "absl/status/status.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/string_view.h"
@ -34,7 +35,6 @@
#include <grpc/slice.h>
#include <grpc/slice_buffer.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
#include "src/core/handshaker/handshaker.h"
@ -279,8 +279,8 @@ void HttpConnectHandshaker::DoHandshake(
for (size_t i = 0; i < num_header_strings; ++i) {
char* sep = strchr(header_strings[i], ':');
if (sep == nullptr) {
gpr_log(GPR_ERROR, "skipping unparseable HTTP CONNECT header: %s",
header_strings[i]);
LOG(ERROR) << "skipping unparseable HTTP CONNECT header: "
<< header_strings[i];
continue;
}
*sep = '\0';
@ -296,8 +296,8 @@ void HttpConnectHandshaker::DoHandshake(
// Log connection via proxy.
std::string proxy_name(grpc_endpoint_get_peer(args->endpoint.get()));
std::string server_name_string(*server_name);
gpr_log(GPR_INFO, "Connecting to server %s via HTTP proxy %s",
server_name_string.c_str(), proxy_name.c_str());
LOG(INFO) << "Connecting to server " << server_name_string
<< " via HTTP proxy " << proxy_name;
// Construct HTTP CONNECT request.
grpc_http_request request;
request.method = const_cast<char*>("CONNECT");

@ -128,13 +128,12 @@ absl::optional<std::string> GetHttpProxyServer(
if (uri_str->empty()) return absl::nullopt;
uri = URI::Parse(*uri_str);
if (!uri.ok() || uri->authority().empty()) {
gpr_log(GPR_ERROR, "cannot parse value of 'http_proxy' env var. Error: %s",
uri.status().ToString().c_str());
LOG(ERROR) << "cannot parse value of 'http_proxy' env var. Error: "
<< uri.status();
return absl::nullopt;
}
if (uri->scheme() != "http") {
gpr_log(GPR_ERROR, "'%s' scheme not supported in proxy URI",
uri->scheme().c_str());
LOG(ERROR) << "'" << uri->scheme() << "' scheme not supported in proxy URI";
return absl::nullopt;
}
// Split on '@' to separate user credentials from host
@ -213,20 +212,18 @@ absl::optional<std::string> HttpProxyMapper::MapName(
if (!name_to_resolve.has_value()) return name_to_resolve;
absl::StatusOr<URI> uri = URI::Parse(server_uri);
if (!uri.ok() || uri->path().empty()) {
gpr_log(GPR_ERROR,
"'http_proxy' environment variable set, but cannot "
"parse server URI '%s' -- not using proxy. Error: %s",
std::string(server_uri).c_str(), uri.status().ToString().c_str());
LOG(ERROR) << "'http_proxy' environment variable set, but cannot "
"parse server URI '"
<< server_uri << "' -- not using proxy. Error: " << uri.status();
return absl::nullopt;
}
if (uri->scheme() == "unix") {
gpr_log(GPR_INFO, "not using proxy for Unix domain socket '%s'",
std::string(server_uri).c_str());
LOG(INFO) << "not using proxy for Unix domain socket '" << server_uri
<< "'";
return absl::nullopt;
}
if (uri->scheme() == "vsock") {
gpr_log(GPR_INFO, "not using proxy for VSock '%s'",
std::string(server_uri).c_str());
LOG(INFO) << "not using proxy for VSock '" << server_uri << "'";
return absl::nullopt;
}
// Prefer using 'no_grpc_proxy'. Fallback on 'no_proxy' if it is not set.
@ -239,18 +236,17 @@ absl::optional<std::string> HttpProxyMapper::MapName(
std::string server_port;
if (!SplitHostPort(absl::StripPrefix(uri->path(), "/"), &server_host,
&server_port)) {
gpr_log(GPR_INFO,
"unable to split host and port, not checking no_proxy list for "
"host '%s'",
std::string(server_uri).c_str());
LOG(INFO) << "unable to split host and port, not checking no_proxy list "
"for host '"
<< server_uri << "'";
} else {
auto address = StringToSockaddr(server_host, 0);
if (AddressIncluded(address.ok()
? absl::optional<grpc_resolved_address>(*address)
: absl::nullopt,
server_host, *no_proxy_str)) {
gpr_log(GPR_INFO, "not using proxy for host in no_proxy list '%s'",
std::string(server_uri).c_str());
LOG(INFO) << "not using proxy for host in no_proxy list '" << server_uri
<< "'";
return absl::nullopt;
}
}
@ -275,14 +271,14 @@ absl::optional<grpc_resolved_address> HttpProxyMapper::MapAddress(
}
auto address_string = grpc_sockaddr_to_string(&address, true);
if (!address_string.ok()) {
gpr_log(GPR_ERROR, "Unable to convert address to string: %s",
std::string(address_string.status().message()).c_str());
LOG(ERROR) << "Unable to convert address to string: "
<< address_string.status();
return absl::nullopt;
}
std::string host_name, port;
if (!SplitHostPort(*address_string, &host_name, &port)) {
gpr_log(GPR_ERROR, "Address %s cannot be split in host and port",
address_string->c_str());
LOG(ERROR) << "Address " << *address_string
<< " cannot be split in host and port";
return absl::nullopt;
}
auto enabled_addresses = GetChannelArgOrEnvVarValue(

@ -38,7 +38,6 @@
#include <grpc/slice_buffer.h>
#include <grpc/support/alloc.h>
#include <grpc/support/atm.h>
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
#include <grpc/support/sync.h>
@ -160,9 +159,8 @@ static void secure_endpoint_unref(secure_endpoint* ep, const char* reason,
const char* file, int line) {
if (GRPC_TRACE_FLAG_ENABLED(secure_endpoint)) {
gpr_atm val = gpr_atm_no_barrier_load(&ep->ref.count);
gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG,
"SECENDP unref %p : %s %" PRIdPTR " -> %" PRIdPTR, ep, reason, val,
val - 1);
VLOG(2).AtLocation(file, line) << "SECENDP unref " << ep << " : " << reason
<< " " << val << " -> " << val - 1;
}
if (gpr_unref(&ep->ref)) {
destroy(ep);
@ -173,9 +171,8 @@ static void secure_endpoint_ref(secure_endpoint* ep, const char* reason,
const char* file, int line) {
if (GRPC_TRACE_FLAG_ENABLED(secure_endpoint)) {
gpr_atm val = gpr_atm_no_barrier_load(&ep->ref.count);
gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG,
"SECENDP ref %p : %s %" PRIdPTR " -> %" PRIdPTR, ep, reason, val,
val + 1);
VLOG(2).AtLocation(file, line) << "SECENDP ref " << ep << " : " << reason
<< " " << val << " -> " << val + 1;
}
gpr_ref(&ep->ref);
}
@ -200,8 +197,7 @@ static void maybe_post_reclaimer(secure_endpoint* ep) {
[ep](absl::optional<grpc_core::ReclamationSweep> sweep) {
if (sweep.has_value()) {
if (GRPC_TRACE_FLAG_ENABLED(resource_quota)) {
gpr_log(GPR_INFO,
"secure endpoint: benign reclamation to free memory");
LOG(INFO) << "secure endpoint: benign reclamation to free memory";
}
grpc_slice temp_read_slice;
grpc_slice temp_write_slice;
@ -296,8 +292,7 @@ static void on_read(void* user_data, grpc_error_handle error) {
&unprotected_buffer_size_written);
gpr_mu_unlock(&ep->protector_mu);
if (result != TSI_OK) {
gpr_log(GPR_ERROR, "Decryption error: %s",
tsi_result_to_string(result));
LOG(ERROR) << "Decryption error: " << tsi_result_to_string(result);
break;
}
message_bytes += processed_message_size;
@ -448,8 +443,7 @@ static void endpoint_write(grpc_endpoint* secure_ep, grpc_slice_buffer* slices,
&protected_buffer_size_to_send);
gpr_mu_unlock(&ep->protector_mu);
if (result != TSI_OK) {
gpr_log(GPR_ERROR, "Encryption error: %s",
tsi_result_to_string(result));
LOG(ERROR) << "Encryption error: " << tsi_result_to_string(result);
break;
}
message_bytes += processed_message_size;

Loading…
Cancel
Save