diff options
author | Alexander Fokin <apfokin@gmail.com> | 2022-02-10 16:45:38 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:38 +0300 |
commit | 863a59a65247c24db7cb06789bc5cf79d04da32f (patch) | |
tree | 139dc000c8cd4a40f5659e421b7c75135d080307 /library/cpp/http/io/chunk.cpp | |
parent | f64e95a9eb9ab03240599eb9581c5a9102426a96 (diff) | |
download | ydb-863a59a65247c24db7cb06789bc5cf79d04da32f.tar.gz |
Restoring authorship annotation for Alexander Fokin <apfokin@gmail.com>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/http/io/chunk.cpp')
-rw-r--r-- | library/cpp/http/io/chunk.cpp | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/library/cpp/http/io/chunk.cpp b/library/cpp/http/io/chunk.cpp index 6975d9eac1..1bdc0fbf49 100644 --- a/library/cpp/http/io/chunk.cpp +++ b/library/cpp/http/io/chunk.cpp @@ -65,32 +65,32 @@ public: } inline size_t Read(void* buf, size_t len) { - return Perform(len, [this, buf](size_t toRead) { return Slave_->Read(buf, toRead); }); - } - - inline size_t Skip(size_t len) { - return Perform(len, [this](size_t toSkip) { return Slave_->Skip(toSkip); }); - } - -private: + return Perform(len, [this, buf](size_t toRead) { return Slave_->Read(buf, toRead); }); + } + + inline size_t Skip(size_t len) { + return Perform(len, [this](size_t toSkip) { return Slave_->Skip(toSkip); }); + } + +private: template <class Operation> - inline size_t Perform(size_t len, const Operation& operation) { + inline size_t Perform(size_t len, const Operation& operation) { if (!HavePendingData()) { return 0; } - const size_t toProcess = Min(Pending_, len); + const size_t toProcess = Min(Pending_, len); - if (toProcess) { - const size_t processed = operation(toProcess); + if (toProcess) { + const size_t processed = operation(toProcess); - if (!processed) { + if (!processed) { ythrow yexception() << "malformed http chunk"; } - Pending_ -= processed; + Pending_ -= processed; - return processed; + return processed; } return 0; @@ -154,10 +154,10 @@ size_t TChunkedInput::DoRead(void* buf, size_t len) { return Impl_->Read(buf, len); } -size_t TChunkedInput::DoSkip(size_t len) { - return Impl_->Skip(len); -} - +size_t TChunkedInput::DoSkip(size_t len) { + return Impl_->Skip(len); +} + class TChunkedOutput::TImpl { typedef IOutputStream::TPart TPart; |