summaryrefslogtreecommitdiffstats
path: root/yt/cpp/mapreduce/http/helpers.cpp
diff options
context:
space:
mode:
authormax42 <[email protected]>2023-06-30 11:13:34 +0300
committermax42 <[email protected]>2023-06-30 11:13:34 +0300
commit3e1899838408bbad47622007aa382bc8a2b01f87 (patch)
tree0f21c1e6add187ddb6c3ccc048a7d640ce03fb87 /yt/cpp/mapreduce/http/helpers.cpp
parent5463eb3f5e72a86f858a3d27c886470a724ede34 (diff)
Revert "YT-19324: move YT provider to ydb/library/yql"
This reverts commit ca272f12fdd0e8d5c3e957fc87939148f1caaf72, reversing changes made to 49f8acfc8b0b5c0071b804423bcf53fda26c7c12.
Diffstat (limited to 'yt/cpp/mapreduce/http/helpers.cpp')
-rw-r--r--yt/cpp/mapreduce/http/helpers.cpp88
1 files changed, 0 insertions, 88 deletions
diff --git a/yt/cpp/mapreduce/http/helpers.cpp b/yt/cpp/mapreduce/http/helpers.cpp
deleted file mode 100644
index 233a565f205..00000000000
--- a/yt/cpp/mapreduce/http/helpers.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-#include "helpers.h"
-
-#include "context.h"
-#include "requests.h"
-
-#include <yt/cpp/mapreduce/interface/logging/yt_log.h>
-
-#include <library/cpp/yson/node/node_io.h>
-
-namespace NYT {
-
-///////////////////////////////////////////////////////////////////////////////
-
-TString CreateHostNameWithPort(const TString& hostName, const TClientContext& context)
-{
- static constexpr int HttpProxyPort = 80;
- static constexpr int HttpsProxyPort = 443;
-
- static constexpr int TvmOnlyHttpProxyPort = 9026;
- static constexpr int TvmOnlyHttpsProxyPort = 9443;
-
- if (hostName.find(':') == TString::npos) {
- int port;
- if (context.TvmOnly) {
- port = context.UseTLS
- ? TvmOnlyHttpsProxyPort
- : TvmOnlyHttpProxyPort;
- } else {
- port = context.UseTLS
- ? HttpsProxyPort
- : HttpProxyPort;
- }
- return Format("%v:%v", hostName, port);
- }
- return hostName;
-}
-
-TString GetFullUrl(const TString& hostName, const TClientContext& context, THttpHeader& header)
-{
- Y_UNUSED(context);
- return Format("http://%v%v", hostName, header.GetUrl());
-}
-
-static TString GetParametersDebugString(const THttpHeader& header)
-{
- const auto& parameters = header.GetParameters();
- if (parameters.Empty()) {
- return "<empty>";
- } else {
- return NodeToYsonString(parameters);
- }
-}
-
-TString TruncateForLogs(const TString& text, size_t maxSize)
-{
- Y_VERIFY(maxSize > 10);
- if (text.empty()) {
- static TString empty = "empty";
- return empty;
- } else if (text.size() > maxSize) {
- TStringStream out;
- out << text.substr(0, maxSize) + "... (" << text.size() << " bytes total)";
- return out.Str();
- } else {
- return text;
- }
-}
-
-TString GetLoggedAttributes(const THttpHeader& header, const TString& url, bool includeParameters, size_t sizeLimit)
-{
- const auto parametersDebugString = GetParametersDebugString(header);
- TStringStream out;
- out << "Method: " << url << "; "
- << "X-YT-Parameters (sent in " << (includeParameters ? "header" : "body") << "): " << TruncateForLogs(parametersDebugString, sizeLimit);
- return out.Str();
-}
-
-void LogRequest(const THttpHeader& header, const TString& url, bool includeParameters, const TString& requestId, const TString& hostName)
-{
- YT_LOG_DEBUG("REQ %v - sending request (HostName: %v; %v)",
- requestId,
- hostName,
- GetLoggedAttributes(header, url, includeParameters, Max<size_t>()));
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-} // namespace NYT