/*
- * $Id: Server.h,v 1.3 2007/04/06 04:50:05 rousskov Exp $
+ * $Id: Server.h,v 1.4 2007/05/08 16:46:37 rousskov Exp $
*
* AUTHOR: Duane Wessels
*
#if ICAP_CLIENT
#include "ICAP/ICAPServiceRep.h"
#include "ICAP/ICAPInitiator.h"
-#include "ICAP/ICAPModXact.h"
class ICAPAccessCheck;
#endif
virtual void icapAclCheckDone(ICAPServiceRep::Pointer) = 0;
// ICAPInitiator: start an ICAP transaction and receive adapted headers.
- virtual void noteIcapHeadersAdapted();
- virtual void noteIcapHeadersAborted();
+ virtual void noteIcapAnswer(HttpMsg *message);
+ virtual void noteIcapQueryAbort(bool final);
// BodyProducer: provide virgin response body to ICAP.
virtual void noteMoreBodySpaceAvailable(BodyPipe &);
void handleAdaptedBodyProducerAborted();
void handleIcapCompleted();
- void handleIcapAborted();
+ void handleIcapAborted(bool bypassable = false);
#endif
public: // should not be
#if ICAP_CLIENT
BodyPipe::Pointer virginBodyDestination; // to provide virgin response body
- ICAPModXact::Pointer adaptedHeadSource; // to get adapted response headers
+ ICAPInitiate *adaptedHeadSource; // to get adapted response headers
BodyPipe::Pointer adaptedBodySource; // to consume adated response body
bool icapAccessCheckPending;
/*
- * $Id: client_side_request.cc,v 1.83 2007/04/28 22:26:37 hno Exp $
+ * $Id: client_side_request.cc,v 1.84 2007/05/08 16:46:37 rousskov Exp $
*
* DEBUG: section 85 Client-side Request Routines
* AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c)
freeResources();
#if ICAP_CLIENT
- if (icapHeadSource != NULL) {
- icapHeadSource->noteInitiatorAborted();
- icapHeadSource = NULL;
- }
+ announceInitiatorAbort(icapHeadSource);
+
if (icapBodySource != NULL)
stopConsumingFrom(icapBodySource);
#endif
assert(!icapHeadSource);
assert(!icapBodySource);
- icapHeadSource = new ICAPModXact(this, request, NULL, service);
- ICAPModXact::AsyncStart(icapHeadSource.getRaw());
+ icapHeadSource = initiateIcap(
+ new ICAPModXactLauncher(this, request, NULL, service));
return true;
}
void
-ClientHttpRequest::noteIcapHeadersAdapted()
+ClientHttpRequest::noteIcapAnswer(HttpMsg *msg)
{
assert(cbdataReferenceValid(this)); // indicates bug
-
- HttpMsg *msg = icapHeadSource->adapted.header;
assert(msg);
if (HttpRequest *new_req = dynamic_cast<HttpRequest*>(msg)) {
}
// we are done with getting headers (but may be receiving body)
- icapHeadSource = NULL;
+ clearIcap(icapHeadSource);
if (!request_satisfaction_mode)
doCallouts();
}
void
-ClientHttpRequest::noteIcapHeadersAborted()
+ClientHttpRequest::noteIcapQueryAbort(bool final)
{
- icapHeadSource = NULL;
+ clearIcap(icapHeadSource);
assert(!icapBodySource);
- handleIcapFailure();
+ handleIcapFailure(!final);
}
void
}
void
-ClientHttpRequest::handleIcapFailure()
+ClientHttpRequest::handleIcapFailure(bool bypassable)
{
- debugs(85,3, HERE << "handleIcapFailure");
+ debugs(85,3, HERE << "handleIcapFailure(" << bypassable << ")");
const bool usedStore = storeEntry() && !storeEntry()->isEmpty();
const bool usedPipe = request->body_pipe != NULL &&
request->body_pipe->consumedSize() > 0;
- // XXX: we must not try to recover if the ICAP service is not bypassable!
-
- if (!usedStore && !usedPipe) {
- debugs(85, 2, "WARNING: ICAP REQMOD callout failed, proceeding with original request");
+ if (bypassable && !usedStore && !usedPipe) {
+ debugs(85,3, HERE << "ICAP REQMOD callout failed, bypassing: " << calloutContext);
if (calloutContext)
doCallouts();
return;
/*
- * $Id: client_side_request.h,v 1.27 2007/04/06 04:50:06 rousskov Exp $
+ * $Id: client_side_request.h,v 1.28 2007/05/08 16:46:37 rousskov Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
#if ICAP_CLIENT
#include "ICAP/ICAPServiceRep.h"
#include "ICAP/ICAPInitiator.h"
-#include "ICAP/ICAPModXact.h"
class HttpMsg;
#endif
public:
bool startIcap(ICAPServiceRep::Pointer);
- void handleIcapFailure(); // private but exposed for ClientRequestContext
+
+ // private but exposed for ClientRequestContext
+ void handleIcapFailure(bool bypassable = false);
private:
// ICAPInitiator API, called by ICAPXaction
- virtual void noteIcapHeadersAdapted();
- virtual void noteIcapHeadersAborted();
+ virtual void noteIcapAnswer(HttpMsg *message);
+ virtual void noteIcapQueryAbort(bool final);
// BodyConsumer API, called by BodyPipe
virtual void noteMoreBodyDataAvailable(BodyPipe &);
void endRequestSatisfaction();
private:
- ICAPModXact::Pointer icapHeadSource;
+ ICAPInitiate *icapHeadSource;
BodyPipe::Pointer icapBodySource;
bool request_satisfaction_mode;