diff --git a/plugins/experimental/multiplexer/dispatch.cc b/plugins/experimental/multiplexer/dispatch.cc index 2ef49d0df45..911bb1aea68 100644 --- a/plugins/experimental/multiplexer/dispatch.cc +++ b/plugins/experimental/multiplexer/dispatch.cc @@ -35,16 +35,21 @@ extern Statistics statistics; extern size_t timeout; -Request::Request(const std::string &h, const TSMBuffer b, const TSMLoc l) - : host(h), length(TSHttpHdrLengthGet(b, l)), io(new ats::io::IO()) +Request::Request(const std::string &h, const TSMBuffer b, const TSMLoc l) : host(h), length(0), io(new ats::io::IO()) { assert(!host.empty()); assert(b != NULL); assert(l != NULL); - assert(length > 0); assert(io.get() != NULL); TSHttpHdrPrint(b, l, io->buffer); - assert(length == TSIOBufferReaderAvail(io->reader)); + length = TSIOBufferReaderAvail(io->reader); + assert(length > 0); + /* + * TSHttpHdrLengthGet returns the size with possible "internal" headers + * which are not printed by TSHttpHdrPrint. + * Therefore the greater than or equal comparisson + */ + assert(TSHttpHdrLengthGet(b, l) >= length); } Request::Request(const Request &r) : host(r.host), length(r.length), io(const_cast(r).io.release())