You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2015/04/03 16:24:44 UTC
[1/2] trafficserver git commit: TS-3448 Add a new Mod operator to
ControlMatcher, named "internal"
Repository: trafficserver
Updated Branches:
refs/heads/master 8b5f44792 -> 6b6e7450b
TS-3448 Add a new Mod operator to ControlMatcher, named "internal"
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/99073afd
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/99073afd
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/99073afd
Branch: refs/heads/master
Commit: 99073afd54c1bf6a492c5f2121f0664d117c470e
Parents: 8b5f447
Author: Leif Hedstrom <zw...@apache.org>
Authored: Tue Mar 17 15:36:50 2015 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Fri Apr 3 08:09:20 2015 -0600
----------------------------------------------------------------------
CHANGES | 2 +
doc/reference/configuration/cache.config.en.rst | 7 +++
.../configuration/parent.config.en.rst | 7 +++
proxy/ControlBase.cc | 52 ++++++++++++++++++++
proxy/ControlBase.h | 1 +
proxy/ControlMatcher.h | 3 +-
proxy/config/cache.config.default | 1 +
proxy/config/parent.config.default | 1 +
proxy/http/HttpTransact.cc | 1 +
9 files changed, 74 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/99073afd/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 7257057..d79a2b5 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
-*- coding: utf-8 -*-
Changes with Apache Traffic Server 6.0.0
+ *) [TS-3448] Add a new Mod operator to ControlMatcher, named "internal".
+
*) [TS-3483] Fix regex remap to work with CONNECT.
*) [TS-3479] Remove verbose Warning() from HTTP/2 connections.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/99073afd/doc/reference/configuration/cache.config.en.rst
----------------------------------------------------------------------
diff --git a/doc/reference/configuration/cache.config.en.rst b/doc/reference/configuration/cache.config.en.rst
index f0c1eab..397fb2b 100644
--- a/doc/reference/configuration/cache.config.en.rst
+++ b/doc/reference/configuration/cache.config.en.rst
@@ -111,6 +111,13 @@ following list shows possible secondary specifiers with allowed values.
``src_ip``
A client IP address.
+.. _cache-config-format-internal:
+
+``internal``
+ A boolean value, ``true`` or ``false``, specifying if the rule should
+ match (or not match) a transaction originating from an internal API. This
+ is useful to differentiate transaction originating from an ATS plugin.
+
The following list shows possible actions and their allowed values.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/99073afd/doc/reference/configuration/parent.config.en.rst
----------------------------------------------------------------------
diff --git a/doc/reference/configuration/parent.config.en.rst b/doc/reference/configuration/parent.config.en.rst
index f025a7a..c0ec0b4 100644
--- a/doc/reference/configuration/parent.config.en.rst
+++ b/doc/reference/configuration/parent.config.en.rst
@@ -112,6 +112,13 @@ values.
``src_ip``
A client IP address.
+.. _parent-config-format-internal:
+
+``internal``
+ A boolean value, ``true`` or ``false``, specifying if the rule should
+ match (or not match) a transaction originating from an internal API. This
+ is useful to differentiate transaction originating from an ATS plugin.
+
The following list shows the possible actions and their allowed values.
.. _parent-config-format-parent:
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/99073afd/proxy/ControlBase.cc
----------------------------------------------------------------------
diff --git a/proxy/ControlBase.cc b/proxy/ControlBase.cc
index f634ad2..a149124 100644
--- a/proxy/ControlBase.cc
+++ b/proxy/ControlBase.cc
@@ -633,6 +633,56 @@ TagMod::make(char *value, char const ** /* error ATS_UNUSED */)
}
// ----------
+struct InternalMod : public ControlBase::Modifier {
+ bool flag;
+ static char const *const NAME;
+
+ virtual Type
+ type() const
+ {
+ return MOD_INTERNAL;
+ }
+ virtual char const *
+ name() const
+ {
+ return NAME;
+ }
+ virtual bool
+ check(HttpRequestData *req) const
+ {
+ return req->internal_txn == flag;
+ }
+ virtual void
+ print(FILE *f) const
+ {
+ fprintf(f, "%s=%s ", this->name(), flag ? "true" : "false");
+ }
+ static InternalMod *make(char *value, char const **error);
+};
+
+char const *const InternalMod::NAME = "Internal";
+
+InternalMod *
+InternalMod::make(char *value, char const **error)
+{
+ InternalMod tmp;
+
+ if (0 == strncasecmp("false", value, 5)) {
+ tmp.flag = false;
+ } else if (0 == strncasecmp("true", value, 4)) {
+ tmp.flag = true;
+ } else {
+ *error = "Value must be true or false";
+ }
+
+ if (*error) {
+ return NULL;
+ } else {
+ return new InternalMod(tmp);
+ }
+}
+
+// ----------
} // anon name space
// ------------------------------------------------
ControlBase::~ControlBase()
@@ -765,6 +815,8 @@ ControlBase::ProcessModifiers(matcher_line *line_info)
mod = TimeMod::make(value, &errBuf);
} else if (strcasecmp(label, "tag") == 0) {
mod = TagMod::make(value, &errBuf);
+ } else if (strcasecmp(label, "internal") == 0) {
+ mod = InternalMod::make(value, &errBuf);
} else {
err = ME_BAD_MOD;
}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/99073afd/proxy/ControlBase.h
----------------------------------------------------------------------
diff --git a/proxy/ControlBase.h b/proxy/ControlBase.h
index 8ada921..48d393d 100644
--- a/proxy/ControlBase.h
+++ b/proxy/ControlBase.h
@@ -54,6 +54,7 @@ public:
MOD_SRC_IP,
MOD_IPORT,
MOD_TAG,
+ MOD_INTERNAL,
};
/// Destructor - force virtual.
virtual ~Modifier();
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/99073afd/proxy/ControlMatcher.h
----------------------------------------------------------------------
diff --git a/proxy/ControlMatcher.h b/proxy/ControlMatcher.h
index b0126da..999d09f 100644
--- a/proxy/ControlMatcher.h
+++ b/proxy/ControlMatcher.h
@@ -146,7 +146,7 @@ public:
inkcoreapi sockaddr const *get_ip();
inkcoreapi sockaddr const *get_client_ip();
- HttpRequestData() : hdr(NULL), hostname_str(NULL), api_info(NULL), xact_start(0), incoming_port(0), tag(NULL)
+ HttpRequestData() : hdr(NULL), hostname_str(NULL), api_info(NULL), xact_start(0), incoming_port(0), tag(NULL), internal_txn(false)
{
ink_zero(src_ip);
ink_zero(dest_ip);
@@ -160,6 +160,7 @@ public:
IpEndpoint dest_ip;
uint16_t incoming_port;
char *tag;
+ bool internal_txn;
};
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/99073afd/proxy/config/cache.config.default
----------------------------------------------------------------------
diff --git a/proxy/config/cache.config.default b/proxy/config/cache.config.default
index 565571a..b7d1179 100644
--- a/proxy/config/cache.config.default
+++ b/proxy/config/cache.config.default
@@ -27,6 +27,7 @@
# method=
# time=
# src_ip=
+# internal={true,false}
#
# Each line must include exactly one cache directive
# Cache directives are
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/99073afd/proxy/config/parent.config.default
----------------------------------------------------------------------
diff --git a/proxy/config/parent.config.default b/proxy/config/parent.config.default
index 93eecc3..1cf216e 100644
--- a/proxy/config/parent.config.default
+++ b/proxy/config/parent.config.default
@@ -28,6 +28,7 @@
# method=
# time=
# src_ip=
+# internal={true,false}
#
# Available parent directives are:
# parent= (a semicolon separated list of parent proxies)
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/99073afd/proxy/http/HttpTransact.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index 0ca0a48..ff4820c 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -5591,6 +5591,7 @@ HttpTransact::initialize_state_variables_from_request(State *s, HTTPHdr *obsolet
}
s->request_data.xact_start = s->client_request_time;
s->request_data.api_info = &s->api_info;
+ s->request_data.internal_txn = s->state_machine->ua_session->get_netvc()->get_is_internal_request();
/////////////////////////////////////////////
// Do dns lookup for the host. We need //
[2/2] trafficserver git commit: Allow make clang-format to operate in
an out-of-tree build
Posted by zw...@apache.org.
Allow make clang-format to operate in an out-of-tree build
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/6b6e7450
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/6b6e7450
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/6b6e7450
Branch: refs/heads/master
Commit: 6b6e7450b899f43a766bff8436fa1b1247fd2699
Parents: 99073af
Author: Leif Hedstrom <zw...@apache.org>
Authored: Fri Apr 3 08:09:50 2015 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Fri Apr 3 08:09:50 2015 -0600
----------------------------------------------------------------------
Makefile.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/6b6e7450/Makefile.am
----------------------------------------------------------------------
diff --git a/Makefile.am b/Makefile.am
index b27c248..14708e6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -99,7 +99,7 @@ submodules:
git submodule update --init
clang-format:
- for f in `find . -iname \*.[ch] -o -iname \*.cc | fgrep -v -e lib/ck -e lib/luajit -e lib/tsconfig`; do \
+ for f in `find $(top_srcdir) -iname \*.[ch] -o -iname \*.cc | fgrep -v -e lib/ck -e lib/luajit -e lib/tsconfig`; do \
echo $$f; clang-format -i $$f; done
help: