From: Amos Jeffries Date: Wed, 18 May 2011 12:50:48 +0000 (+1200) Subject: Cleanup: shuffle HttpRequest::inheritProperties next to clone() X-Git-Tag: take07~16^2~10 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d596406744f3251365572866805eb760861e5115;p=thirdparty%2Fsquid.git Cleanup: shuffle HttpRequest::inheritProperties next to clone() Making it a bit easier to see exactly what fields are duplicated and which are not. --- diff --git a/src/HttpRequest.cc b/src/HttpRequest.cc index 5cfe284de2..580938159b 100644 --- a/src/HttpRequest.cc +++ b/src/HttpRequest.cc @@ -229,6 +229,45 @@ HttpRequest::clone() const return copy; } +bool +HttpRequest::inheritProperties(const HttpMsg *aMsg) +{ + const HttpRequest* aReq = dynamic_cast(aMsg); + if (!aReq) + return false; + + client_addr = aReq->client_addr; +#if FOLLOW_X_FORWARDED_FOR + indirect_client_addr = aReq->indirect_client_addr; +#endif +#if USE_SQUID_EUI + client_eui48 = aReq->client_eui48; + client_eui64 = aReq->client_eui64; +#endif + my_addr = aReq->my_addr; + + dnsWait = aReq->dnsWait; + +#if USE_ADAPTATION + adaptHistory_ = aReq->adaptHistory(); +#endif +#if ICAP_CLIENT + icapHistory_ = aReq->icapHistory(); +#endif + + // This may be too conservative for the 204 No Content case + // may eventually need cloneNullAdaptationImmune() for that. + flags = aReq->flags.cloneAdaptationImmune(); + + errType = aReq->errType; + errDetail = aReq->errDetail; +#if USE_AUTH + auth_user_request = aReq->auth_user_request; +#endif + clientConnectionManager = aReq->clientConnectionManager; + return true; +} + /** * Checks the first line of an HTTP request is valid * currently just checks the request method is present. @@ -604,45 +643,8 @@ HttpRequest::conditional() const header.has(HDR_IF_NONE_MATCH); } -bool HttpRequest::inheritProperties(const HttpMsg *aMsg) -{ - const HttpRequest* aReq = dynamic_cast(aMsg); - if (!aReq) - return false; - - client_addr = aReq->client_addr; -#if FOLLOW_X_FORWARDED_FOR - indirect_client_addr = aReq->indirect_client_addr; -#endif -#if USE_SQUID_EUI - client_eui48 = aReq->client_eui48; - client_eui64 = aReq->client_eui64; -#endif - my_addr = aReq->my_addr; - - dnsWait = aReq->dnsWait; - -#if USE_ADAPTATION - adaptHistory_ = aReq->adaptHistory(); -#endif -#if ICAP_CLIENT - icapHistory_ = aReq->icapHistory(); -#endif - - // This may be too conservative for the 204 No Content case - // may eventually need cloneNullAdaptationImmune() for that. - flags = aReq->flags.cloneAdaptationImmune(); - - errType = aReq->errType; - errDetail = aReq->errDetail; -#if USE_AUTH - auth_user_request = aReq->auth_user_request; -#endif - clientConnectionManager = aReq->clientConnectionManager; - return true; -} - -void HttpRequest::recordLookup(const DnsLookupDetails &dns) +void +HttpRequest::recordLookup(const DnsLookupDetails &dns) { if (dns.wait >= 0) { // known delay if (dnsWait >= 0) // have recorded DNS wait before