{
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
#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;
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 (!canSend(fd))
+ /* 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 (!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
#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