From: rousskov <> Date: Mon, 16 Apr 2007 23:43:27 +0000 (+0000) Subject: Bug #1935 fix: Do not retry a request after sending [some of] its body. X-Git-Tag: SQUID_3_0_PRE6~85 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=58217e94ef39bec53ababe6854d878a155ff1c6c;p=thirdparty%2Fsquid.git Bug #1935 fix: Do not retry a request after sending [some of] its body. Replaced forgotten request_flags::body_sent with HttpRequest::bodyNibbled() that does not need to be manually updated. The BodyPipe changes probably deleted the code that set request_flags::body_sent. --- diff --git a/src/HttpRequest.cc b/src/HttpRequest.cc index a68e28c245..94dbd814f2 100644 --- a/src/HttpRequest.cc +++ b/src/HttpRequest.cc @@ -1,6 +1,6 @@ /* - * $Id: HttpRequest.cc,v 1.71 2007/04/06 04:50:04 rousskov Exp $ + * $Id: HttpRequest.cc,v 1.72 2007/04/16 17:43:27 rousskov Exp $ * * DEBUG: section 73 HTTP Request * AUTHOR: Duane Wessels @@ -343,6 +343,10 @@ request_flags::cloneAdaptationImmune() const return *this; } +bool +HttpRequest::bodyNibbled() const { + return body_pipe != NULL && body_pipe->consumedSize() > 0; +} const char *HttpRequest::packableURI(bool full_uri) const { diff --git a/src/HttpRequest.h b/src/HttpRequest.h index cffb1f90ed..7f6f338127 100644 --- a/src/HttpRequest.h +++ b/src/HttpRequest.h @@ -1,6 +1,6 @@ /* - * $Id: HttpRequest.h,v 1.25 2007/04/06 04:50:04 rousskov Exp $ + * $Id: HttpRequest.h,v 1.26 2007/04/16 17:43:27 rousskov Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -137,6 +137,8 @@ public: virtual bool expectingBody(method_t unused, ssize_t&) const; + bool bodyNibbled() const; // the request has a [partially] consumed body + int prefixLen(); void swapOut(StoreEntry * e); diff --git a/src/forward.cc b/src/forward.cc index 07c9f25fff..efdbad76fa 100644 --- a/src/forward.cc +++ b/src/forward.cc @@ -1,6 +1,6 @@ /* - * $Id: forward.cc,v 1.156 2007/04/15 14:46:16 serassio Exp $ + * $Id: forward.cc,v 1.157 2007/04/16 17:43:27 rousskov Exp $ * * DEBUG: section 17 Request Forwarding * AUTHOR: Duane Wessels @@ -441,7 +441,7 @@ FwdState::checkRetry() if (flags.dont_retry) return false; - if (request->flags.body_sent) + if (request->bodyNibbled()) return false; return true; @@ -1034,7 +1034,7 @@ FwdState::reforward() if (origin_tries > 1) return 0; - if (request->flags.body_sent) + if (request->bodyNibbled()) return 0; assert(fs); diff --git a/src/structs.h b/src/structs.h index 9ba0287f2b..42dd7e37a0 100644 --- a/src/structs.h +++ b/src/structs.h @@ -1,6 +1,6 @@ /* - * $Id: structs.h,v 1.554 2007/04/15 14:46:17 serassio Exp $ + * $Id: structs.h,v 1.555 2007/04/16 17:43:27 rousskov Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -1236,7 +1236,7 @@ struct _iostats struct request_flags { - request_flags():range(0),nocache(0),ims(0),auth(0),cachable(0),hierarchical(0),loopdetect(0),proxy_keepalive(0),proxying(0),refresh(0),redirected(0),need_validation(0),accelerated(0),transparent(0),internal(0),internalclient(0),body_sent(0),must_keepalive(0),destinationIPLookedUp_(0) + request_flags():range(0),nocache(0),ims(0),auth(0),cachable(0),hierarchical(0),loopdetect(0),proxy_keepalive(0),proxying(0),refresh(0),redirected(0),need_validation(0),accelerated(0),transparent(0),internal(0),internalclient(0),must_keepalive(0),destinationIPLookedUp_(0) { #if HTTP_VIOLATIONS nocache_hack = 0; @@ -1304,9 +1304,6 @@ unsigned int internal: unsigned int internalclient: 1; -unsigned int body_sent: - 1; - unsigned int must_keepalive: 1;