[TS-2489] Fix esi plugin problem with contents in comments output twice when the node list is cached
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/793331a3 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/793331a3 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/793331a3 Branch: refs/heads/5.0.x Commit: 793331a31f20c7980fae062a5e803dff29f9e7e9 Parents: 0ef2f54 Author: Yu Qing <zhuangy...@taobao.com> Authored: Sat Jan 11 22:53:26 2014 -0800 Committer: Kit Chan <kic...@apache.org> Committed: Sat Jan 11 22:53:26 2014 -0800 ---------------------------------------------------------------------- CHANGES | 4 ++++ plugins/experimental/esi/lib/EsiProcessor.cc | 9 +++++++-- plugins/experimental/esi/lib/EsiProcessor.h | 1 + 3 files changed, 12 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/793331a3/CHANGES ---------------------------------------------------------------------- diff --git a/CHANGES b/CHANGES index 85a5ce6..5d575e5 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,10 @@ -*- coding: utf-8 -*- Changes with Apache Traffic Server 4.2.0 + *) [TS-2489] Fix esi plugin problem with contents in comments output + twice when the node list is cached. + Author: Yu Qing <zhuangy...@taobao.com> + *) [TS-2336] First attempt at moving the Prefetch APIs into some usable state. There's still work to be done here, but separate bugs for that. http://git-wip-us.apache.org/repos/asf/trafficserver/blob/793331a3/plugins/experimental/esi/lib/EsiProcessor.cc ---------------------------------------------------------------------- diff --git a/plugins/experimental/esi/lib/EsiProcessor.cc b/plugins/experimental/esi/lib/EsiProcessor.cc index 96a647e..3ece0f4 100644 --- a/plugins/experimental/esi/lib/EsiProcessor.cc +++ b/plugins/experimental/esi/lib/EsiProcessor.cc @@ -47,7 +47,10 @@ EsiProcessor::EsiProcessor(const char *debug_tag, const char *parser_debug_tag, _n_processed_nodes(0), _n_processed_try_nodes(0), _overall_len(0), - _fetcher(fetcher), _esi_vars(variables), + _fetcher(fetcher), + _reqAdded(false), + _usePackedNodeList(false), + _esi_vars(variables), _expression(expression_debug_tag, debug_func, error_func, _esi_vars), _n_try_blocks_processed(0), _handler_manager(handler_mgr) { } @@ -59,6 +62,7 @@ EsiProcessor::start() { stop(); } _curr_state = PARSING; + _usePackedNodeList = false; return true; } @@ -123,6 +127,7 @@ EsiProcessor::usePackedNodeList(const char *data, int data_len) { error(); return UNPACK_FAILURE; } + _usePackedNodeList = true; return _handleParseComplete() ? PROCESS_SUCCESS : PROCESS_FAILURE; } @@ -715,7 +720,7 @@ EsiProcessor::_preprocess(DocNodeList &node_list, int &n_prescanned_nodes) { _debugLog(_debug_tag, "[%s] handled try node successfully", __FUNCTION__); break; case DocNode::TYPE_HTML_COMMENT: - if (!_handleHtmlComment(list_iter)) { + if (!_usePackedNodeList && !_handleHtmlComment(list_iter)) { _errorLog("[%s] Failed to preprocess try node", __FUNCTION__); return false; } http://git-wip-us.apache.org/repos/asf/trafficserver/blob/793331a3/plugins/experimental/esi/lib/EsiProcessor.h ---------------------------------------------------------------------- diff --git a/plugins/experimental/esi/lib/EsiProcessor.h b/plugins/experimental/esi/lib/EsiProcessor.h index b4f7309..16004c6 100644 --- a/plugins/experimental/esi/lib/EsiProcessor.h +++ b/plugins/experimental/esi/lib/EsiProcessor.h @@ -123,6 +123,7 @@ private: EsiLib::StringHash _include_urls; bool _reqAdded; + bool _usePackedNodeList; bool _processEsiNode(const EsiLib::DocNodeList::iterator &iter); bool _handleParseComplete();