summaryrefslogtreecommitdiffstats
path: root/yt/cpp/mapreduce/http/http.cpp
diff options
context:
space:
mode:
authorngc224 <[email protected]>2026-01-30 12:08:41 +0300
committerngc224 <[email protected]>2026-01-30 12:32:22 +0300
commiteb0912aea3c73831151c985eb13cec8ff70dcaf2 (patch)
tree6d014006d0293a7a926c2ad00ae0516dff17a295 /yt/cpp/mapreduce/http/http.cpp
parent275f1077f0cd31e5fc61b869a0074dd4a09ecfa3 (diff)
Wrap system error on first http chunk
commit_hash:c6605e1048c62c06a7e7ab4dd26acabfd1538f30
Diffstat (limited to 'yt/cpp/mapreduce/http/http.cpp')
-rw-r--r--yt/cpp/mapreduce/http/http.cpp27
1 files changed, 17 insertions, 10 deletions
diff --git a/yt/cpp/mapreduce/http/http.cpp b/yt/cpp/mapreduce/http/http.cpp
index e6efaa9d637..188f6e80281 100644
--- a/yt/cpp/mapreduce/http/http.cpp
+++ b/yt/cpp/mapreduce/http/http.cpp
@@ -29,6 +29,7 @@
#include <util/system/getpid.h>
#include <exception>
+#include <memory>
namespace NYT {
@@ -115,7 +116,7 @@ private:
}
// In many cases http proxy stops reading request and resets connection
- // if error has happend. This function tries to read error response
+ // if error has happened. This function tries to read error response
// in such cases.
void HandleWriteException(const std::exception& ex) {
Y_ABORT_UNLESS(WriteError_ == nullptr);
@@ -698,34 +699,40 @@ class THttpResponse::THttpInputWrapped
public:
explicit THttpInputWrapped(TRequestContext context, IInputStream* input)
: Context_(std::move(context))
- , HttpInput_(input)
- { }
+ {
+ try {
+ HttpInput_ = std::make_unique<THttpInput>(input);
+ } catch (const std::exception& ex) {
+ auto wrapped = WrapSystemError(Context_, ex);
+ std::rethrow_exception(wrapped);
+ }
+ }
const THttpHeaders& Headers() const noexcept
{
- return HttpInput_.Headers();
+ return HttpInput_->Headers();
}
const TString& FirstLine() const noexcept
{
- return HttpInput_.FirstLine();
+ return HttpInput_->FirstLine();
}
bool IsKeepAlive() const noexcept
{
- return HttpInput_.IsKeepAlive();
+ return HttpInput_->IsKeepAlive();
}
const TMaybe<THttpHeaders>& Trailers() const noexcept
{
- return HttpInput_.Trailers();
+ return HttpInput_->Trailers();
}
private:
size_t DoRead(void* buf, size_t len) override
{
try {
- return HttpInput_.Read(buf, len);
+ return HttpInput_->Read(buf, len);
} catch (const std::exception& ex) {
auto wrapped = WrapSystemError(Context_, ex);
std::rethrow_exception(wrapped);
@@ -735,7 +742,7 @@ private:
size_t DoSkip(size_t len) override
{
try {
- return HttpInput_.Skip(len);
+ return HttpInput_->Skip(len);
} catch (const std::exception& ex) {
auto wrapped = WrapSystemError(Context_, ex);
std::rethrow_exception(wrapped);
@@ -744,7 +751,7 @@ private:
private:
const TRequestContext Context_;
- THttpInput HttpInput_;
+ std::unique_ptr<THttpInput> HttpInput_;
};
THttpResponse::THttpResponse(