From: Alex Rousskov Date: Mon, 21 Sep 2015 18:17:38 +0000 (-0600) Subject: eCAP: Return unknown body size for bodies with unknown body sizes. X-Git-Tag: SQUID_4_0_1~51 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7e5aec8db700d4fe1b18f50e42c25c822b86b9dc;p=thirdparty%2Fsquid.git eCAP: Return unknown body size for bodies with unknown body sizes. Previously, unsigned -1 size was returned for those bodies. Old adapters relying on that buggy behavior will now throw: !"attempt to use unknown libecap::BodySize size" Such adapters should check libecap::BodySize::known() before using the libecap::Body::bodySize() value. --- diff --git a/src/adaptation/ecap/MessageRep.cc b/src/adaptation/ecap/MessageRep.cc index 3d5e095010..53962dda40 100644 --- a/src/adaptation/ecap/MessageRep.cc +++ b/src/adaptation/ecap/MessageRep.cc @@ -353,7 +353,7 @@ Adaptation::Ecap::BodyRep::tie(const BodyPipe::Pointer &aBody) Adaptation::Ecap::BodyRep::BodySize Adaptation::Ecap::BodyRep::bodySize() const { - return !theBody ? BodySize() : BodySize(theBody->bodySize()); + return (theBody && theBody->bodySizeKnown()) ? BodySize(theBody->bodySize()) : BodySize(); } /* MessageRep */