MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / Send

Method Send

tensorflow/core/platform/cloud/curl_http_request.cc:404–535  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

402}
403
404Status CurlHttpRequest::Send() {
405 CheckNotSent();
406 CHECK(is_uri_set_) << "URI has not been set.";
407
408 is_sent_ = true;
409
410 if (curl_headers_) {
411 CHECK_CURL_OK(
412 libcurl_->curl_easy_setopt(curl_, CURLOPT_HTTPHEADER, curl_headers_));
413 }
414 if (resolve_list_) {
415 CHECK_CURL_OK(
416 libcurl_->curl_easy_setopt(curl_, CURLOPT_RESOLVE, resolve_list_));
417 }
418 CHECK_CURL_OK(libcurl_->curl_easy_setopt(curl_, CURLOPT_HEADERDATA,
419 reinterpret_cast<void*>(this)));
420 CHECK_CURL_OK(libcurl_->curl_easy_setopt(curl_, CURLOPT_HEADERFUNCTION,
421 &CurlHttpRequest::HeaderCallback));
422
423 CHECK_CURL_OK(libcurl_->curl_easy_setopt(curl_, CURLOPT_TIMEOUT,
424 request_timeout_secs_));
425 CHECK_CURL_OK(libcurl_->curl_easy_setopt(curl_, CURLOPT_CONNECTTIMEOUT,
426 connect_timeout_secs_));
427
428 char error_buffer[CURL_ERROR_SIZE] = {0};
429 CHECK_CURL_OK(
430 libcurl_->curl_easy_setopt(curl_, CURLOPT_ERRORBUFFER, error_buffer));
431
432 if (stats_ != nullptr) {
433 stats_->RecordRequest(this, uri_, method_);
434 }
435
436 const CURLcode curl_result = libcurl_->curl_easy_perform(curl_);
437 TF_RETURN_IF_ERROR(CURLcodeToStatus(curl_result, error_buffer));
438
439 double written_size = 0;
440 CHECK_CURL_OK(libcurl_->curl_easy_getinfo(curl_, CURLINFO_SIZE_DOWNLOAD,
441 &written_size));
442
443 CHECK_CURL_OK(libcurl_->curl_easy_getinfo(curl_, CURLINFO_RESPONSE_CODE,
444 &response_code_));
445
446 auto get_error_message = [this]() -> string {
447 string error_message = strings::StrCat(
448 "Error executing an HTTP request: HTTP response code ", response_code_);
449 StringPiece body = GetResponse();
450 if (!body.empty()) {
451 return strings::StrCat(
452 error_message, " with body '",
453 body.substr(0, std::min(body.size(), response_to_error_limit_)), "'");
454 }
455 return error_message;
456 };
457
458 Status result;
459 switch (response_code_) {
460 // The group of response codes indicating that the request achieved
461 // the expected goal.

Callers 14

UploadToSessionMethod · 0.45
LoadBufferFromGCSMethod · 0.45
UncachedStatForObjectMethod · 0.45
GetBucketMetadataMethod · 0.45
GetChildrenBoundedMethod · 0.45
DeleteFileMethod · 0.45
RenameObjectMethod · 0.45
GetMetadataMethod · 0.45

Calls 15

InvalidArgumentFunction · 0.85
NotFoundFunction · 0.85
FailedPreconditionFunction · 0.85
UnavailableFunction · 0.85
RecordRequestMethod · 0.80
StrCatFunction · 0.50
minFunction · 0.50
curl_easy_setoptMethod · 0.45
curl_easy_performMethod · 0.45
curl_easy_getinfoMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45

Tested by 2

TESTFunction · 0.36
TESTFunction · 0.36