Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions plugins/multiplexer/fetcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ template <class T> struct HttpTransaction {
self->t_.header(self->parser_.buffer_, self->parser_.location_);
self->parsingHeaders_ = false;
}
// Parsing headers will indirectly read from our reader. Update available accordingly.
available = TSIOBufferReaderAvail(self->in_->reader);
}
if (!self->parsingHeaders_) {
if (self->chunkDecoder_ != NULL) {
Expand Down
1 change: 1 addition & 0 deletions src/iocore/eventsystem/P_IOBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,7 @@ IOBufferReader::is_read_avail_more_than(int64_t size)
TS_INLINE void
IOBufferReader::consume(int64_t n)
{
ink_assert(read_avail() >= n);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this function should handle this case, a). handle it as error case or b). consume only read_avail(). This assertion is a good start 👍

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm open to suggestions, but I don't think there's a good way to handle this, not here in consume. There's not enough context. In production, we don't want to spend the time in the read_avail(). If needed the caller should do that as a part of fulfilling its contract for this API. The debug assert here seems like a reasonable way to catch issues in debug builds.

start_offset += n;
if (size_limit != INT64_MAX) {
size_limit -= n;
Expand Down