Repository: trafficserver Updated Branches: refs/heads/master 34a9a719a -> fc1af3684
fix some minor text formatting in the docs for background fetch Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/fc1af368 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/fc1af368 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/fc1af368 Branch: refs/heads/master Commit: fc1af3684230c0e44fd9138174ac02291923510b Parents: 34a9a71 Author: Sudheer Vinukonda <[email protected]> Authored: Sat Nov 1 21:29:57 2014 +0000 Committer: Sudheer Vinukonda <[email protected]> Committed: Sat Nov 1 21:29:57 2014 +0000 ---------------------------------------------------------------------- doc/reference/plugins/background_fetch.en.rst | 21 +++++++++----------- .../background_fetch/background_fetch.cc | 10 ++++++++++ 2 files changed, 19 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/fc1af368/doc/reference/plugins/background_fetch.en.rst ---------------------------------------------------------------------- diff --git a/doc/reference/plugins/background_fetch.en.rst b/doc/reference/plugins/background_fetch.en.rst index 6b91585..e1b4065 100644 --- a/doc/reference/plugins/background_fetch.en.rst +++ b/doc/reference/plugins/background_fetch.en.rst @@ -66,24 +66,21 @@ original client request, which continues as normal. Only one background fetch per URL is ever performed, making sure we do not accidentally put pressure on the origin servers. -The plugin now supports a config file that can specify exclusion of background -fetch based on a header or client-ip. +The plugin now supports a config file that can specify exclusion or inclusion of +background fetch based on any arbitrary header or client-ip:: -To specify the exclusion criteria, the plugin needs to be activated as below: - -background_fetch.so --config <config-file> + background_fetch.so --config <config-file> -The contents of the config-file could be as below: +The contents of the config-file could be as below:: -exclude Client-IP 127.0.0.1 -include User-Agent ABCDEF -exclude Content-Type text -exclude X-Foo-Bar text + include User-Agent ABCDEF + exclude Content-Type text + exclude X-Foo-Bar text The plugin also now supports per remap activation. To activate the plugin for -a given remap, add the below on the remap line: +a given remap, add the below on the remap line:: -@plugin=background_fetch.so @pparam=<config-file> + @plugin=background_fetch.so @pparam=<config-file> Future additions ---------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/fc1af368/plugins/experimental/background_fetch/background_fetch.cc ---------------------------------------------------------------------- diff --git a/plugins/experimental/background_fetch/background_fetch.cc b/plugins/experimental/background_fetch/background_fetch.cc index de1f6e6..f48ea05 100644 --- a/plugins/experimental/background_fetch/background_fetch.cc +++ b/plugins/experimental/background_fetch/background_fetch.cc @@ -681,6 +681,10 @@ check_field_configured(TSHttpTxn txnp, const char* field_name, const char* cfg_v { // check for client-ip first if (!strcmp(field_name, "Client-IP")) { + if (!strcmp(cfg_val, "*")) { + TSDebug(PLUGIN_NAME, "Found client_ip wild card"); + return true; + } if (check_client_ip_configured(txnp, cfg_val)) { TSDebug(PLUGIN_NAME, "Found client_ip match"); return true; @@ -703,6 +707,12 @@ check_field_configured(TSHttpTxn txnp, const char* field_name, const char* cfg_v TSMLoc loc = TSMimeHdrFieldFind(hdr_bufp, req_hdrs, field_name, -1); if (TS_NULL_MLOC != loc) { + if (!strcmp(cfg_val, "*")) { + TSDebug(PLUGIN_NAME, "Found %s wild card", field_name); + TSHandleMLocRelease(hdr_bufp, req_hdrs, loc); + TSHandleMLocRelease(hdr_bufp, TS_NULL_MLOC, req_hdrs); + return true; + } int val_len = 0; const char *val_str = TSMimeHdrFieldValueStringGet(hdr_bufp, req_hdrs, loc, 0, &val_len);
