From 0c66741ab291de7779d6558f672be0b32c9e490c Mon Sep 17 00:00:00 2001 From: Arunan Sugunakumar Date: Tue, 16 May 2023 13:50:25 +0530 Subject: [PATCH] Mark error Handler during error scenario --- .../org/apache/synapse/transport/passthru/ClientWorker.java | 2 ++ .../org/apache/synapse/transport/passthru/TargetHandler.java | 2 ++ 2 files changed, 4 insertions(+) diff --git a/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/ClientWorker.java b/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/ClientWorker.java index 6885d085f1..59ee8c2beb 100644 --- a/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/ClientWorker.java +++ b/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/ClientWorker.java @@ -145,6 +145,8 @@ public ClientWorker(TargetConfiguration targetConfiguration, outMsgCtx.getProperty(PassThroughConstants.PASS_THROUGH_SOURCE_CONFIGURATION)); responseMsgCtx.setProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_IN_MESSAGES, outMsgCtx.getProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_IN_MESSAGES)); + responseMsgCtx.setProperty(PassThroughConstants.INTERNAL_EXCEPTION_ORIGIN, + outMsgCtx.getProperty(PassThroughConstants.INTERNAL_EXCEPTION_ORIGIN)); responseMsgCtx.setServerSide(true); responseMsgCtx.setDoingREST(outMsgCtx.isDoingREST()); diff --git a/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/TargetHandler.java b/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/TargetHandler.java index 120d5cb720..1e2ca33f59 100644 --- a/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/TargetHandler.java +++ b/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/TargetHandler.java @@ -381,6 +381,8 @@ public void responseReceived(NHttpClientConnection conn) { // waiting on writing the request out, will get notified. And we will proceed with the response // regardless of the http status code. But mark target and source connections to be closed. informWriterError(conn); + requestMsgContext.setProperty(PassThroughConstants.INTERNAL_EXCEPTION_ORIGIN, + PassThroughConstants.INTERNAL_ORIGIN_ERROR_HANDLER); StatusLine errorStatus = response.getStatusLine(); if (errorStatus != null) { TargetContext.updateState(conn, ProtocolState.REQUEST_DONE);