httpcli.cc
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2015 gRPC authors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
20 
22 
23 #include <limits.h>
24 
25 #include <string>
26 #include <utility>
27 
28 #include "absl/container/inlined_vector.h"
29 #include "absl/functional/bind_front.h"
30 #include "absl/status/status.h"
31 #include "absl/strings/str_format.h"
32 
33 #include <grpc/grpc.h>
34 #include <grpc/grpc_security.h>
35 #include <grpc/slice_buffer.h>
36 #include <grpc/support/alloc.h>
37 #include <grpc/support/log.h>
38 
57 
58 namespace grpc_core {
59 
60 namespace {
61 
62 grpc_httpcli_get_override g_get_override;
63 grpc_httpcli_post_override g_post_override;
64 grpc_httpcli_put_override g_put_override;
65 void (*g_test_only_on_handshake_done_intercept)(HttpRequest* req);
66 
67 } // namespace
68 
70  URI uri, const grpc_channel_args* channel_args,
74  absl::optional<std::function<void()>> test_only_generate_response;
75  if (g_get_override != nullptr) {
76  test_only_generate_response = [request, uri, deadline, on_done,
77  response]() {
78  // Note that capturing request here assumes it will remain alive
79  // until after Start is called. This avoids making a copy as this
80  // code path is only used for test mocks.
81  g_get_override(request, uri.authority().c_str(), uri.path().c_str(),
82  deadline, on_done, response);
83  };
84  }
86  absl::StrFormat("HTTP:GET:%s:%s", uri.authority(), uri.path());
87  const grpc_slice request_text = grpc_httpcli_format_get_request(
88  request, uri.authority().c_str(), uri.path().c_str());
89  return MakeOrphanable<HttpRequest>(
90  std::move(uri), request_text, response, deadline, channel_args, on_done,
91  pollent, name.c_str(), std::move(test_only_generate_response),
92  std::move(channel_creds));
93 }
94 
96  URI uri, const grpc_channel_args* channel_args,
100  absl::optional<std::function<void()>> test_only_generate_response;
101  if (g_post_override != nullptr) {
102  test_only_generate_response = [request, uri, deadline, on_done,
103  response]() {
104  g_post_override(request, uri.authority().c_str(), uri.path().c_str(),
105  request->body, request->body_length, deadline, on_done,
106  response);
107  };
108  }
109  std::string name =
110  absl::StrFormat("HTTP:POST:%s:%s", uri.authority(), uri.path());
111  const grpc_slice request_text = grpc_httpcli_format_post_request(
112  request, uri.authority().c_str(), uri.path().c_str());
113  return MakeOrphanable<HttpRequest>(
114  std::move(uri), request_text, response, deadline, channel_args, on_done,
115  pollent, name.c_str(), std::move(test_only_generate_response),
116  std::move(channel_creds));
117 }
118 
120  URI uri, const grpc_channel_args* channel_args,
122  Timestamp deadline, grpc_closure* on_done, grpc_http_response* response,
124  absl::optional<std::function<void()>> test_only_generate_response;
125  if (g_put_override != nullptr) {
126  test_only_generate_response = [request, uri, deadline, on_done,
127  response]() {
128  g_put_override(request, uri.authority().c_str(), uri.path().c_str(),
129  request->body, request->body_length, deadline, on_done,
130  response);
131  };
132  }
133  std::string name =
134  absl::StrFormat("HTTP:PUT:%s:%s", uri.authority(), uri.path());
135  const grpc_slice request_text = grpc_httpcli_format_put_request(
136  request, uri.authority().c_str(), uri.path().c_str());
137  return MakeOrphanable<HttpRequest>(
138  std::move(uri), request_text, response, deadline, channel_args, on_done,
139  pollent, name.c_str(), std::move(test_only_generate_response),
140  std::move(channel_creds));
141 }
142 
146  g_get_override = get;
147  g_post_override = post;
148  g_put_override = put;
149 }
150 
152  void (*intercept)(HttpRequest* req)) {
153  g_test_only_on_handshake_done_intercept = intercept;
154 }
155 
157  URI uri, const grpc_slice& request_text, grpc_http_response* response,
158  Timestamp deadline, const grpc_channel_args* channel_args,
159  grpc_closure* on_done, grpc_polling_entity* pollent, const char* name,
160  absl::optional<std::function<void()>> test_only_generate_response,
162  : uri_(std::move(uri)),
163  request_text_(request_text),
164  deadline_(deadline),
166  .channel_args_preconditioning()
167  .PreconditionChannelArgs(channel_args)
168  .ToC()),
169  channel_creds_(std::move(channel_creds)),
170  on_done_(on_done),
172  pollent_(pollent),
173  pollset_set_(grpc_pollset_set_create()),
174  test_only_generate_response_(std::move(test_only_generate_response)) {
176  grpc_slice_buffer_init(&incoming_);
178  grpc_iomgr_register_object(&iomgr_obj_, name);
179  GRPC_CLOSURE_INIT(&on_read_, OnRead, this, grpc_schedule_on_exec_ctx);
182  grpc_schedule_on_exec_ctx);
183  GRPC_CLOSURE_INIT(&done_write_, DoneWrite, this, grpc_schedule_on_exec_ctx);
186  grpc_schedule_on_exec_ctx);
187  GPR_ASSERT(pollent);
189 }
190 
194  if (own_endpoint_ && ep_ != nullptr) {
196  }
198  grpc_iomgr_unregister_object(&iomgr_obj_);
201  GRPC_ERROR_UNREF(overall_error_);
203 }
204 
206  MutexLock lock(&mu_);
209  return;
210  }
211  Ref().release(); // ref held by pending DNS resolution
212  dns_request_handle_ = GetDNSResolver()->ResolveName(
215 }
216 
218  {
219  MutexLock lock(&mu_);
220  GPR_ASSERT(!cancelled_);
221  cancelled_ = true;
222  // cancel potentially pending DNS resolution.
223  if (dns_request_handle_.has_value() &&
224  GetDNSResolver()->Cancel(dns_request_handle_.value())) {
226  "cancelled during DNS resolution"));
227  Unref();
228  }
229  if (handshake_mgr_ != nullptr) {
230  // Shutdown will cancel any ongoing tcp connect.
231  handshake_mgr_->Shutdown(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
232  "HTTP request cancelled during handshake"));
233  }
234  if (own_endpoint_ && ep_ != nullptr) {
236  ep_, GRPC_ERROR_CREATE_FROM_STATIC_STRING("HTTP request cancelled"));
237  }
238  }
239  Unref();
240 }
241 
243  if (GRPC_ERROR_IS_NONE(overall_error_)) {
244  overall_error_ =
245  GRPC_ERROR_CREATE_FROM_STATIC_STRING("Failed HTTP/1 client request");
246  }
247  const grpc_resolved_address* addr = &addresses_[next_address_ - 1];
248  auto addr_text = grpc_sockaddr_to_uri(addr);
249  overall_error_ = grpc_error_add_child(
250  overall_error_,
253  addr_text.ok() ? addr_text.value() : addr_text.status().ToString()));
254 }
255 
257  for (size_t i = 0; i < incoming_.count; i++) {
258  if (GRPC_SLICE_LENGTH(incoming_.slices[i])) {
259  have_read_byte_ = 1;
261  grpc_http_parser_parse(&parser_, incoming_.slices[i], nullptr);
262  if (!GRPC_ERROR_IS_NONE(err)) {
263  Finish(err);
264  return;
265  }
266  }
267  }
268  if (cancelled_) {
270  "HTTP1 request cancelled during read", &overall_error_, 1));
271  } else if (GRPC_ERROR_IS_NONE(error)) {
272  DoRead();
273  } else if (!have_read_byte_) {
275  } else {
277  }
278 }
279 
281  void* arg, grpc_error_handle error) {
283  MutexLock lock(&req->mu_);
284  if (GRPC_ERROR_IS_NONE(error) && !req->cancelled_) {
285  req->OnWritten();
286  } else {
287  req->NextAddress(GRPC_ERROR_REF(error));
288  }
289 }
290 
294  Ref().release(); // ref held by pending write
296  /*max_frame_size=*/INT_MAX);
297 }
298 
300  auto* args = static_cast<HandshakerArgs*>(arg);
301  RefCountedPtr<HttpRequest> req(static_cast<HttpRequest*>(args->user_data));
302  if (g_test_only_on_handshake_done_intercept != nullptr) {
303  // Run this testing intercept before the lock so that it has a chance to
304  // do things like calling Orphan on the request
305  g_test_only_on_handshake_done_intercept(req.get());
306  }
307  MutexLock lock(&req->mu_);
308  req->own_endpoint_ = true;
309  if (!GRPC_ERROR_IS_NONE(error)) {
310  req->handshake_mgr_.reset();
311  req->NextAddress(GRPC_ERROR_REF(error));
312  return;
313  }
314  // Handshake completed, so we own fields in args
317  gpr_free(args->read_buffer);
318  req->ep_ = args->endpoint;
319  req->handshake_mgr_.reset();
320  if (req->cancelled_) {
322  "HTTP request cancelled during handshake"));
323  return;
324  }
325  req->StartWrite();
326 }
327 
329  // Create the security connector using the credentials and target name.
330  grpc_channel_args* new_args_from_connector = nullptr;
333  nullptr /*call_creds*/, uri_.authority().c_str(), channel_args_,
334  &new_args_from_connector);
335  if (sc == nullptr) {
337  "failed to create security connector", &overall_error_, 1));
338  return;
339  }
341  if (!address.ok()) {
343  "Failed to extract URI from address", &overall_error_, 1));
344  return;
345  }
346  absl::InlinedVector<grpc_arg, 2> args_to_add = {
349  const_cast<char*>(GRPC_ARG_TCP_HANDSHAKER_RESOLVED_ADDRESS),
350  const_cast<char*>(address.value().c_str())),
351  };
353  new_args_from_connector != nullptr ? new_args_from_connector
354  : channel_args_,
355  args_to_add.data(), args_to_add.size());
356  grpc_channel_args_destroy(new_args_from_connector);
357  // Start the handshake
358  handshake_mgr_ = MakeRefCounted<HandshakeManager>();
360  HANDSHAKER_CLIENT, new_args, pollset_set_, handshake_mgr_.get());
361  Ref().release(); // ref held by pending handshake
362  grpc_endpoint* ep = ep_;
363  ep_ = nullptr;
364  own_endpoint_ = false;
365  handshake_mgr_->DoHandshake(ep, new_args, deadline_,
366  /*acceptor=*/nullptr, OnHandshakeDone,
367  /*user_data=*/this);
368  sc.reset(DEBUG_LOCATION, "httpcli");
369  grpc_channel_args_destroy(new_args);
370 }
371 
373  if (!GRPC_ERROR_IS_NONE(error)) {
375  }
376  if (cancelled_) {
378  "HTTP request was cancelled", &overall_error_, 1));
379  return;
380  }
381  if (next_address_ == addresses_.size()) {
383  "Failed HTTP requests to all targets", &overall_error_, 1));
384  return;
385  }
386  const grpc_resolved_address* addr = &addresses_[next_address_++];
387  DoHandshake(addr);
388 }
389 
391  absl::StatusOr<std::vector<grpc_resolved_address>> addresses_or) {
392  RefCountedPtr<HttpRequest> unreffer(this);
393  MutexLock lock(&mu_);
394  dns_request_handle_.reset();
395  if (cancelled_) {
397  "cancelled during DNS resolution"));
398  return;
399  }
400  if (!addresses_or.ok()) {
401  Finish(absl_status_to_grpc_error(addresses_or.status()));
402  return;
403  }
404  addresses_ = std::move(*addresses_or);
405  next_address_ = 0;
407 }
408 
409 } // namespace grpc_core
GRPC_CLOSURE_INIT
#define GRPC_CLOSURE_INIT(closure, cb, cb_arg, scheduler)
Definition: closure.h:115
grpc_core::HttpRequest::deadline_
const Timestamp deadline_
Definition: httpcli.h:240
grpc_core::HttpRequest::done_write_
grpc_closure done_write_
Definition: httpcli.h:245
grpc_core::HttpRequest::Orphan
void Orphan() override
Definition: httpcli.cc:217
format_request.h
GRPC_ERROR_NONE
#define GRPC_ERROR_NONE
Definition: error.h:234
grpc_core::HttpRequest::ContinueOnReadAfterScheduleOnExecCtx
static void ContinueOnReadAfterScheduleOnExecCtx(void *user_data, grpc_error_handle error)
Definition: httpcli.h:203
log.h
core_configuration.h
get
absl::string_view get(const Cont &c)
Definition: abseil-cpp/absl/strings/str_replace_test.cc:185
sockaddr_utils.h
grpc_core::HttpRequest::OnReadInternal
void OnReadInternal(grpc_error_handle error) ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_)
Definition: httpcli.cc:256
grpc_slice_ref_internal
const grpc_slice & grpc_slice_ref_internal(const grpc_slice &slice)
Definition: slice_refcount.h:32
grpc_core::HttpRequest::NextAddress
void NextAddress(grpc_error_handle error) ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_)
Definition: httpcli.cc:372
deadline_
Timestamp deadline_
Definition: channel_connectivity.cc:163
absl::StrFormat
ABSL_MUST_USE_RESULT std::string StrFormat(const FormatSpec< Args... > &format, const Args &... args)
Definition: abseil-cpp/absl/strings/str_format.h:338
iomgr_internal.h
grpc_core::RefCountedPtr::get
T * get() const
Definition: ref_counted_ptr.h:146
grpc_core::HttpRequest::continue_done_write_after_schedule_on_exec_ctx_
grpc_closure continue_done_write_after_schedule_on_exec_ctx_
Definition: httpcli.h:246
grpc_http_parser_eof
grpc_error_handle grpc_http_parser_eof(grpc_http_parser *parser)
Definition: src/core/lib/http/parser.cc:457
absl::bind_front
constexpr ABSL_NAMESPACE_BEGIN functional_internal::bind_front_t< F, BoundArgs... > bind_front(F &&func, BoundArgs &&... args)
Definition: abseil-cpp/absl/functional/bind_front.h:182
post
static void post(QUEUE *q, enum uv__work_kind kind)
Definition: threadpool.c:142
grpc_core::InternallyRefCounted< HttpRequest >::Unref
void Unref()
Definition: orphanable.h:100
grpc_core
Definition: call_metric_recorder.h:31
grpc_core::MutexLock
Definition: src/core/lib/gprpp/sync.h:88
benchmark.request
request
Definition: benchmark.py:77
grpc_core::RefCountedPtr::reset
void reset(T *value=nullptr)
Definition: ref_counted_ptr.h:111
grpc_pollset_set_create
grpc_pollset_set * grpc_pollset_set_create()
Definition: pollset_set.cc:29
grpc_core::Timestamp
Definition: src/core/lib/gprpp/time.h:62
gpr_free
GPRAPI void gpr_free(void *ptr)
Definition: alloc.cc:51
grpc_core::HttpRequest::ContinueDoneWriteAfterScheduleOnExecCtx
static void ContinueDoneWriteAfterScheduleOnExecCtx(void *arg, grpc_error_handle error)
Definition: httpcli.cc:280
resolve_address.h
testing::internal::string
::std::string string
Definition: bloaty/third_party/protobuf/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:881
error
grpc_error_handle error
Definition: retry_filter.cc:499
grpc_core::URI
Definition: uri_parser.h:31
error_ref_leak.err
err
Definition: error_ref_leak.py:35
addresses_
absl::StatusOr< HierarchicalAddressMap > addresses_
Definition: priority.cc:287
resource_quota_
ResourceQuotaRefPtr resource_quota_
Definition: google_c2p_resolver.cc:133
grpc_core::HttpRequest::DoHandshake
void DoHandshake(const grpc_resolved_address *addr) ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_)
Definition: httpcli.cc:328
grpc_core::CoreConfiguration
Definition: core_configuration.h:34
grpc_resolved_address
Definition: resolved_address.h:34
GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING
#define GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(desc, errs, count)
Definition: error.h:307
grpc_core::HttpRequest::continue_on_read_after_schedule_on_exec_ctx_
grpc_closure continue_on_read_after_schedule_on_exec_ctx_
Definition: httpcli.h:244
grpc_core::HttpRequest
Definition: httpcli.h:82
setup.name
name
Definition: setup.py:542
grpc_channel_arg_string_create
grpc_arg grpc_channel_arg_string_create(char *name, char *value)
Definition: channel_args.cc:476
grpc_core::HttpRequest::Post
static OrphanablePtr< HttpRequest > Post(URI uri, const grpc_channel_args *args, grpc_polling_entity *pollent, const grpc_http_request *request, Timestamp deadline, grpc_closure *on_done, grpc_http_response *response, RefCountedPtr< grpc_channel_credentials > channel_creds) GRPC_MUST_USE_RESULT
Definition: httpcli.cc:95
grpc_security.h
credentials.h
grpc_channel_args
Definition: grpc_types.h:132
on_done_
grpc_closure on_done_
Definition: google_c2p_resolver.cc:102
grpc_security_connector_to_arg
grpc_arg grpc_security_connector_to_arg(grpc_security_connector *sc)
Definition: security_connector.cc:101
grpc_httpcli_post_override
int(* grpc_httpcli_post_override)(const grpc_http_request *request, const char *host, const char *path, const char *body_bytes, size_t body_size, grpc_core::Timestamp deadline, grpc_closure *on_complete, grpc_http_response *response)
Definition: httpcli.h:65
channel_args_preconditioning.h
grpc_error_set_str
grpc_error_handle grpc_error_set_str(grpc_error_handle src, grpc_error_strs which, absl::string_view str)
Definition: error.cc:650
grpc_core::URI::path
const std::string & path() const
Definition: uri_parser.h:70
grpc_iomgr_unregister_object
void grpc_iomgr_unregister_object(grpc_iomgr_object *obj)
Definition: iomgr.cc:193
GRPC_ERROR_STR_TARGET_ADDRESS
@ GRPC_ERROR_STR_TARGET_ADDRESS
peer that we were trying to communicate when this error occurred
Definition: error.h:117
absl::synchronization_internal::Get
static GraphId Get(const IdMap &id, int num)
Definition: abseil-cpp/absl/synchronization/internal/graphcycles_test.cc:44
grpc_core::HttpRequest::on_read_
grpc_closure on_read_
Definition: httpcli.h:243
grpc_core::HttpRequest::SetOverride
static void SetOverride(grpc_httpcli_get_override get, grpc_httpcli_post_override post, grpc_httpcli_put_override put)
Definition: httpcli.cc:143
grpc_core::HttpRequest::AppendError
void AppendError(grpc_error_handle error) ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_)
Definition: httpcli.cc:242
grpc_core::HttpRequest::test_only_generate_response_
const absl::optional< std::function< void()> > test_only_generate_response_
Definition: httpcli.h:252
DEBUG_LOCATION
#define DEBUG_LOCATION
Definition: debug_location.h:41
grpc_http_response
Definition: src/core/lib/http/parser.h:85
grpc_core::HttpRequest::DoneWrite
static void DoneWrite(void *arg, grpc_error_handle error)
Definition: httpcli.h:215
grpc_error_add_child
grpc_error_handle grpc_error_add_child(grpc_error_handle src, grpc_error_handle child)
Definition: error.cc:678
grpc_core::HttpRequest::OnResolved
void OnResolved(absl::StatusOr< std::vector< grpc_resolved_address >> addresses_or)
Definition: httpcli.cc:390
grpc_core::HttpRequest::channel_creds_
RefCountedPtr< grpc_channel_credentials > channel_creds_
Definition: httpcli.h:242
grpc_core::HANDSHAKER_CLIENT
@ HANDSHAKER_CLIENT
Definition: handshaker_registry.h:35
asyncio_get_stats.args
args
Definition: asyncio_get_stats.py:40
grpc_core::RefCountedPtr< grpc_channel_credentials >
absl::move
constexpr absl::remove_reference_t< T > && move(T &&t) noexcept
Definition: abseil-cpp/absl/utility/utility.h:221
GPR_ASSERT
#define GPR_ASSERT(x)
Definition: include/grpc/impl/codegen/log.h:94
channel_creds_
std::shared_ptr< ChannelCredentials > channel_creds_
Definition: grpc_authz_end2end_test.cc:146
grpc_httpcli_format_get_request
grpc_slice grpc_httpcli_format_get_request(const grpc_http_request *request, const char *host, const char *path)
Definition: format_request.cc:59
grpc_core::CoreConfiguration::Get
static const CoreConfiguration & Get()
Definition: core_configuration.h:82
absl::optional::has_value
constexpr bool has_value() const noexcept
Definition: abseil-cpp/absl/types/optional.h:461
grpc_core::HttpRequest::HttpRequest
HttpRequest(URI uri, const grpc_slice &request_text, grpc_http_response *response, Timestamp deadline, const grpc_channel_args *channel_args, grpc_closure *on_done, grpc_polling_entity *pollent, const char *name, absl::optional< std::function< void()>> test_only_generate_response, RefCountedPtr< grpc_channel_credentials > channel_creds)
Definition: httpcli.cc:156
grpc_core::URI::authority
const std::string & authority() const
Definition: uri_parser.h:69
grpc_httpcli_put_override
int(* grpc_httpcli_put_override)(const grpc_http_request *request, const char *host, const char *path, const char *body_bytes, size_t body_size, grpc_core::Timestamp deadline, grpc_closure *on_complete, grpc_http_response *response)
Definition: httpcli.h:69
grpc_core::HttpRequest::DoRead
void DoRead() ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_)
Definition: httpcli.h:189
req
static uv_connect_t req
Definition: test-connection-fail.c:30
grpc_core::InternallyRefCounted< HttpRequest >::Ref
RefCountedPtr< HttpRequest > Ref() GRPC_MUST_USE_RESULT
Definition: orphanable.h:90
channel_args_
const grpc_channel_args * channel_args_
Definition: rls.cc:710
httpcli.h
grpc.h
grpc_pollset_set_destroy
void grpc_pollset_set_destroy(grpc_pollset_set *pollset_set)
Definition: pollset_set.cc:33
grpc_core::HttpRequest::OnRead
static void OnRead(void *user_data, grpc_error_handle error)
Definition: httpcli.h:195
handshaker_registry.h
security_connector.h
absl::optional
Definition: abseil-cpp/absl/types/internal/optional.h:61
pollset_set.h
slice_buffer.h
grpc_channel_args_destroy
void grpc_channel_args_destroy(grpc_channel_args *a)
Definition: channel_args.cc:360
arg
Definition: cmdline.cc:40
grpc_slice
Definition: include/grpc/impl/codegen/slice.h:65
grpc_core::CoreConfiguration::handshaker_registry
const HandshakerRegistry & handshaker_registry() const
Definition: core_configuration.h:145
grpc_httpcli_format_put_request
grpc_slice grpc_httpcli_format_put_request(const grpc_http_request *request, const char *host, const char *path)
Definition: format_request.cc:99
absl::InlinedVector::data
pointer data() noexcept
Definition: abseil-cpp/absl/container/inlined_vector.h:302
grpc_endpoint_shutdown
void grpc_endpoint_shutdown(grpc_endpoint *ep, grpc_error_handle why)
Definition: endpoint.cc:49
grpc_polling_entity
Definition: polling_entity.h:38
grpc_http_parser_destroy
void grpc_http_parser_destroy(grpc_http_parser *)
Definition: src/core/lib/http/parser.cc:420
absl::InlinedVector::size
size_type size() const noexcept
Definition: abseil-cpp/absl/container/inlined_vector.h:270
slice_internal.h
grpc_core::HttpRequest::channel_args_
const grpc_channel_args * channel_args_
Definition: httpcli.h:241
outgoing_
grpc_slice_buffer outgoing_
Definition: security_handshaker.cc:128
grpc_endpoint_destroy
void grpc_endpoint_destroy(grpc_endpoint *ep)
Definition: endpoint.cc:53
tcp_connect_handshaker.h
grpc_core::HttpRequest::ep_
grpc_endpoint * ep_
Definition: httpcli.h:247
grpc_slice_buffer_init
GPRAPI void grpc_slice_buffer_init(grpc_slice_buffer *sb)
Definition: slice/slice_buffer.cc:116
GRPC_ERROR_CREATE_FROM_STATIC_STRING
#define GRPC_ERROR_CREATE_FROM_STATIC_STRING(desc)
Definition: error.h:291
GRPC_SLICE_LENGTH
#define GRPC_SLICE_LENGTH(slice)
Definition: include/grpc/impl/codegen/slice.h:104
absl::optional::value
constexpr const T & value() const &
Definition: abseil-cpp/absl/types/optional.h:475
grpc_iomgr_register_object
void grpc_iomgr_register_object(grpc_iomgr_object *obj, const char *name)
Definition: iomgr.cc:184
grpc_core::URI::scheme
const std::string & scheme() const
Definition: uri_parser.h:68
absl::StatusOr::ok
ABSL_MUST_USE_RESULT bool ok() const
Definition: abseil-cpp/absl/status/statusor.h:491
grpc_slice_buffer_add
GPRAPI void grpc_slice_buffer_add(grpc_slice_buffer *sb, grpc_slice slice)
Definition: slice/slice_buffer.cc:170
parser.h
grpc_core::HandshakerRegistry::AddHandshakers
void AddHandshakers(HandshakerType handshaker_type, const grpc_channel_args *args, grpc_pollset_set *interested_parties, HandshakeManager *handshake_mgr) const
Definition: handshaker_registry.cc:45
GRPC_ERROR_REF
#define GRPC_ERROR_REF(err)
Definition: error.h:261
grpc_httpcli_get_override
int(* grpc_httpcli_get_override)(const grpc_http_request *request, const char *host, const char *path, grpc_core::Timestamp deadline, grpc_closure *on_complete, grpc_http_response *response)
Definition: httpcli.h:60
GRPC_ARG_TCP_HANDSHAKER_RESOLVED_ADDRESS
#define GRPC_ARG_TCP_HANDSHAKER_RESOLVED_ADDRESS
Definition: tcp_connect_handshaker.h:25
absl_status_to_grpc_error
grpc_error_handle absl_status_to_grpc_error(absl::Status status)
Definition: error_utils.cc:167
grpc_core::HttpRequest::Get
static OrphanablePtr< HttpRequest > Get(URI uri, const grpc_channel_args *args, grpc_polling_entity *pollent, const grpc_http_request *request, Timestamp deadline, grpc_closure *on_done, grpc_http_response *response, RefCountedPtr< grpc_channel_credentials > channel_creds) GRPC_MUST_USE_RESULT
Definition: httpcli.cc:69
grpc_core::HttpRequest::OnHandshakeDone
static void OnHandshakeDone(void *arg, grpc_error_handle error)
Definition: httpcli.cc:299
grpc_core::ResourceQuotaFromChannelArgs
ResourceQuotaRefPtr ResourceQuotaFromChannelArgs(const grpc_channel_args *args)
Definition: api.cc:40
grpc_core::GetDNSResolver
DNSResolver * GetDNSResolver()
Definition: resolve_address.cc:38
uri_
URI uri_
Definition: xds_resolver.cc:374
alloc.h
grpc_core::OrphanablePtr
std::unique_ptr< T, Deleter > OrphanablePtr
Definition: orphanable.h:64
asyncio_get_stats.response
response
Definition: asyncio_get_stats.py:28
std
Definition: grpcpp/impl/codegen/async_unary_call.h:407
grpc_polling_entity_add_to_pollset_set
void grpc_polling_entity_add_to_pollset_set(grpc_polling_entity *pollent, grpc_pollset_set *pss_dst)
Definition: polling_entity.cc:61
grpc_httpcli_format_post_request
grpc_slice grpc_httpcli_format_post_request(const grpc_http_request *request, const char *host, const char *path)
Definition: format_request.cc:69
grpc_core::DNSResolver::ResolveName
virtual TaskHandle ResolveName(absl::string_view name, absl::string_view default_port, grpc_pollset_set *interested_parties, std::function< void(absl::StatusOr< std::vector< grpc_resolved_address >>)> on_done)=0
grpc_core::HttpRequest::Finish
void Finish(grpc_error_handle error) ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_)
Definition: httpcli.h:182
grpc_http_parser_parse
grpc_error_handle grpc_http_parser_parse(grpc_http_parser *parser, const grpc_slice &slice, size_t *start_of_body)
Definition: src/core/lib/http/parser.cc:444
grpc_http_parser_init
void grpc_http_parser_init(grpc_http_parser *parser, grpc_http_type type, void *request_or_response)
Definition: src/core/lib/http/parser.cc:411
arg
struct arg arg
slice_refcount.h
GRPC_ERROR_UNREF
#define GRPC_ERROR_UNREF(err)
Definition: error.h:262
channel_args.h
grpc_slice_buffer_destroy_internal
void grpc_slice_buffer_destroy_internal(grpc_slice_buffer *sb)
Definition: slice/slice_buffer.cc:123
framework.infrastructure.gcp.api.HttpRequest
HttpRequest
Definition: api.py:61
grpc_core::HttpRequest::uri_
const URI uri_
Definition: httpcli.h:238
grpc_endpoint_write
void grpc_endpoint_write(grpc_endpoint *ep, grpc_slice_buffer *slices, grpc_closure *cb, void *arg, int max_frame_size)
Definition: endpoint.cc:30
grpc_core::HandshakerArgs
Definition: handshaker.h:64
grpc_core::HttpRequest::pollset_set_
grpc_pollset_set * pollset_set_
Definition: httpcli.h:251
absl::StatusOr::value
const T & value() const &ABSL_ATTRIBUTE_LIFETIME_BOUND
Definition: abseil-cpp/absl/status/statusor.h:687
absl::StatusOr< std::string >
GRPC_HTTP_RESPONSE
@ GRPC_HTTP_RESPONSE
Definition: src/core/lib/http/parser.h:64
absl::InlinedVector
Definition: abseil-cpp/absl/container/inlined_vector.h:69
grpc_core::HttpRequest::Put
static OrphanablePtr< HttpRequest > Put(URI uri, const grpc_channel_args *args, grpc_polling_entity *pollent, const grpc_http_request *request, Timestamp deadline, grpc_closure *on_done, grpc_http_response *response, RefCountedPtr< grpc_channel_credentials > channel_creds) GRPC_MUST_USE_RESULT
Definition: httpcli.cc:119
endpoint.h
grpc_error
Definition: error_internal.h:42
function
std::function< bool(GrpcTool *, int, const char **, const CliCredentials &, GrpcToolOutputCallback)> function
Definition: grpc_tool.cc:250
grpc_core::HttpRequest::~HttpRequest
~HttpRequest() override
Definition: httpcli.cc:191
grpc_channel_credentials::create_security_connector
virtual grpc_core::RefCountedPtr< grpc_channel_security_connector > create_security_connector(grpc_core::RefCountedPtr< grpc_call_credentials > call_creds, const char *target, const grpc_channel_args *args, grpc_channel_args **new_args)=0
grpc_core::HttpRequest::request_text_
const grpc_slice request_text_
Definition: httpcli.h:239
parser_
std::unique_ptr< Parser > parser_
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/parser_unittest.cc:185
grpc_core::HttpRequest::mu_
Mutex mu_
Definition: httpcli.h:253
grpc_closure
Definition: closure.h:56
grpc_sockaddr_to_uri
absl::StatusOr< std::string > grpc_sockaddr_to_uri(const grpc_resolved_address *resolved_addr)
Definition: sockaddr_utils.cc:260
grpc_endpoint
Definition: endpoint.h:105
addr
struct sockaddr_in addr
Definition: libuv/docs/code/tcp-echo-server/main.c:10
grpc_core::HttpRequest::Start
void Start()
Definition: httpcli.cc:205
grpc_core::HttpRequest::TestOnlySetOnHandshakeDoneIntercept
static void TestOnlySetOnHandshakeDoneIntercept(void(*intercept)(HttpRequest *req))
Definition: httpcli.cc:151
grpc_channel_args_copy_and_add
grpc_channel_args * grpc_channel_args_copy_and_add(const grpc_channel_args *src, const grpc_arg *to_add, size_t num_to_add)
Definition: channel_args.cc:224
i
uint64_t i
Definition: abseil-cpp/absl/container/btree_benchmark.cc:230
grpc_slice_unref_internal
void grpc_slice_unref_internal(const grpc_slice &slice)
Definition: slice_refcount.h:39
grpc_core::HttpRequest::StartWrite
void StartWrite() ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_)
Definition: httpcli.cc:291
pollent_
grpc_polling_entity pollent_
Definition: google_c2p_resolver.cc:135
error_utils.h
GRPC_ERROR_IS_NONE
#define GRPC_ERROR_IS_NONE(err)
Definition: error.h:241
grpc_http_request
Definition: src/core/lib/http/parser.h:69
api.h
port_platform.h


grpc
Author(s):
autogenerated on Fri May 16 2025 02:59:02