From e9fa54936418dd6246f4fc941e232d37218f6efc Mon Sep 17 00:00:00 2001 From: Alex Rousskov Date: Tue, 22 Mar 2011 18:18:28 -0600 Subject: [PATCH] Propagate details of ICAP errors happened after adapted HTTP header creation. We used to update the virgin HTTP request with error details even after REQMOD resulted in creation of a new/adapted HTTP request object. When the client side replaced the old/virgin request headers with the new adapted request object, the error details were lost and %err_detail was not logged to the transaction log. This is one more place where a Master Transaction object (with a shared error detail field) should be extracted from the HttpRequest and persist throughout the HTTP transaction lifetime. --- src/adaptation/icap/ModXact.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/adaptation/icap/ModXact.cc b/src/adaptation/icap/ModXact.cc index c2f11a2b25..acb6147c2d 100644 --- a/src/adaptation/icap/ModXact.cc +++ b/src/adaptation/icap/ModXact.cc @@ -1845,10 +1845,14 @@ bool Adaptation::Icap::ModXact::fillVirginHttpHeader(MemBuf &mb) const void Adaptation::Icap::ModXact::detailError(int errDetail) { - if (HttpRequest *request = virgin.cause ? - virgin.cause : dynamic_cast(virgin.header)) { + HttpRequest *request = dynamic_cast(adapted.header); + // if no adapted request, update virgin (and inherit its properties later) + // TODO: make this and HttpRequest::detailError constant, like adaptHistory + if (!request) + request = const_cast(&virginRequest()); + + if (request) request->detailError(ERR_ICAP_FAILURE, errDetail); - } } /* Adaptation::Icap::ModXactLauncher */ -- 2.47.3