#include "MemBuf.h"
#include "adaptation/icap/ServiceRep.h"
#include "adaptation/Initiate.h"
+#include "AccessLogEntry.h"
class HttpMsg;
class CommConnectCbParams;
-namespace Adaptation {
-namespace Icap {
+namespace Adaptation
+{
+namespace Icap
+{
/*
* The ICAP Xaction implements common tasks for ICAP OPTIONS, REQMOD, and
virtual ~Xaction();
void disableRetries();
+ void disableRepeats(const char *reason);
+ bool retriable() const { return isRetriable; }
+ bool repeatable() const { return isRepeatable; }
// comm handler wrappers, treat as private
void noteCommConnected(const CommConnectCbParams &io);
void noteCommTimedout(const CommTimeoutCbParams &io);
void noteCommClosed(const CommCloseCbParams &io);
+ // TODO: create these only when actually sending/receiving
+ HttpRequest *icapRequest; ///< sent (or at least created) ICAP request
+ HttpReply *icapReply; ///< received ICAP reply, if any
+
+ /// the number of times we tried to get to the service, including this time
+ int attempts;
+
protected:
virtual void start();
virtual void noteInitiatorAborted(); // TODO: move to Adaptation::Initiate
// useful for debugging
virtual bool fillVirginHttpHeader(MemBuf&) const;
- // custom end-of-call checks
+ // custom exception handling and end-of-call checks
+ virtual void callException(const std::exception &e);
virtual void callEnd();
+ // logging
+ void setOutcome(const XactOutcome &xo);
+ virtual void finalizeLogInfo();
+
ServiceRep &service();
+private:
+ void tellQueryAborted();
+ void maybeLog();
+
protected:
int connection; // FD of the ICAP server connection
+ Adaptation::Icap::ServiceRep::Pointer theService;
/*
* We have two read buffers. We would prefer to read directly
size_t commBufSize;
bool commEof;
bool reuseConnection;
- bool isRetriable;
+ bool isRetriable; ///< can retry on persistent connection failures
+ bool isRepeatable; ///< can repeat if no or unsatisfactory response
bool ignoreLastWrite;
const char *stopReason;
AsyncCall::Pointer writer;
AsyncCall::Pointer closer;
+ AccessLogEntry al;
+
+ timeval icap_tr_start; /*time when the ICAP transaction was created */
+ timeval icap_tio_start; /*time when the first ICAP request byte was scheduled for sending*/
+ timeval icap_tio_finish; /*time when the last byte of the ICAP responsewas received*/
+
private:
//CBDATA_CLASS2(Xaction);
};