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.
void Adaptation::Icap::ModXact::detailError(int errDetail)
{
- if (HttpRequest *request = virgin.cause ?
- virgin.cause : dynamic_cast<HttpRequest*>(virgin.header)) {
+ HttpRequest *request = dynamic_cast<HttpRequest*>(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<HttpRequest*>(&virginRequest());
+
+ if (request)
request->detailError(ERR_ICAP_FAILURE, errDetail);
- }
}
/* Adaptation::Icap::ModXactLauncher */