This is an automated email from the ASF dual-hosted git repository.
zwoop pushed a commit to branch 9.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/9.1.x by this push:
new 786f0d2 if transaction status non-success, bypass intercept plugin
(#7724)
786f0d2 is described below
commit 786f0d28dd49e55bce9f50236112ef25f55dc83d
Author: Randall Meyer <[email protected]>
AuthorDate: Fri Apr 23 13:51:49 2021 -0700
if transaction status non-success, bypass intercept plugin (#7724)
Don't allow the generator or statichit plugin to intercept the transaction
if a prior plugin has changed the transaction status to something
non-success.
(plus cleanup)
(cherry picked from commit 7e3d7fafafd7574acbe8ccf1c1a6a4791987c688)
---
plugins/experimental/slice/slice.cc | 4 ++--
plugins/experimental/statichit/statichit.cc | 6 ++++++
plugins/generator/generator.cc | 6 ++++++
3 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/plugins/experimental/slice/slice.cc
b/plugins/experimental/slice/slice.cc
index dcb63b8..f25e6bb 100644
--- a/plugins/experimental/slice/slice.cc
+++ b/plugins/experimental/slice/slice.cc
@@ -46,8 +46,8 @@ read_request(TSHttpTxn txnp, Config *const config)
if (!header.hasKey(SLICER_MIME_FIELD_INFO, SLICER_MIME_LEN_INFO)) {
// check if any previous plugin has monkeyed with the transaction status
TSHttpStatus const txnstat = TSHttpTxnStatusGet(txnp);
- if (0 != static_cast<int>(txnstat)) {
- DEBUG_LOG("txn status change detected (%d), skipping plugin\n",
(int)txnstat);
+ if (TS_HTTP_STATUS_NONE != txnstat) {
+ DEBUG_LOG("txn status change detected (%d), skipping plugin\n",
static_cast<int>(txnstat));
return false;
}
diff --git a/plugins/experimental/statichit/statichit.cc
b/plugins/experimental/statichit/statichit.cc
index 8f06be1..c20fb36 100644
--- a/plugins/experimental/statichit/statichit.cc
+++ b/plugins/experimental/statichit/statichit.cc
@@ -563,6 +563,12 @@ TSRemapInit(TSRemapInterface * /* api_info */, char * /*
errbuf */, int /* errbu
TSRemapStatus
TSRemapDoRemap(void *ih, TSHttpTxn rh, TSRemapRequestInfo *rri)
{
+ const TSHttpStatus txnstat = TSHttpTxnStatusGet(rh);
+ if (txnstat != TS_HTTP_STATUS_NONE && txnstat != TS_HTTP_STATUS_OK) {
+ VDEBUG("transaction status_code=%d already set; skipping processing",
static_cast<int>(txnstat));
+ return TSREMAP_NO_REMAP;
+ }
+
StaticHitConfig *cfg = static_cast<StaticHitConfig *>(ih);
if (!cfg) {
diff --git a/plugins/generator/generator.cc b/plugins/generator/generator.cc
index e33681c..c6d018e 100644
--- a/plugins/generator/generator.cc
+++ b/plugins/generator/generator.cc
@@ -732,6 +732,12 @@ TSRemapInit(TSRemapInterface * /* api_info */, char * /*
errbuf */, int /* errbu
TSRemapStatus
TSRemapDoRemap(void * /* ih */, TSHttpTxn txn, TSRemapRequestInfo *rri)
{
+ const TSHttpStatus txnstat = TSHttpTxnStatusGet(txn);
+ if (txnstat != TS_HTTP_STATUS_NONE && txnstat != TS_HTTP_STATUS_OK) {
+ VDEBUG("transaction status_code=%d already set; skipping processing",
static_cast<int>(txnstat));
+ return TSREMAP_NO_REMAP;
+ }
+
// Check if we should turn off the cache before doing anything else ...
CheckCacheable(txn, rri->requestUrl, rri->requestBufp);
TSHttpTxnHookAdd(txn, TS_HTTP_CACHE_LOOKUP_COMPLETE_HOOK, TxnHook);