From 6855338d2041e3a6e545e347c0b42ff8d32854c0 Mon Sep 17 00:00:00 2001 From: Susan Hinrichs Date: Tue, 14 Feb 2017 20:39:52 +0000 Subject: [PATCH] Issue #1443 - Fix early or duplicate 404 error handling --- proxy/http/HttpSM.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc index b9bbe5170af..6f02cb96898 100644 --- a/proxy/http/HttpSM.cc +++ b/proxy/http/HttpSM.cc @@ -7264,7 +7264,14 @@ HttpSM::set_next_state() do_remap_request(true); /* run inline */ DebugSM("url_rewrite", "completed inline remapping request for [%" PRId64 "]", sm_id); t_state.url_remap_success = remapProcessor.finish_remap(&t_state); - call_transact_and_set_next_state(nullptr); + if (t_state.next_action == HttpTransact::SM_ACTION_SEND_ERROR_CACHE_NOOP && t_state.transact_return_point == nullptr) { + // It appears that we can now set the next_action to error and transact_return_point to nullptr when + // going through do_remap_request presumably due to a plugin setting an error. In that case, it seems + // that the error message has already been setup, so we can just return and avoid the further + // call_transact_and_set_next_state + } else { + call_transact_and_set_next_state(nullptr); + } } else { HTTP_SM_SET_DEFAULT_HANDLER(&HttpSM::state_remap_request); do_remap_request(false); /* dont run inline (iow on another thread) */