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 2012/03/01 17:37:54 UTC
[2/5] git commit: Filter out stats_over_http
Filter out stats_over_http
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/8cfc3b71
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/8cfc3b71
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/8cfc3b71
Branch: refs/heads/master
Commit: 8cfc3b71a0c557b50464945768e7d832723bebe1
Parents: a23a8ed
Author: Leif Hedstrom <le...@ogre.com>
Authored: Thu Mar 1 09:34:57 2012 -0700
Committer: Leif Hedstrom <le...@ogre.com>
Committed: Thu Mar 1 09:34:57 2012 -0700
----------------------------------------------------------------------
.gitignore | 9 -
CHANGES | 5 -
LICENSE | 404 ------------------------
Makefile | 25 --
NOTICE | 5 -
README | 10 -
plugins/stats_over_http/README | 10 +
plugins/stats_over_http/stats_over_http.c | 290 +++++++++++++++++
stats_over_http.c | 290 -----------------
9 files changed, 300 insertions(+), 748 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/8cfc3b71/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index c1c0bc2..0000000
--- a/.gitignore
+++ /dev/null
@@ -1,9 +0,0 @@
-*.o
-*.a
-*.so
-*.in
-*~
-*.tar.gz
-*.lo
-*.la
-.deps
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/8cfc3b71/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
deleted file mode 100644
index 638d151..0000000
--- a/CHANGES
+++ /dev/null
@@ -1,5 +0,0 @@
- -*- coding: utf-8 -*-
-
-Changes with Apache Traffic Server header_filter 1.0
-
- *) This is a basic plugin for doing header_filtering.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/8cfc3b71/LICENSE
----------------------------------------------------------------------
diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index bed90de..0000000
--- a/LICENSE
+++ /dev/null
@@ -1,404 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed 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.
-
-~~~
-
-Copyright (C) 2009 Yahoo! Inc.
-
-Licensed 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
-
-~~~
-
-Mersenne Twister License
-
-Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- 3. The names of its contributors may not be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-Any feedback is very welcome.
-http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html
-email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space)
-
-~~~
-
-TK 8.3 License
-
-This software is copyrighted by the Regents of the University of
-California, Sun Microsystems, Inc., and other parties. The following
-terms apply to all files associated with the software unless explicitly
-disclaimed in individual files.
-
-The authors hereby grant permission to use, copy, modify, distribute,
-and license this software and its documentation for any purpose, provided
-that existing copyright notices are retained in all copies and that this
-notice is included verbatim in any distributions. No written agreement,
-license, or royalty fee is required for any of the authorized uses.
-Modifications to this software may be copyrighted by their authors
-and need not follow the licensing terms described here, provided that
-the new terms are clearly indicated on the first page of each file where
-they apply.
-
-IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY
-FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
-ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY
-DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-
-THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
-INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE
-IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
-NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
-MODIFICATIONS.
-
-GOVERNMENT USE: If you are acquiring this software on behalf of the
-U.S. government, the Government shall have only "Restricted Rights"
-in the software and related documentation as defined in the Federal
-Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you
-are acquiring the software on behalf of the Department of Defense, the
-software shall be classified as "Commercial Computer Software" and the
-Government shall have only "Restricted Rights" as defined in Clause
-252.227-7013 (c) (1) of DFARs. Notwithstanding the foregoing, the
-authors grant the U.S. Government and others acting in its behalf
-permission to use and distribute the software in accordance with the
-terms specified in this license.
-
-~~~
-
-BIND license
-
-Copyright (c) 1985, 1989, 1993
- The Regents of the University of California. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-3. Neither the name of the University nor the names of its contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
-
-
-Portions Copyright (c) 1993 by Digital Equipment Corporation.
-
-Permission to use, copy, modify, and distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies, and that
-the name of Digital Equipment Corporation not be used in advertising or
-publicity pertaining to distribution of the document or software without
-specific, written prior permission.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
-WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
-OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
-CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
-DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
-PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
-ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-
-
-Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
-Portions Copyright (c) 1996-1999 by Internet Software Consortium.
-
-Permission to use, copy, modify, and distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
-OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-~~~
-
-Copyright (C) 2007 Ariya Hidayat (ariya@kde.org)
-Copyright (C) 2006 Ariya Hidayat (ariya@kde.org)
-Copyright (C) 2005 Ariya Hidayat (ariya@kde.org)
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-
-
-For the strlcat, strlcpy in inktomi++/ink_string.cc:
-
-Copyright (c) 1998 Todd C. Miller <To...@courtesan.com>
-
-Permission to use, copy, modify, and distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/8cfc3b71/Makefile
----------------------------------------------------------------------
diff --git a/Makefile b/Makefile
deleted file mode 100644
index d970e1d..0000000
--- a/Makefile
+++ /dev/null
@@ -1,25 +0,0 @@
-# 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. The ASF 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.
-
-
-all: stats_over_http.c
- tsxs -v -c $? -o stats_over_http.so
-
-install:
- tsxs -i -o stats_over_http.so
-
-clean:
- rm -f *.lo *.so
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/8cfc3b71/NOTICE
----------------------------------------------------------------------
diff --git a/NOTICE b/NOTICE
deleted file mode 100644
index c19f064..0000000
--- a/NOTICE
+++ /dev/null
@@ -1,5 +0,0 @@
-Apache Traffic Server
-Copyright 2010 The Apache Software Foundation
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/8cfc3b71/README
----------------------------------------------------------------------
diff --git a/README b/README
deleted file mode 100644
index 03718af..0000000
--- a/README
+++ /dev/null
@@ -1,10 +0,0 @@
-Compile:
- tsxs -c stats_over_http.c -o stats_over_http.so
-Install:
- sudo tsxs -o stats_over_http.so -i
-
-Add to the plugin.conf:
-
- stats_over_http.so
-
-start traffic server and visit http://IP:port/_stats
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/8cfc3b71/plugins/stats_over_http/README
----------------------------------------------------------------------
diff --git a/plugins/stats_over_http/README b/plugins/stats_over_http/README
new file mode 100644
index 0000000..03718af
--- /dev/null
+++ b/plugins/stats_over_http/README
@@ -0,0 +1,10 @@
+Compile:
+ tsxs -c stats_over_http.c -o stats_over_http.so
+Install:
+ sudo tsxs -o stats_over_http.so -i
+
+Add to the plugin.conf:
+
+ stats_over_http.so
+
+start traffic server and visit http://IP:port/_stats
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/8cfc3b71/plugins/stats_over_http/stats_over_http.c
----------------------------------------------------------------------
diff --git a/plugins/stats_over_http/stats_over_http.c b/plugins/stats_over_http/stats_over_http.c
new file mode 100644
index 0000000..f6c3f14
--- /dev/null
+++ b/plugins/stats_over_http/stats_over_http.c
@@ -0,0 +1,290 @@
+/** @file
+
+ A brief file description
+
+ @section license License
+
+ 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. The ASF 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.
+ */
+
+/* stats.c: expose traffic server stats over http
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <limits.h>
+#include <ts/ts.h>
+#include <string.h>
+
+#include <inttypes.h>
+
+typedef struct stats_state_t
+{
+ TSVConn net_vc;
+ TSVIO read_vio;
+ TSVIO write_vio;
+
+ TSIOBuffer req_buffer;
+ TSIOBuffer resp_buffer;
+ TSIOBufferReader resp_reader;
+
+ int output_bytes;
+ int body_written;
+} stats_state;
+
+static void
+stats_cleanup(TSCont contp, stats_state * my_state)
+{
+ if (my_state->req_buffer) {
+ TSIOBufferDestroy(my_state->req_buffer);
+ my_state->req_buffer = NULL;
+ }
+
+ if (my_state->resp_buffer) {
+ TSIOBufferDestroy(my_state->resp_buffer);
+ my_state->resp_buffer = NULL;
+ }
+ TSVConnClose(my_state->net_vc);
+ TSfree(my_state);
+ TSContDestroy(contp);
+}
+
+static void
+stats_process_accept(TSCont contp, stats_state * my_state)
+{
+
+ my_state->req_buffer = TSIOBufferCreate();
+ my_state->resp_buffer = TSIOBufferCreate();
+ my_state->resp_reader = TSIOBufferReaderAlloc(my_state->resp_buffer);
+ my_state->read_vio = TSVConnRead(my_state->net_vc, contp, my_state->req_buffer, INT64_MAX);
+}
+
+static int
+stats_add_data_to_resp_buffer(const char *s, stats_state * my_state)
+{
+ int s_len = strlen(s);
+
+ TSIOBufferWrite(my_state->resp_buffer, s, s_len);
+
+ return s_len;
+}
+
+static int
+stats_add_resp_header(stats_state * my_state)
+{
+ char resp[] = "HTTP/1.0 200 Ok\r\n"
+ "Content-Type: text/javascript\r\nCache-Control: no-cache\r\n\r\n";
+ return stats_add_data_to_resp_buffer(resp, my_state);
+}
+
+static void
+stats_process_read(TSCont contp, TSEvent event, stats_state * my_state)
+{
+ TSDebug("istats", "stats_process_read(%d)", event);
+ if (event == TS_EVENT_VCONN_READ_READY) {
+ my_state->output_bytes = stats_add_resp_header(my_state);
+ TSVConnShutdown(my_state->net_vc, 1, 0);
+ my_state->write_vio = TSVConnWrite(my_state->net_vc, contp, my_state->resp_reader, INT_MAX);
+ } else if (event == TS_EVENT_ERROR) {
+ TSError("stats_process_read: Received TS_EVENT_ERROR\n");
+ } else if (event == TS_EVENT_VCONN_EOS) {
+ /* client may end the connection, simply return */
+ return;
+ } else if (event == TS_EVENT_NET_ACCEPT_FAILED) {
+ TSError("stats_process_read: Received TS_EVENT_NET_ACCEPT_FAILED\n");
+ } else {
+ printf("Unexpected Event %d\n", event);
+ TSReleaseAssert(!"Unexpected Event");
+ }
+}
+
+#define APPEND(a) my_state->output_bytes += stats_add_data_to_resp_buffer(a, my_state)
+#define APPEND_STAT(a, fmt, v) do { \
+ char b[256]; \
+ if(snprintf(b, sizeof(b), "\"%s\": \"" fmt "\",\n", a, v) < sizeof(b)) \
+ APPEND(b); \
+} while(0)
+
+static void
+json_out_stat(TSRecordType rec_type, void *edata, int registered,
+ const char *name, TSRecordDataType data_type,
+ TSRecordData *datum) {
+ stats_state *my_state = edata;
+
+ switch(data_type) {
+ case TS_RECORDDATATYPE_COUNTER:
+ APPEND_STAT(name, "%" PRIu64, datum->rec_counter); break;
+ case TS_RECORDDATATYPE_INT:
+ APPEND_STAT(name, "%" PRIu64, datum->rec_int); break;
+ case TS_RECORDDATATYPE_FLOAT:
+ APPEND_STAT(name, "%f", datum->rec_float); break;
+ case TS_RECORDDATATYPE_STRING:
+ APPEND_STAT(name, "%s", datum->rec_string); break;
+ default:
+ TSDebug("istats", "unkown type for %s: %d", name, data_type);
+ break;
+ }
+}
+static void
+json_out_stats(stats_state * my_state)
+{
+ const char *version;
+ APPEND("{ \"global\": {\n");
+
+ TSRecordDump(TS_RECORDTYPE_PROCESS, json_out_stat, my_state);
+ version = TSTrafficServerVersionGet();
+ APPEND("\"server\": \"");
+ APPEND(version);
+ APPEND("\"\n");
+ APPEND(" }\n}\n");
+}
+
+static void
+stats_process_write(TSCont contp, TSEvent event, stats_state * my_state)
+{
+ if (event == TS_EVENT_VCONN_WRITE_READY) {
+ if (my_state->body_written == 0) {
+ TSDebug("istats", "plugin adding response body");
+ my_state->body_written = 1;
+ json_out_stats(my_state);
+ TSVIONBytesSet(my_state->write_vio, my_state->output_bytes);
+ }
+ TSVIOReenable(my_state->write_vio);
+ } else if (TS_EVENT_VCONN_WRITE_COMPLETE) {
+ stats_cleanup(contp, my_state);
+ } else if (event == TS_EVENT_ERROR) {
+ TSError("stats_process_write: Received TS_EVENT_ERROR\n");
+ } else {
+ TSReleaseAssert(!"Unexpected Event");
+ }
+}
+
+static int
+stats_dostuff(TSCont contp, TSEvent event, void *edata)
+{
+ stats_state *my_state = TSContDataGet(contp);
+ if (event == TS_EVENT_NET_ACCEPT) {
+ my_state->net_vc = (TSVConn) edata;
+ stats_process_accept(contp, my_state);
+ } else if (edata == my_state->read_vio) {
+ stats_process_read(contp, event, my_state);
+ } else if (edata == my_state->write_vio) {
+ stats_process_write(contp, event, my_state);
+ } else {
+ TSReleaseAssert(!"Unexpected Event");
+ }
+ return 0;
+}
+static int
+stats_origin(TSCont contp, TSEvent event, void *edata)
+{
+ TSCont icontp;
+ stats_state *my_state;
+ TSHttpTxn txnp = (TSHttpTxn) edata;
+ TSMBuffer reqp;
+ TSMLoc hdr_loc = NULL, url_loc = NULL;
+ TSEvent reenable = TS_EVENT_HTTP_CONTINUE;
+
+ TSDebug("istats", "in the read stuff");
+
+ if (TSHttpTxnClientReqGet(txnp, &reqp, &hdr_loc) != TS_SUCCESS)
+ goto cleanup;
+
+ if (TSHttpHdrUrlGet(reqp, hdr_loc, &url_loc) != TS_SUCCESS)
+ goto cleanup;
+
+ int path_len = 0;
+ const char* path = TSUrlPathGet(reqp,url_loc,&path_len);
+ TSDebug("istats","Path: %.*s",path_len,path);
+
+ if (! (path_len != 0 && path_len == 6 && !memcmp(path,"_stats",6)) ) {
+ goto notforme;
+ }
+
+ TSSkipRemappingSet(txnp,1); //not strictly necessary, but speed is everything these days
+
+ /* This is us -- register our intercept */
+ TSDebug("istats", "Intercepting request");
+
+ icontp = TSContCreate(stats_dostuff, TSMutexCreate());
+ my_state = (stats_state *) TSmalloc(sizeof(*my_state));
+ memset(my_state, 0, sizeof(*my_state));
+ TSContDataSet(icontp, my_state);
+ TSHttpTxnIntercept(icontp, txnp);
+ goto cleanup;
+
+ notforme:
+
+ cleanup:
+#if (TS_VERSION_NUMBER < 2001005)
+ if(path) TSHandleStringRelease(reqp, url_loc, path);
+#endif
+ if(url_loc) TSHandleMLocRelease(reqp, hdr_loc, url_loc);
+ if(hdr_loc) TSHandleMLocRelease(reqp, TS_NULL_MLOC, hdr_loc);
+
+ TSHttpTxnReenable(txnp, reenable);
+ return 0;
+}
+
+int
+check_ts_version()
+{
+
+ const char *ts_version = TSTrafficServerVersionGet();
+ int result = 0;
+
+ if (ts_version) {
+ int major_ts_version = 0;
+ int minor_ts_version = 0;
+ int patch_ts_version = 0;
+
+ if (sscanf(ts_version, "%d.%d.%d", &major_ts_version, &minor_ts_version, &patch_ts_version) != 3) {
+ return 0;
+ }
+
+ /* Need at least TS 2.0 */
+ if (major_ts_version >= 2) {
+ result = 1;
+ }
+ }
+
+ return result;
+}
+
+void
+TSPluginInit(int argc, const char *argv[])
+{
+ TSPluginRegistrationInfo info;
+
+ info.plugin_name = "stats";
+ info.vendor_name = "Apache Software Foundation";
+ info.support_email = "jesus@omniti.com";
+
+ if (TSPluginRegister(TS_SDK_VERSION_2_0, &info) != TS_SUCCESS)
+ TSError("Plugin registration failed. \n");
+
+ if (!check_ts_version()) {
+ TSError("Plugin requires Traffic Server 2.0 or later\n");
+ return;
+ }
+
+ /* Create a continuation with a mutex as there is a shared global structure
+ containing the headers to add */
+ TSHttpHookAdd(TS_HTTP_READ_REQUEST_HDR_HOOK, TSContCreate(stats_origin, NULL));
+ TSDebug("istats", "stats module registered");
+}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/8cfc3b71/stats_over_http.c
----------------------------------------------------------------------
diff --git a/stats_over_http.c b/stats_over_http.c
deleted file mode 100644
index f6c3f14..0000000
--- a/stats_over_http.c
+++ /dev/null
@@ -1,290 +0,0 @@
-/** @file
-
- A brief file description
-
- @section license License
-
- 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. The ASF 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.
- */
-
-/* stats.c: expose traffic server stats over http
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <limits.h>
-#include <ts/ts.h>
-#include <string.h>
-
-#include <inttypes.h>
-
-typedef struct stats_state_t
-{
- TSVConn net_vc;
- TSVIO read_vio;
- TSVIO write_vio;
-
- TSIOBuffer req_buffer;
- TSIOBuffer resp_buffer;
- TSIOBufferReader resp_reader;
-
- int output_bytes;
- int body_written;
-} stats_state;
-
-static void
-stats_cleanup(TSCont contp, stats_state * my_state)
-{
- if (my_state->req_buffer) {
- TSIOBufferDestroy(my_state->req_buffer);
- my_state->req_buffer = NULL;
- }
-
- if (my_state->resp_buffer) {
- TSIOBufferDestroy(my_state->resp_buffer);
- my_state->resp_buffer = NULL;
- }
- TSVConnClose(my_state->net_vc);
- TSfree(my_state);
- TSContDestroy(contp);
-}
-
-static void
-stats_process_accept(TSCont contp, stats_state * my_state)
-{
-
- my_state->req_buffer = TSIOBufferCreate();
- my_state->resp_buffer = TSIOBufferCreate();
- my_state->resp_reader = TSIOBufferReaderAlloc(my_state->resp_buffer);
- my_state->read_vio = TSVConnRead(my_state->net_vc, contp, my_state->req_buffer, INT64_MAX);
-}
-
-static int
-stats_add_data_to_resp_buffer(const char *s, stats_state * my_state)
-{
- int s_len = strlen(s);
-
- TSIOBufferWrite(my_state->resp_buffer, s, s_len);
-
- return s_len;
-}
-
-static int
-stats_add_resp_header(stats_state * my_state)
-{
- char resp[] = "HTTP/1.0 200 Ok\r\n"
- "Content-Type: text/javascript\r\nCache-Control: no-cache\r\n\r\n";
- return stats_add_data_to_resp_buffer(resp, my_state);
-}
-
-static void
-stats_process_read(TSCont contp, TSEvent event, stats_state * my_state)
-{
- TSDebug("istats", "stats_process_read(%d)", event);
- if (event == TS_EVENT_VCONN_READ_READY) {
- my_state->output_bytes = stats_add_resp_header(my_state);
- TSVConnShutdown(my_state->net_vc, 1, 0);
- my_state->write_vio = TSVConnWrite(my_state->net_vc, contp, my_state->resp_reader, INT_MAX);
- } else if (event == TS_EVENT_ERROR) {
- TSError("stats_process_read: Received TS_EVENT_ERROR\n");
- } else if (event == TS_EVENT_VCONN_EOS) {
- /* client may end the connection, simply return */
- return;
- } else if (event == TS_EVENT_NET_ACCEPT_FAILED) {
- TSError("stats_process_read: Received TS_EVENT_NET_ACCEPT_FAILED\n");
- } else {
- printf("Unexpected Event %d\n", event);
- TSReleaseAssert(!"Unexpected Event");
- }
-}
-
-#define APPEND(a) my_state->output_bytes += stats_add_data_to_resp_buffer(a, my_state)
-#define APPEND_STAT(a, fmt, v) do { \
- char b[256]; \
- if(snprintf(b, sizeof(b), "\"%s\": \"" fmt "\",\n", a, v) < sizeof(b)) \
- APPEND(b); \
-} while(0)
-
-static void
-json_out_stat(TSRecordType rec_type, void *edata, int registered,
- const char *name, TSRecordDataType data_type,
- TSRecordData *datum) {
- stats_state *my_state = edata;
-
- switch(data_type) {
- case TS_RECORDDATATYPE_COUNTER:
- APPEND_STAT(name, "%" PRIu64, datum->rec_counter); break;
- case TS_RECORDDATATYPE_INT:
- APPEND_STAT(name, "%" PRIu64, datum->rec_int); break;
- case TS_RECORDDATATYPE_FLOAT:
- APPEND_STAT(name, "%f", datum->rec_float); break;
- case TS_RECORDDATATYPE_STRING:
- APPEND_STAT(name, "%s", datum->rec_string); break;
- default:
- TSDebug("istats", "unkown type for %s: %d", name, data_type);
- break;
- }
-}
-static void
-json_out_stats(stats_state * my_state)
-{
- const char *version;
- APPEND("{ \"global\": {\n");
-
- TSRecordDump(TS_RECORDTYPE_PROCESS, json_out_stat, my_state);
- version = TSTrafficServerVersionGet();
- APPEND("\"server\": \"");
- APPEND(version);
- APPEND("\"\n");
- APPEND(" }\n}\n");
-}
-
-static void
-stats_process_write(TSCont contp, TSEvent event, stats_state * my_state)
-{
- if (event == TS_EVENT_VCONN_WRITE_READY) {
- if (my_state->body_written == 0) {
- TSDebug("istats", "plugin adding response body");
- my_state->body_written = 1;
- json_out_stats(my_state);
- TSVIONBytesSet(my_state->write_vio, my_state->output_bytes);
- }
- TSVIOReenable(my_state->write_vio);
- } else if (TS_EVENT_VCONN_WRITE_COMPLETE) {
- stats_cleanup(contp, my_state);
- } else if (event == TS_EVENT_ERROR) {
- TSError("stats_process_write: Received TS_EVENT_ERROR\n");
- } else {
- TSReleaseAssert(!"Unexpected Event");
- }
-}
-
-static int
-stats_dostuff(TSCont contp, TSEvent event, void *edata)
-{
- stats_state *my_state = TSContDataGet(contp);
- if (event == TS_EVENT_NET_ACCEPT) {
- my_state->net_vc = (TSVConn) edata;
- stats_process_accept(contp, my_state);
- } else if (edata == my_state->read_vio) {
- stats_process_read(contp, event, my_state);
- } else if (edata == my_state->write_vio) {
- stats_process_write(contp, event, my_state);
- } else {
- TSReleaseAssert(!"Unexpected Event");
- }
- return 0;
-}
-static int
-stats_origin(TSCont contp, TSEvent event, void *edata)
-{
- TSCont icontp;
- stats_state *my_state;
- TSHttpTxn txnp = (TSHttpTxn) edata;
- TSMBuffer reqp;
- TSMLoc hdr_loc = NULL, url_loc = NULL;
- TSEvent reenable = TS_EVENT_HTTP_CONTINUE;
-
- TSDebug("istats", "in the read stuff");
-
- if (TSHttpTxnClientReqGet(txnp, &reqp, &hdr_loc) != TS_SUCCESS)
- goto cleanup;
-
- if (TSHttpHdrUrlGet(reqp, hdr_loc, &url_loc) != TS_SUCCESS)
- goto cleanup;
-
- int path_len = 0;
- const char* path = TSUrlPathGet(reqp,url_loc,&path_len);
- TSDebug("istats","Path: %.*s",path_len,path);
-
- if (! (path_len != 0 && path_len == 6 && !memcmp(path,"_stats",6)) ) {
- goto notforme;
- }
-
- TSSkipRemappingSet(txnp,1); //not strictly necessary, but speed is everything these days
-
- /* This is us -- register our intercept */
- TSDebug("istats", "Intercepting request");
-
- icontp = TSContCreate(stats_dostuff, TSMutexCreate());
- my_state = (stats_state *) TSmalloc(sizeof(*my_state));
- memset(my_state, 0, sizeof(*my_state));
- TSContDataSet(icontp, my_state);
- TSHttpTxnIntercept(icontp, txnp);
- goto cleanup;
-
- notforme:
-
- cleanup:
-#if (TS_VERSION_NUMBER < 2001005)
- if(path) TSHandleStringRelease(reqp, url_loc, path);
-#endif
- if(url_loc) TSHandleMLocRelease(reqp, hdr_loc, url_loc);
- if(hdr_loc) TSHandleMLocRelease(reqp, TS_NULL_MLOC, hdr_loc);
-
- TSHttpTxnReenable(txnp, reenable);
- return 0;
-}
-
-int
-check_ts_version()
-{
-
- const char *ts_version = TSTrafficServerVersionGet();
- int result = 0;
-
- if (ts_version) {
- int major_ts_version = 0;
- int minor_ts_version = 0;
- int patch_ts_version = 0;
-
- if (sscanf(ts_version, "%d.%d.%d", &major_ts_version, &minor_ts_version, &patch_ts_version) != 3) {
- return 0;
- }
-
- /* Need at least TS 2.0 */
- if (major_ts_version >= 2) {
- result = 1;
- }
- }
-
- return result;
-}
-
-void
-TSPluginInit(int argc, const char *argv[])
-{
- TSPluginRegistrationInfo info;
-
- info.plugin_name = "stats";
- info.vendor_name = "Apache Software Foundation";
- info.support_email = "jesus@omniti.com";
-
- if (TSPluginRegister(TS_SDK_VERSION_2_0, &info) != TS_SUCCESS)
- TSError("Plugin registration failed. \n");
-
- if (!check_ts_version()) {
- TSError("Plugin requires Traffic Server 2.0 or later\n");
- return;
- }
-
- /* Create a continuation with a mutex as there is a shared global structure
- containing the headers to add */
- TSHttpHookAdd(TS_HTTP_READ_REQUEST_HDR_HOOK, TSContCreate(stats_origin, NULL));
- TSDebug("istats", "stats module registered");
-}