Skip to content

Commit

Permalink
MINIFICPP-2243 - Fix stream return value
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdebreceni committed Oct 3, 2024
1 parent a630b83 commit 89d9d1a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions extensions/civetweb/processors/ListenHTTP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,8 @@ class MgConnectionInputStream : public io::InputStream {

size_t read(std::span<std::byte> out_buffer) override {
const auto mg_read_return = mg_read(conn_, out_buffer.data(), std::min(out_buffer.size(), size_.value_or(std::numeric_limits<size_t>::max()) - offset_));
if (mg_read_return <= 0) {
return 0;
if (mg_read_return < 0) {
return io::STREAM_ERROR;
}
offset_ += gsl::narrow<size_t>(mg_read_return);
return gsl::narrow<size_t>(mg_read_return);
Expand Down

0 comments on commit 89d9d1a

Please sign in to comment.