From: Amos Jeffries Date: Tue, 21 Dec 2010 00:52:56 +0000 (-0700) Subject: Author: Alex Rousskov X-Git-Tag: SQUID_3_1_10~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a9b91ca734d76014afb0ae5d0ba894ba344c517b;p=thirdparty%2Fsquid.git Author: Alex Rousskov Polished HttpStateData::persistentConnStatus() code. No functionality changes. Do not check for flags.headers_parsed. The removed check was: - misplaced: connection-related conditions such as eof must be checked first; - wasteful: we never call persistentConnStatus() unless we parsed headers. Moreover, calling persistentConnStatus() before we parse headers would trigger and assertion because the method uses virginReply() which does not exist until the headers are parsed. Moved virginReply() call closer to the first virgin reply use. This will help re-adding "did we parse the header yet" check if we ever need it again. It also saves a couple of CPU cycles for some transactions. --- diff --git a/src/http.cc b/src/http.cc index c8bb9ece2e..0b92260247 100644 --- a/src/http.cc +++ b/src/http.cc @@ -967,15 +967,6 @@ HttpStateData::ConnectionStatus HttpStateData::persistentConnStatus() const { debugs(11, 3, "persistentConnStatus: FD " << fd << " eof=" << eof); - const HttpReply *vrep = virginReply(); - debugs(11, 5, "persistentConnStatus: content_length=" << vrep->content_length); - - /* If we haven't seen the end of reply headers, we are not done */ - debugs(11, 5, "persistentConnStatus: flags.headers_parsed=" << flags.headers_parsed); - - if (!flags.headers_parsed) - return INCOMPLETE_MSG; - if (eof) // already reached EOF return COMPLETE_NONPERSISTENT_MSG; @@ -987,6 +978,9 @@ HttpStateData::persistentConnStatus() const if (lastChunk && flags.chunked) return statusIfComplete(); + const HttpReply *vrep = virginReply(); + debugs(11, 5, "persistentConnStatus: content_length=" << vrep->content_length); + const int64_t clen = vrep->bodySize(request->method); debugs(11, 5, "persistentConnStatus: clen=" << clen);