From: Alex Rousskov Date: Wed, 23 Mar 2011 00:18:28 +0000 (-0600) Subject: Propagate details of ICAP errors happened after adapted HTTP header creation. X-Git-Tag: take06~27^2~76 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e9fa54936418dd6246f4fc941e232d37218f6efc;p=thirdparty%2Fsquid.git 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. --- 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 */