From: Amos Jeffries Date: Wed, 8 Dec 2010 12:45:50 +0000 (+1300) Subject: Merged from trunk X-Git-Tag: take08~55^2~124^2~22 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e7cea0edc571378f3bdd13e5eb511b5ab1b985fc;p=thirdparty%2Fsquid.git Merged from trunk --- e7cea0edc571378f3bdd13e5eb511b5ab1b985fc diff --cc src/client_side_request.cc index 9c7629276d,76e3d3aadc..40238bc590 --- a/src/client_side_request.cc +++ b/src/client_side_request.cc @@@ -1514,7 -1515,16 +1517,16 @@@ ClientHttpRequest::noteBodyProducerAbor { assert(!virginHeadSource); stopConsumingFrom(adaptedBodySource); - handleAdaptationFailure(ERR_DETAIL_ICAP_RESPMOD_CLT_SIDE_BODY); + + debugs(85,3, HERE << "REQMOD body production failed"); + if (request_satisfaction_mode) { // too late to recover or serve an error + request->detailError(ERR_ICAP_FAILURE, ERR_DETAIL_CLT_REQMOD_RESP_BODY); - const int fd = getConn()->fd; - Must(fd >= 0); - comm_close(fd); // drastic, but we may be writing a response already ++ const Comm::ConnectionPointer c = getConn()->clientConn; ++ Must(Comm::IsConnOpen(c)); ++ c->close(); // drastic, but we may be writing a response already + } else { + handleAdaptationFailure(ERR_DETAIL_CLT_REQMOD_REQ_BODY); + } } void diff --cc src/forward.cc index 7ed9de2d5e,906918105a..ead2e1fc0e --- a/src/forward.cc +++ b/src/forward.cc @@@ -55,8 -51,11 +55,11 @@@ #include "ip/Intercept.h" #include "ip/tools.h" #include "mgr/Registration.h" + #if USE_SSL + #include "ssl/support.h" + #endif -static PSC fwdStartCompleteWrapper; +static PSC fwdPeerSelectionCompleteWrapper; static PF fwdServerClosedWrapper; #if USE_SSL static PF fwdNegotiateSSLWrapper; diff --cc src/http.cc index dee62d3b91,7bb69d10e7..3bcb96e073 --- a/src/http.cc +++ b/src/http.cc @@@ -1010,19 -1008,17 +1010,17 @@@ HttpStateData::statusIfComplete() cons HttpStateData::ConnectionStatus HttpStateData::persistentConnStatus() const { - debugs(11, 3, "persistentConnStatus: FD " << fd << " eof=" << eof); + debugs(11, 3, HERE << serverConnection << " 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; + /* If server fd is closing (but we have not been notified yet), stop Comm + I/O to avoid assertions. TODO: Change Comm API to handle callers that + want more I/O after async closing (usually initiated by others). */ + // XXX: add canReceive or s/canSend/canTalkToServer/ - if (!canSend(fd)) ++ if (!Comm::IsConnOpen(serverConnection)) + return COMPLETE_NONPERSISTENT_MSG; + /** \par * In chunked response we do not know the content length but we are absolutely * sure about the end of response, so we are calling the statusIfComplete to diff --cc src/stat.cc index 3ebad838c2,a020ccf4e9..bf178566d9 --- a/src/stat.cc +++ b/src/stat.cc @@@ -55,8 -55,10 +55,11 @@@ #include "mgr/InfoAction.h" #include "mgr/IntervalAction.h" #include "mgr/IoAction.h" +#include "mgr/Registration.h" #include "mgr/ServiceTimesAction.h" + #if USE_SSL + #include "ssl/support.h" + #endif /* these are included because they expose stats calls */ /* TODO: provide a self registration mechanism for those classes