trafficserver git commit: stream editor plugin: fix broken destructor.
Repository: trafficserver Updated Branches: refs/heads/master 8898b907f -> 7a1b150ac stream editor plugin: fix broken destructor. Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/7a1b150a Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/7a1b150a Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/7a1b150a Branch: refs/heads/master Commit: 7a1b150acf0fc01dda9ad04feb6149debe8261cb Parents: 8898b90 Author: Nick KewAuthored: Mon Aug 31 18:06:47 2015 +0100 Committer: Nick Kew Committed: Mon Aug 31 18:06:47 2015 +0100 -- .../experimental/stream_editor/stream_editor.cc | 19 ++- 1 file changed, 10 insertions(+), 9 deletions(-) -- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7a1b150a/plugins/experimental/stream_editor/stream_editor.cc -- diff --git a/plugins/experimental/stream_editor/stream_editor.cc b/plugins/experimental/stream_editor/stream_editor.cc index 56612d6..6ef6ae5 100644 --- a/plugins/experimental/stream_editor/stream_editor.cc +++ b/plugins/experimental/stream_editor/stream_editor.cc @@ -502,16 +502,17 @@ public: rule_t(const rule_t ) : scope(r.scope), priority(r.priority), from(r.from), to(r.to), refcount(r.refcount) { ++*refcount; } ~rule_t() { -if (!refcount || !--*refcount) { - if (scope) -delete scope; - if (from) -delete from; - if (to) -TSfree(to); +if (refcount) { + if (!--*refcount) { +if (scope) + delete scope; +if (from) + delete from; +if (to) + TSfree(to); +delete refcount; + } } -if (refcount) - delete refcount; } bool
trafficserver git commit: stream_editor: #define WHITESPACE rather than spell it out every time
Repository: trafficserver Updated Branches: refs/heads/master 7a1b150ac -> b4ff34887 stream_editor: #define WHITESPACE rather than spell it out every time Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/b4ff3488 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/b4ff3488 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/b4ff3488 Branch: refs/heads/master Commit: b4ff34887211f85724d43e15dfc21860b7d8f4e1 Parents: 7a1b150 Author: Nick KewAuthored: Mon Aug 31 18:31:38 2015 +0100 Committer: Nick Kew Committed: Mon Aug 31 18:31:38 2015 +0100 -- plugins/experimental/stream_editor/stream_editor.cc | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b4ff3488/plugins/experimental/stream_editor/stream_editor.cc -- diff --git a/plugins/experimental/stream_editor/stream_editor.cc b/plugins/experimental/stream_editor/stream_editor.cc index 6ef6ae5..d828218 100644 --- a/plugins/experimental/stream_editor/stream_editor.cc +++ b/plugins/experimental/stream_editor/stream_editor.cc @@ -86,6 +86,7 @@ */ #define MAX_CONFIG_LINE 1024 #define MAX_RX_MATCH 10 +#define WHITESPACE " \t\r\n" #include @@ -432,14 +433,14 @@ public: } delim = *++from_spec; if (isalnum(delim)) { - len = strcspn(from_spec, " \t\r\n"); + len = strcspn(from_spec, WHITESPACE); } else { const char *end = strchr(++from_spec, delim); if (end) { len = end - from_spec; } else { /* it wasn't a delimiter after all */ -len = strcspn(--from_spec, " \t\r\n"); +len = strcspn(--from_spec, WHITESPACE); } } if (rx) { @@ -466,7 +467,7 @@ public: } } ++scope_spec; - len = strcspn(scope_spec, " "); + len = strcspn(scope_spec, WHITESPACE); if (rx) { scope = new rxscope(uri, icase, scope_spec, len); } else { @@ -484,14 +485,14 @@ public: to_spec += 3; delim = *to_spec; if (isalnum(delim)) { - len = strcspn(to_spec, " \t\r\n"); + len = strcspn(to_spec, WHITESPACE); } else { const char *end = strchr(++to_spec, delim); if (end) { len = end - to_spec; } else { /* it wasn't a delimiter after all */ -len = strcspn(--to_spec, " \t\r\n"); +len = strcspn(--to_spec, WHITESPACE); } } to = TSstrndup(to_spec, len);
trafficserver git commit: stream_editor: reference-count rules, and hope it satisfies coverity scan.
Repository: trafficserver Updated Branches: refs/heads/master 17ca6e33c - 065bf15a5 stream_editor: reference-count rules, and hope it satisfies coverity scan. Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/065bf15a Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/065bf15a Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/065bf15a Branch: refs/heads/master Commit: 065bf15a5f866b06545d958e275be5216ac8 Parents: 17ca6e3 Author: Nick Kew n...@qualys.com Authored: Wed Jul 8 11:11:52 2015 +0100 Committer: Nick Kew n...@qualys.com Committed: Wed Jul 8 11:11:52 2015 +0100 -- .../experimental/stream_editor/stream_editor.cc | 27 ++-- 1 file changed, 14 insertions(+), 13 deletions(-) -- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/065bf15a/plugins/experimental/stream_editor/stream_editor.cc -- diff --git a/plugins/experimental/stream_editor/stream_editor.cc b/plugins/experimental/stream_editor/stream_editor.cc index 743cf15..072a225 100644 --- a/plugins/experimental/stream_editor/stream_editor.cc +++ b/plugins/experimental/stream_editor/stream_editor.cc @@ -383,9 +383,10 @@ private: unsigned int priority; match_t *from; char *to; + int *refcount; public: - rule_t(const char *line) : scope(NULL), priority(5), from(NULL), to(NULL) + rule_t(const char *line) : scope(NULL), priority(5), from(NULL), to(NULL), refcount(NULL) { const char *scope_spec = strcasestr(line, scope:); const char *from_spec = strcasestr(line, from:); @@ -494,24 +495,24 @@ public: } } to = TSstrndup(to_spec, len); + +refcount = new int(1); } - rule_t(const rule_t r) : scope(r.scope), priority(r.priority), from(r.from), to(r.to) {} - /* FIXME - since rules get copied per-request, we can't delete these. - But we can leave these to leak 'cos they're only ever created - as a one-off at startup. Would be cleaner to refcount or to - use subclasses with and without destructor for original vs copy. - ~rule_t() { - if (scope) delete scope; - if (from) delete from; - if (to) TSfree(to); - } - */ + rule_t(const rule_t r) : scope(r.scope), priority(r.priority), from(r.from), to(r.to), refcount(r.refcount) { ++*refcount; } + ~rule_t() { +if (!refcount || !--*refcount) { + if (scope) delete scope; + if (from) delete from; + if (to) TSfree(to); +} +if (refcount) delete refcount; + } bool in_scope(TSHttpTxn tx) const { -/* if no scope is specified then everything is in-scope */ +/* if no scope was specified then everything is in-scope */ return scope ? scope-in_scope(tx) : true; }
trafficserver git commit: stream-editor: Initialise nbytes in final call to process_block().
Repository: trafficserver Updated Branches: refs/heads/master 9a24e93c5 - d0f908da3 stream-editor: Initialise nbytes in final call to process_block(). Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/d0f908da Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/d0f908da Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/d0f908da Branch: refs/heads/master Commit: d0f908da33aa91e99b5d8167d8c950df668844aa Parents: 9a24e93 Author: Nick Kew n...@qualys.com Authored: Sun Jul 5 11:26:46 2015 +0100 Committer: Nick Kew n...@qualys.com Committed: Sun Jul 5 11:26:46 2015 +0100 -- plugins/experimental/stream_editor/stream_editor.cc | 1 + 1 file changed, 1 insertion(+) -- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d0f908da/plugins/experimental/stream_editor/stream_editor.cc -- diff --git a/plugins/experimental/stream_editor/stream_editor.cc b/plugins/experimental/stream_editor/stream_editor.cc index 97ef1a9..743cf15 100644 --- a/plugins/experimental/stream_editor/stream_editor.cc +++ b/plugins/experimental/stream_editor/stream_editor.cc @@ -587,6 +587,7 @@ process_block(contdata_t *contdata, TSIOBufferReader reader) keep = 0; buf = contdata-contbuf.c_str(); buflen = contdata-contbuf.length(); +nbytes = 0; } else { block = TSIOBufferReaderStart(reader); buf = TSIOBufferBlockReadStart(block, reader, nbytes);
trafficserver git commit: stream-editor plugin: remove no-longer-used struct field.
Repository: trafficserver Updated Branches: refs/heads/master 164d507a9 - 197550aa5 stream-editor plugin: remove no-longer-used struct field. Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/197550aa Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/197550aa Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/197550aa Branch: refs/heads/master Commit: 197550aa5992226d5831604acbe7f0f0523edea9 Parents: 164d507 Author: Nick Kew n...@qualys.com Authored: Sat Jul 4 09:11:06 2015 +0100 Committer: Nick Kew n...@qualys.com Committed: Sat Jul 4 09:11:06 2015 +0100 -- plugins/experimental/stream-editor/stream-editor.c++ | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/197550aa/plugins/experimental/stream-editor/stream-editor.c++ -- diff --git a/plugins/experimental/stream-editor/stream-editor.c++ b/plugins/experimental/stream-editor/stream-editor.c++ index c6fb4a2..53d40d0 100644 --- a/plugins/experimental/stream-editor/stream-editor.c++ +++ b/plugins/experimental/stream-editor/stream-editor.c++ @@ -357,7 +357,6 @@ private: unsigned int priority; match_t *from; char *to; -size_t to_len; public: rule_t(const char *line) : scope(NULL), priority(5), from(NULL), to(NULL) { const char *scope_spec = strcasestr(line, scope:); @@ -451,22 +450,22 @@ public: to_spec += 3; delim = *to_spec; if (isalnum(delim)) { -to_len = strcspn(to_spec, \t\r\n); +len = strcspn(to_spec, \t\r\n); } else { const char *end = strchr(++to_spec, delim); if (end) { -to_len = end - to_spec; +len = end - to_spec; } else { /* it wasn't a delimiter after all */ -to_len = strcspn(--to_spec, \t\r\n); +len = strcspn(--to_spec, \t\r\n); } } -to = TSstrndup(to_spec, to_len); +to = TSstrndup(to_spec, len); } rule_t(const rule_t r) : scope(r.scope), priority(r.priority), - from(r.from), to(r.to), to_len(r.to_len) { } + from(r.from), to(r.to) { } /* FIXME - since rules get copied per-request, we can't delete these. But we can leave these to leak 'cos they're only ever created as a one-off at startup. Would be cleaner to refcount or to
[2/2] git commit: Make libxml2 the configuration default XML parser (so it should get a bit of test-driving).
Make libxml2 the configuration default XML parser (so it should get a bit of test-driving). Separate micro-commit so it's an easy distinction we can confine to trunk even if the new code makes it into a release as an option before it's well-tested. Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/57fcef17 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/57fcef17 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/57fcef17 Branch: refs/heads/master Commit: 57fcef17e1ef5020d475d3c8c71d71c6a7c7c337 Parents: 2184cc8 Author: Nick Kew n...@qualys.com Authored: Fri Sep 6 11:01:36 2013 +0100 Committer: Nick Kew n...@qualys.com Committed: Fri Sep 6 11:01:36 2013 +0100 -- build/xml.m4 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/57fcef17/build/xml.m4 -- diff --git a/build/xml.m4 b/build/xml.m4 index d342814..fc342a9 100644 --- a/build/xml.m4 +++ b/build/xml.m4 @@ -31,9 +31,9 @@ AC_DEFUN([TS_CHECK_XML], [ elif test $withval = libxml2 ; then TS_CHECK_XML_LIBXML2 elif test x$withval = x ; then - TS_CHECK_XML_EXPAT + TS_CHECK_XML_LIBXML2 if test $enable_xml = no; then -TS_CHECK_XML_LIBXML2 +TS_CHECK_XML_EXPAT fi else AC_MSG_ERROR([Unrecognised --with-xml option])
[1/2] git commit: Introduce build-time option to select libxml2 in place of expat as build-time parser.
Updated Branches: refs/heads/master 194d2454d - 57fcef17e Introduce build-time option to select libxml2 in place of expat as build-time parser. Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/2184cc8a Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/2184cc8a Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/2184cc8a Branch: refs/heads/master Commit: 2184cc8ace81675d0c4167a380e743c8b96dd808 Parents: 194d245 Author: Nick Kew n...@qualys.com Authored: Fri Sep 6 10:59:34 2013 +0100 Committer: Nick Kew n...@qualys.com Committed: Fri Sep 6 10:59:34 2013 +0100 -- build/xml.m4| 78 ++-- mgmt/stats/StatProcessor.cc | 30 +--- mgmt/stats/StatProcessor.h | 8 + mgmt/utils/XmlUtils.cc | 61 ++- 4 files changed, 161 insertions(+), 16 deletions(-) -- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/2184cc8a/build/xml.m4 -- diff --git a/build/xml.m4 b/build/xml.m4 index 03c59ff..d342814 100644 --- a/build/xml.m4 +++ b/build/xml.m4 @@ -23,12 +23,84 @@ dnl TS_CHECK_XML: look for xml libraries and headers dnl AC_DEFUN([TS_CHECK_XML], [ enable_xml=no - - TS_CHECK_XML_EXPAT - dnl add checks for other varieties of xml here + AC_MSG_CHECKING([For XML parser]) + AC_ARG_WITH(xml, [AC_HELP_STRING([--with-xml=(expat|libxml2)],[select XML parser])], + [ +if test $withval = expat ; then + TS_CHECK_XML_EXPAT +elif test $withval = libxml2 ; then + TS_CHECK_XML_LIBXML2 +elif test x$withval = x ; then + TS_CHECK_XML_EXPAT + if test $enable_xml = no; then +TS_CHECK_XML_LIBXML2 + fi +else + AC_MSG_ERROR([Unrecognised --with-xml option]) +fi + ]) + if test $enable_xml = no; then +AC_MSG_ERROR([An XML parser (expat or libxml2) is required.]) + fi ]) dnl +AC_DEFUN([TS_CHECK_XML_LIBXML2], [ + enable_libxml2=no + libxml2_include= + libxml2_ldflags= + AC_ARG_WITH(libxml2, [AC_HELP_STRING([--with-libxml2=DIR],[use a specific libxml2 library])], + [ +if test x$withval != xyes test x$withval != x; then + if test $withval = yes; then +enable_libxml2=yes +libxml2_include=/usr/include/libxml2 + elif test $withval != no; then +enable_libxml2=yes +libxml2_include=$withval/include/libxml2 +libxml2_ldflags=$withval/lib + fi +fi + ]) + if test ${enable_libxml2} = no; then +enable_libxml2=yes +libxml2_include=/usr/include/libxml2 + fi + if test ${enable_libxml2} != no; then +AC_CACHE_CHECK([libxml2], [ts_cv_libxml2], [ + ts_libxml2_CPPFLAGS=$CPPFLAGS + ts_libxml2_LIBS=$LIBS + ts_libxml2_LDFLAGS=$LDFLAGS + CPPFLAGS=$CPPFLAGS -I$libxml2_include + LDFLAGS=$LDFLAGS $libxml2_ldflags + LIBS=$LIBS -lxml2 + AC_TRY_LINK( +[#include libxml/parser.h], +[xmlSAXHandler sax; xmlCreatePushParserCtxt(sax, NULL, NULL, 0, NULL);], +[ts_cv_libxml2=yes], +[ts_cv_libxml2=no], + ) + CPPFLAGS=$ts_libxml2_CPPFLAGS + LIBS=$ts_libxml2_LIBS + LDFLAGS=$ts_libxml2_LDFLAGS +]) +if test $ts_cv_libxml2 = yes ; then + AC_DEFINE([HAVE_LIBXML2], 1, [Using libxml2]) + if test -d $libxml2_include ; then +TS_ADDTO(CPPFLAGS, [-I${libxml2_include}]) + fi + if test -d $libxml2_ldflags ; then +TS_ADDTO(LDFLAGS, [-L${libxml2_ldflags}]) +TS_ADDTO(LIBTOOL_LINK_FLAGS, [-R${libxml2_ldflags}]) + fi + TS_ADDTO(LIBS, -lxml2) + enable_xml=yes +else + AC_MSG_ERROR([Failed to find libxml2]) +fi + fi +]) + AC_DEFUN([TS_CHECK_XML_EXPAT], [ enable_expat=no AC_ARG_WITH(expat, [AC_HELP_STRING([--with-expat=DIR],[use a specific Expat library])], http://git-wip-us.apache.org/repos/asf/trafficserver/blob/2184cc8a/mgmt/stats/StatProcessor.cc -- diff --git a/mgmt/stats/StatProcessor.cc b/mgmt/stats/StatProcessor.cc index 268dc29..93a3f05 100644 --- a/mgmt/stats/StatProcessor.cc +++ b/mgmt/stats/StatProcessor.cc @@ -65,7 +65,8 @@ startElement(void * /* userData ATS_UNUSED */, const char *name, const char **at statObject = NEW(new StatObject(++statCount)); Debug(MODULE_INIT, \nStat #: --- %d ---\n, statCount); -for (i = 0; atts[i]; i += 2) { +if (atts) + for (i = 0; atts[i]; i += 2) { ink_assert(atts[i + 1]);// Attribute comes in pairs, hopefully. if (!strcmp(atts[i], minimum)) { @@ -93,7 +94,8 @@ startElement(void * /* userData ATS_UNUSED */, const char *name, const char **at nodeVar = true;
git commit: Note TS-2036 fix in CHANGES.
Updated Branches: refs/heads/master fa3a56257 - 23e72ddbe Note TS-2036 fix in CHANGES. Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/23e72ddb Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/23e72ddb Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/23e72ddb Branch: refs/heads/master Commit: 23e72ddbeaa5fd9873cd228055c38e015c31cefd Parents: fa3a562 Author: niq n...@apache.org Authored: Tue Jul 16 13:16:58 2013 +0100 Committer: niq n...@apache.org Committed: Tue Jul 16 13:16:58 2013 +0100 -- CHANGES | 1 + 1 file changed, 1 insertion(+) -- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/23e72ddb/CHANGES -- diff --git a/CHANGES b/CHANGES index 024bc4e..884134c 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,7 @@ -*- coding: utf-8 -*- Changes with Apache Traffic Server 3.3.5 + *) [TS-2036] Enable mgmt update (traffic_line -x) for plugins. *) [TS-2037] Fix start-stop-daemon typo in debian init script.
git commit: TS-2036: register plugin callbacks at startup also switch from #ifndef to #ifdef to reduce confusion that probably gave rise to the bug in the first place.
Updated Branches: refs/heads/master 224cc0c76 - 37394aa00 TS-2036: register plugin callbacks at startup also switch from #ifndef to #ifdef to reduce confusion that probably gave rise to the bug in the first place. Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/37394aa0 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/37394aa0 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/37394aa0 Branch: refs/heads/master Commit: 37394aa002485f27505654447d172ca2f1f2af92 Parents: 224cc0c Author: niq n...@apache.org Authored: Tue Jul 16 00:36:39 2013 +0100 Committer: niq n...@apache.org Committed: Tue Jul 16 00:53:00 2013 +0100 -- proxy/Main.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/37394aa0/proxy/Main.cc -- diff --git a/proxy/Main.cc b/proxy/Main.cc index 0213bec..1f8d269 100644 --- a/proxy/Main.cc +++ b/proxy/Main.cc @@ -1627,11 +1627,11 @@ main(int /* argc ATS_UNUSED */, char **argv) #endif } -#ifndef TS_NO_API -plugin_init(system_config_directory);// plugin.config -#else +#ifdef TS_NO_API api_init(); // we still need to initialize some of the data structure other module needs. // i.e. http_global_hooks +#else +plugin_init(system_config_directory);// plugin.config pmgmt-registerPluginCallbacks(global_config_cbs); #endif
git commit: TS-1847: Don't trash buffer in MIOBuffer::fill
Updated Branches: refs/heads/master cade10bd7 - 10b3e1cff TS-1847: Don't trash buffer in MIOBuffer::fill Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/10b3e1cf Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/10b3e1cf Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/10b3e1cf Branch: refs/heads/master Commit: 10b3e1cff6e40725562a80b39b6d52bede104616 Parents: cade10b Author: niq n...@apache.org Authored: Tue Apr 23 22:30:27 2013 +0100 Committer: niq n...@apache.org Committed: Tue Apr 23 22:30:27 2013 +0100 -- iocore/eventsystem/P_IOBuffer.h | 11 ++- 1 files changed, 6 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/10b3e1cf/iocore/eventsystem/P_IOBuffer.h -- diff --git a/iocore/eventsystem/P_IOBuffer.h b/iocore/eventsystem/P_IOBuffer.h index 0236a95..301e0c7 100644 --- a/iocore/eventsystem/P_IOBuffer.h +++ b/iocore/eventsystem/P_IOBuffer.h @@ -997,15 +997,16 @@ MIOBuffer::write_avail() TS_INLINE void MIOBuffer::fill(int64_t len) { - int64_t f = _writer-write_avail(); + IOBufferBlock *my_writer = _writer; + int64_t f = my_writer-write_avail(); while (f len) { -_writer-fill(f); +my_writer-fill(f); len -= f; if (len 0) - _writer = _writer-next; -f = _writer-write_avail(); + my_writer = my_writer-next; +f = my_writer-write_avail(); } - _writer-fill(len); + my_writer-fill(len); } TS_INLINE int
[1/2] git commit: Drop in libloader code.
Updated Branches: refs/heads/master e2aff41f8 - 41f1c2e14 Drop in libloader code. Necessary build and docs to follow. Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/5654cf4c Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/5654cf4c Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/5654cf4c Branch: refs/heads/master Commit: 5654cf4c4b22e0c81d56f1b8d0afeafaed8a8133 Parents: eabab3e Author: niq n...@apache.org Authored: Sat Apr 6 00:32:59 2013 +0100 Committer: niq n...@apache.org Committed: Sat Apr 6 00:32:59 2013 +0100 -- plugins/libloader/libloader.c | 85 1 files changed, 85 insertions(+), 0 deletions(-) -- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5654cf4c/plugins/libloader/libloader.c -- diff --git a/plugins/libloader/libloader.c b/plugins/libloader/libloader.c new file mode 100644 index 000..ef84c2f --- /dev/null +++ b/plugins/libloader/libloader.c @@ -0,0 +1,85 @@ +/* + * Copyright (C) 2011-13 Qualys, Inc + * Copyright (C) 2013 The Apache Software Foundation + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * QUALYS licenses this file to You under the Apache License, Version 2.0 + * (the License); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + / + +/* libloader: load libraries, making all symbols exported + * universally visible. Equivalent to LoadFile in HTTPD. + * + * Written for ironbee plugin, whose module architecture + * is not compatible with trafficserver's plugins. + * May be useful for other plugins with non-trivial + * library dependencies. + */ + +#include dlfcn.h +#include stdio.h +#include stdlib.h +#include ts/ts.h + +typedef struct { +void *handle; +void *next; +} link_handle; + +static link_handle *libs = NULL; + +static void unloadlibs(void) +{ +link_handle *p = libs; +while (p != NULL) { +link_handle *next = p-next; +dlclose(p-handle); +TSfree(p); +p = next; +} +libs = NULL; +} + +void TSPluginInit(int argc, const char *argv[]) +{ +int i; +TSPluginRegistrationInfo info; + +info.plugin_name = (char *)libloader; +info.vendor_name = (char *)Apache Software Foundation; +info.support_email = (char *)us...@trafficserver.apache.org; + +if (TSPluginRegister(TS_SDK_VERSION_3_0, info) != TS_SUCCESS) { +TSError([libloader] Plugin registration failed.\n); +return; +} + +atexit(unloadlibs); + +for (i = 1; i argc; ++i) { +const char *lib = argv[i]; +void *handle = dlopen(lib, RTLD_GLOBAL|RTLD_NOW); +if (handle) { +link_handle *l = TSmalloc(sizeof(link_handle)); +l-handle = handle; +l-next = libs; +libs = l; +TSDebug(libloader, loaded %s\n, lib); +} +else { +TSError([libloader] failed to load %s: %s\n, lib, dlerror()); +} +} +return; +}
[2/2] git commit: Merge https://git-wip-us.apache.org/repos/asf/trafficserver
Merge https://git-wip-us.apache.org/repos/asf/trafficserver Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/41f1c2e1 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/41f1c2e1 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/41f1c2e1 Branch: refs/heads/master Commit: 41f1c2e143501f060fb8b9b43d40d6ca194c7147 Parents: 5654cf4 e2aff41 Author: niq n...@apache.org Authored: Mon Apr 15 16:32:25 2013 +0100 Committer: niq n...@apache.org Committed: Mon Apr 15 16:32:25 2013 +0100 -- CHANGES| 11 + Vagrantfile|2 +- contrib/manifests/debian.pp|2 +- .../perl/AdminClient/lib/Apache/TS/AdminClient.pm |1 - example/app-template/app-template.cc |6 +- iocore/cache/Cache.cc | 12 + iocore/cache/CacheWrite.cc | 20 ++- iocore/cache/P_CacheInternal.h |3 + iocore/cache/P_CacheVol.h |2 +- mgmt/Main.cc |3 - mgmt/RecordsConfig.cc |6 +- mgmt/api/CfgContextUtils.cc| 70 ++ mgmt/api/CfgContextUtils.h |2 +- mgmt/api/CoreAPI.cc|7 +- mgmt/api/include/mgmtapi.h |2 +- mgmt/stats/StatProcessor.cc|3 +- mgmt/stats/StatType.cc | 84 +-- mgmt/stats/StatType.h |6 +- proxy/Main.cc |6 +- proxy/Makefile.am |3 - proxy/Plugin.cc| 64 + proxy/Plugin.h |2 +- proxy/PluginDB.cc | 205 --- proxy/PluginDB.h | 65 - proxy/config/Makefile.am |1 - proxy/config/mgr.cnf.default |9 - proxy/config/records.config.default.in |3 + 27 files changed, 154 insertions(+), 446 deletions(-) --
[1/3] git commit: Update changes
Updated Branches: refs/heads/master 5c03b0b0e - 4ca44a0c0 Update changes Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/4ca44a0c Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/4ca44a0c Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/4ca44a0c Branch: refs/heads/master Commit: 4ca44a0c0915f0f3bb7bbb91c6f3ee574caadd1a Parents: 1a0718a Author: niq n...@apache.org Authored: Thu Sep 6 11:55:41 2012 +0100 Committer: niq n...@apache.org Committed: Thu Sep 6 11:55:41 2012 +0100 -- CHANGES |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) -- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/4ca44a0c/CHANGES -- diff --git a/CHANGES b/CHANGES index a2bafee..cd68ea9 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,9 @@ -*- coding: utf-8 -*- Changes with Apache Traffic Server 3.3.0 + *) [TS-1364] Rewrite reverse-proxy URL headers in all cases, not just + a basic Redirect target. + *) [TS-1440] Lua transaction and session hook support *) [TS-1266] RAM cache stats are wrong with CLFUS.
[2/3] git commit: Merge https://git-wip-us.apache.org/repos/asf/trafficserver
Merge https://git-wip-us.apache.org/repos/asf/trafficserver Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/1a0718ac Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/1a0718ac Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/1a0718ac Branch: refs/heads/master Commit: 1a0718aceebd4ba1a9a2c8f47e48b8ba700f560a Parents: b18d842 5c03b0b Author: niq n...@apache.org Authored: Thu Sep 6 11:53:08 2012 +0100 Committer: niq n...@apache.org Committed: Thu Sep 6 11:53:08 2012 +0100 -- CHANGES | 11 + config.layout | 19 +- configure.ac| 16 + iocore/cache/RamCacheCLFUS.cc |4 +- plugins/Makefile.am | 12 +- plugins/experimental/Makefile.am| 26 ++ plugins/experimental/lua/TODO | 51 +++ plugins/experimental/lua/example.lua| 57 --- plugins/experimental/lua/examples/hooks.lua | 90 + plugins/experimental/lua/examples/remap.lua | 72 plugins/experimental/lua/examples/test.lua | 14 + plugins/experimental/lua/hook.cc| 443 +++--- plugins/experimental/lua/hook.h | 11 + plugins/experimental/lua/lapi.cc| 60 +++- plugins/experimental/lua/lconfig.cc |2 +- plugins/experimental/lua/lutil.cc | 16 +- plugins/experimental/lua/lutil.h| 31 ++- plugins/experimental/lua/plugin.cc |6 +- plugins/experimental/lua/remap.cc | 10 +- plugins/experimental/metalink/Makefile.am | 22 + proxy/Makefile.am |4 + 21 files changed, 819 insertions(+), 158 deletions(-) --
[3/3] git commit: TS-1364
TS-1364 Fix up reverse-proxying URL headers in all cases, not just a regular redirection target. Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/b18d8424 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/b18d8424 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/b18d8424 Branch: refs/heads/master Commit: b18d8424a605ef7170c6d4db5fcb8ee932d0b5d2 Parents: 1798bb9 Author: niq n...@apache.org Authored: Thu Sep 6 11:47:30 2012 +0100 Committer: niq n...@apache.org Committed: Thu Sep 6 11:47:30 2012 +0100 -- proxy/http/HttpTransact.cc |6 +--- proxy/http/remap/UrlRewrite.cc | 45 ++ 2 files changed, 31 insertions(+), 20 deletions(-) -- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b18d8424/proxy/http/HttpTransact.cc -- diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc index 2313b73..030cf3f 100644 --- a/proxy/http/HttpTransact.cc +++ b/proxy/http/HttpTransact.cc @@ -7960,10 +7960,8 @@ HttpTransact::build_response(State* s, HTTPHdr* base_response, HTTPHdr* outgoing HttpTransactHeaders::convert_response(outgoing_version, outgoing_response); // process reverse mappings on the location header - HTTPStatus outgoing_status = outgoing_response-status_get(); - - if ((outgoing_status != 200) (((outgoing_status = 300) (outgoing_status 400)) || (outgoing_status == 201))) -response_url_remap(outgoing_response); + // TS-1364: do this regardless of response code + response_url_remap(outgoing_response); if (s-http_config_param-enable_http_stats) { if (s-hdr_info.server_response.valid() s-http_config_param-wuts_enabled) { http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b18d8424/proxy/http/remap/UrlRewrite.cc -- diff --git a/proxy/http/remap/UrlRewrite.cc b/proxy/http/remap/UrlRewrite.cc index a739695..a87cfb6 100644 --- a/proxy/http/remap/UrlRewrite.cc +++ b/proxy/http/remap/UrlRewrite.cc @@ -790,6 +790,7 @@ UrlRewrite::_doRemap(UrlMappingContainer mapping_container, URL *request_url) /** Used to do the backwards lookups. */ +#define N_URL_HEADERS 4 bool UrlRewrite::ReverseMap(HTTPHdr *response_header) { @@ -801,34 +802,46 @@ UrlRewrite::ReverseMap(HTTPHdr *response_header) int host_len; char *new_loc_hdr; int new_loc_length; + int i; + const struct { +const char *const field; +const int len; + } url_headers[N_URL_HEADERS] = { +{ MIME_FIELD_LOCATION, MIME_LEN_LOCATION } , +{ MIME_FIELD_CONTENT_LOCATION, MIME_LEN_CONTENT_LOCATION } , +{ URI, 3 } , +{ Destination, 11 } + }; if (unlikely(num_rules_reverse == 0)) { ink_assert(reverse_mappings.empty()); return false; } - location_hdr = response_header-value_get(MIME_FIELD_LOCATION, MIME_LEN_LOCATION, loc_length); + for (i = 0; i N_URL_HEADERS; ++i) { +location_hdr = response_header-value_get(url_headers[i].field, url_headers[i].len, loc_length); - if (location_hdr == NULL) { -Debug(url_rewrite, Reverse Remap called with empty location header); -return false; - } +if (location_hdr == NULL) { + continue; +} - location_url.create(NULL); - location_url.parse(location_hdr, loc_length); +location_url.create(NULL); +location_url.parse(location_hdr, loc_length); - host = location_url.host_get(host_len); +host = location_url.host_get(host_len); - UrlMappingContainer reverse_mapping(response_header-m_heap); +UrlMappingContainer reverse_mapping(response_header-m_heap); - if (reverseMappingLookup(location_url, location_url.port_get(), host, host_len, reverse_mapping)) { -remap_found = true; -_doRemap(reverse_mapping, location_url); -new_loc_hdr = location_url.string_get_ref(new_loc_length); -response_header-value_set(MIME_FIELD_LOCATION, MIME_LEN_LOCATION, new_loc_hdr, new_loc_length); - } +if (reverseMappingLookup(location_url, location_url.port_get(), host, host_len, reverse_mapping)) { + if (i == 0) +remap_found = true; + _doRemap(reverse_mapping, location_url); + new_loc_hdr = location_url.string_get_ref(new_loc_length); + response_header-value_set(url_headers[i].field, url_headers[i].len, new_loc_hdr, new_loc_length); +} - location_url.destroy(); +location_url.destroy(); + } return remap_found; }
svn commit: r1221229 - in /trafficserver/traffic/trunk: CHANGES proxy/hdrs/URL.cc proxy/hdrs/URL.h
Author: niq Date: Tue Dec 20 12:34:42 2011 New Revision: 1221229 URL: http://svn.apache.org/viewvc?rev=1221229view=rev Log: TS-998: Distinguish between normal URLs and proxy URLs containing routing info. Comment: I tried numerous ways to get the URL data more directly rather than reconstruct it. Those approaches were able to fix the original problem but had side-effects. This fix is a line of least resistance. Modified: trafficserver/traffic/trunk/CHANGES trafficserver/traffic/trunk/proxy/hdrs/URL.cc trafficserver/traffic/trunk/proxy/hdrs/URL.h Modified: trafficserver/traffic/trunk/CHANGES URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/CHANGES?rev=1221229r1=1221228r2=1221229view=diff == --- trafficserver/traffic/trunk/CHANGES (original) +++ trafficserver/traffic/trunk/CHANGES Tue Dec 20 12:34:42 2011 @@ -25,6 +25,8 @@ Changes with Apache Traffic Server 3.1.2 *) [TS-1022] Use size specific types for serialized data in binary logs. + *) [TS-998] Distinguish normal URLs from proxy URLs containing routing info. + Changes with Apache Traffic Server 3.1.1 *) [TS-1020] Make logging to a named pipe work on Solaris. Modified: trafficserver/traffic/trunk/proxy/hdrs/URL.cc URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/hdrs/URL.cc?rev=1221229r1=1221228r2=1221229view=diff == --- trafficserver/traffic/trunk/proxy/hdrs/URL.cc (original) +++ trafficserver/traffic/trunk/proxy/hdrs/URL.cc Tue Dec 20 12:34:42 2011 @@ -1061,6 +1061,8 @@ url_parse(HdrHeap * heap, URLImpl * url, cur = *start; + url-is_normal = (*cur == '/'); + skip_ws: if (ParseRules::is_ws(*cur)) { GETNEXT(eof); @@ -1531,34 +1533,36 @@ url_print(URLImpl * url, char *buf_start { #define TRY(x) if (!x) return 0 - if (url-m_ptr_scheme) { -TRY(mime_mem_print(url-m_ptr_scheme, url-m_len_scheme, - buf_start, buf_length, buf_index_inout, buf_chars_to_skip_inout)); -if ((url-m_scheme_wks_idx = 0) (hdrtoken_index_to_wks(url-m_scheme_wks_idx) == URL_SCHEME_FILE)) { - TRY(mime_mem_print(:, 1, buf_start, buf_length, buf_index_inout, buf_chars_to_skip_inout)); -} else { - TRY(mime_mem_print(://, 3, buf_start, buf_length, buf_index_inout, buf_chars_to_skip_inout)); + if (!url_is_normal) { /* URL is proxyreq containing routing components */ +if (url-m_ptr_scheme) { + TRY(mime_mem_print(url-m_ptr_scheme, url-m_len_scheme, + buf_start, buf_length, buf_index_inout, buf_chars_to_skip_inout)); + if ((url-m_scheme_wks_idx = 0) (hdrtoken_index_to_wks(url-m_scheme_wks_idx) == URL_SCHEME_FILE)) { +TRY(mime_mem_print(:, 1, buf_start, buf_length, buf_index_inout, buf_chars_to_skip_inout)); + } else { +TRY(mime_mem_print(://, 3, buf_start, buf_length, buf_index_inout, buf_chars_to_skip_inout)); + } } - } - if (url-m_ptr_user) { -TRY(mime_mem_print(url-m_ptr_user, url-m_len_user, - buf_start, buf_length, buf_index_inout, buf_chars_to_skip_inout)); -if (url-m_ptr_password) { - TRY(mime_mem_print(:, 1, buf_start, buf_length, buf_index_inout, buf_chars_to_skip_inout)); - TRY(mime_mem_print(url-m_ptr_password, url-m_len_password, +if (url-m_ptr_user) { + TRY(mime_mem_print(url-m_ptr_user, url-m_len_user, buf_start, buf_length, buf_index_inout, buf_chars_to_skip_inout)); + if (url-m_ptr_password) { +TRY(mime_mem_print(:, 1, buf_start, buf_length, buf_index_inout, buf_chars_to_skip_inout)); +TRY(mime_mem_print(url-m_ptr_password, url-m_len_password, + buf_start, buf_length, buf_index_inout, buf_chars_to_skip_inout)); + } + TRY(mime_mem_print(@, 1, buf_start, buf_length, buf_index_inout, buf_chars_to_skip_inout)); } -TRY(mime_mem_print(@, 1, buf_start, buf_length, buf_index_inout, buf_chars_to_skip_inout)); - } - if (url-m_ptr_host) { -TRY(mime_mem_print(url-m_ptr_host, url-m_len_host, - buf_start, buf_length, buf_index_inout, buf_chars_to_skip_inout)); -if (url-m_ptr_port url-m_port) { - TRY(mime_mem_print(:, 1, buf_start, buf_length, buf_index_inout, buf_chars_to_skip_inout)); - TRY(mime_mem_print(url-m_ptr_port, url-m_len_port, +if (url-m_ptr_host) { + TRY(mime_mem_print(url-m_ptr_host, url-m_len_host, buf_start, buf_length, buf_index_inout, buf_chars_to_skip_inout)); + if (url-m_ptr_port url-m_port) { +TRY(mime_mem_print(:, 1, buf_start, buf_length, buf_index_inout, buf_chars_to_skip_inout)); +TRY(mime_mem_print(url-m_ptr_port, url-m_len_port, + buf_start, buf_length, buf_index_inout, buf_chars_to_skip_inout)); + } } } Modified
svn commit: r1221268 - /trafficserver/traffic/trunk/proxy/hdrs/URL.cc
Author: niq Date: Tue Dec 20 14:18:08 2011 New Revision: 1221268 URL: http://svn.apache.org/viewvc?rev=1221268view=rev Log: Fix typo in previous commit. Modified: trafficserver/traffic/trunk/proxy/hdrs/URL.cc Modified: trafficserver/traffic/trunk/proxy/hdrs/URL.cc URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/hdrs/URL.cc?rev=1221268r1=1221267r2=1221268view=diff == --- trafficserver/traffic/trunk/proxy/hdrs/URL.cc (original) +++ trafficserver/traffic/trunk/proxy/hdrs/URL.cc Tue Dec 20 14:18:08 2011 @@ -1533,7 +1533,7 @@ url_print(URLImpl * url, char *buf_start { #define TRY(x) if (!x) return 0 - if (!url_is_normal) { /* URL is proxyreq containing routing components */ + if (!url-is_normal) { /* URL is proxyreq containing routing components */ if (url-m_ptr_scheme) { TRY(mime_mem_print(url-m_ptr_scheme, url-m_len_scheme, buf_start, buf_length, buf_index_inout, buf_chars_to_skip_inout));
svn commit: r1197499 - in /trafficserver/traffic/trunk: CHANGES proxy/InkAPI.cc proxy/api/ts/ts.h.in
Author: niq Date: Fri Nov 4 10:55:04 2011 New Revision: 1197499 URL: http://svn.apache.org/viewvc?rev=1197499view=rev Log: TS-1008: Add API to access TCP connection from SSN. Modified: trafficserver/traffic/trunk/CHANGES trafficserver/traffic/trunk/proxy/InkAPI.cc trafficserver/traffic/trunk/proxy/api/ts/ts.h.in Modified: trafficserver/traffic/trunk/CHANGES URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/CHANGES?rev=1197499r1=1197498r2=1197499view=diff == --- trafficserver/traffic/trunk/CHANGES (original) +++ trafficserver/traffic/trunk/CHANGES Fri Nov 4 10:55:04 2011 @@ -130,6 +130,8 @@ Changes with Apache Traffic Server 3.1.1 *) [TS-930] Fixed TSNetConnect to use network order for port. + *) [TS-1008] Add API to get TCP connection from SSN. + Changes with Apache Traffic Server 3.1.0 *) Make sure --enable-purify works again Modified: trafficserver/traffic/trunk/proxy/InkAPI.cc URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/InkAPI.cc?rev=1197499r1=1197498r2=1197499view=diff == --- trafficserver/traffic/trunk/proxy/InkAPI.cc (original) +++ trafficserver/traffic/trunk/proxy/InkAPI.cc Fri Nov 4 10:55:04 2011 @@ -5143,11 +5143,8 @@ TSHttpTxnTransformRespGet(TSHttpTxn txnp } sockaddr const* -TSHttpTxnClientAddrGet(TSHttpTxn txnp) +TSHttpSsnClientAddrGet(TSHttpSsn ssnp) { - sdk_assert(sdk_sanity_check_txn(txnp) == TS_SUCCESS); - - TSHttpSsn ssnp = TSHttpTxnSsnGet(txnp); HttpClientSession *cs = reinterpret_castHttpClientSession *(ssnp); if (cs == NULL) return 0; @@ -5157,6 +5154,14 @@ TSHttpTxnClientAddrGet(TSHttpTxn txnp) return vc-get_remote_addr(); } +sockaddr const* +TSHttpTxnClientAddrGet(TSHttpTxn txnp) +{ + sdk_assert(sdk_sanity_check_txn(txnp) == TS_SUCCESS); + + TSHttpSsn ssnp = TSHttpTxnSsnGet(txnp); + return TSHttpSsnClientAddrGet(ssnp); +} unsigned int TSHttpTxnClientIPGet(TSHttpTxn txnp) @@ -5168,10 +5173,7 @@ TSHttpTxnClientIPGet(TSHttpTxn txnp) } sockaddr const* -TSHttpTxnIncomingAddrGet(TSHttpTxn txnp) { - sdk_assert(sdk_sanity_check_txn(txnp) == TS_SUCCESS); - - TSHttpSsn ssnp = TSHttpTxnSsnGet(txnp); +TSHttpSsnIncomingAddrGet(TSHttpSsn ssnp) { HttpClientSession *cs = reinterpret_castHttpClientSession *(ssnp); if (cs == NULL) return 0; @@ -5181,6 +5183,13 @@ TSHttpTxnIncomingAddrGet(TSHttpTxn txnp) return vc-get_local_addr(); } +sockaddr const* +TSHttpTxnIncomingAddrGet(TSHttpTxn txnp) { + sdk_assert(sdk_sanity_check_txn(txnp) == TS_SUCCESS); + + TSHttpSsn ssnp = TSHttpTxnSsnGet(txnp); + return TSHttpSsnIncomingAddrGet(ssnp); +} int TSHttpTxnClientIncomingPortGet(TSHttpTxn txnp) @@ -6768,12 +6777,10 @@ TSTextLogObjectRollingOffsetHrSet(TSText } TSReturnCode -TSHttpTxnClientFdGet(TSHttpTxn txnp, int *fdp) +TSHttpSsnClientFdGet(TSHttpSsn ssnp, int *fdp) { - sdk_assert(sdk_sanity_check_txn(txnp) == TS_SUCCESS); sdk_assert(sdk_sanity_check_null_ptr((void*)fdp) == TS_SUCCESS); - TSHttpSsn ssnp = TSHttpTxnSsnGet(txnp); HttpClientSession *cs = (HttpClientSession *) ssnp; if (cs == NULL) @@ -6786,6 +6793,15 @@ TSHttpTxnClientFdGet(TSHttpTxn txnp, int *fdp = vc-get_socket(); return TS_SUCCESS; } +TSReturnCode +TSHttpTxnClientFdGet(TSHttpTxn txnp, int *fdp) +{ + sdk_assert(sdk_sanity_check_txn(txnp) == TS_SUCCESS); + sdk_assert(sdk_sanity_check_null_ptr((void*)fdp) == TS_SUCCESS); + + TSHttpSsn ssnp = TSHttpTxnSsnGet(txnp); + return TSHttpSsnClientFdGet(ssnp, fdp); +} TSReturnCode TSHttpTxnClientRemotePortGet(TSHttpTxn txnp, int *portp) Modified: trafficserver/traffic/trunk/proxy/api/ts/ts.h.in URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/api/ts/ts.h.in?rev=1197499r1=1197498r2=1197499view=diff == --- trafficserver/traffic/trunk/proxy/api/ts/ts.h.in (original) +++ trafficserver/traffic/trunk/proxy/api/ts/ts.h.in Fri Nov 4 10:55:04 2011 @@ -2147,7 +2147,13 @@ extern C tsapi TSReturnCode TSHttpTxnClientFdGet(TSHttpTxn txnp, int* fdp); tsapi TSReturnCode TSHttpTxnOutgoingAddrSet(TSHttpTxn txnp, struct sockaddr const* addr); - + + /* TS-1008: the above TXN calls for the Client conn should work with SSN */ + tsapi struct sockaddr const* TSHttpSsnClientAddrGet(TSHttpSsn ssnp); + tsapi struct sockaddr const* TSHttpSsnIncomingAddrGet(TSHttpSsn ssnp); + tsapi TSReturnCode TSHttpSsnClientFdGet(TSHttpSsn ssnp, int* fdp); + /* TS-1008 END */ + /** @deprecated Use TSHttpTxnClientAddrGet */ tsapi TS_DEPRECATED unsigned int TSHttpTxnClientIPGet(TSHttpTxn txnp); /** @deprecated Use TSHttpTxnClientAddrGet */