trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zw...@apache.org
Subject [3/6] git commit: Filter out header_filter
Date Thu, 01 Mar 2012 16:19:43 GMT
Filter out header_filter


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/19921914
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/19921914
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/19921914

Branch: refs/heads/master
Commit: 199219146227957b5d8101440c32c755c2a2e727
Parents: b4384dc
Author: Leif Hedstrom <leif@ogre.com>
Authored: Thu Mar 1 09:14:54 2012 -0700
Committer: Leif Hedstrom <leif@ogre.com>
Committed: Thu Mar 1 09:14:54 2012 -0700

----------------------------------------------------------------------
 CHANGES                                |   11 -
 LICENSE                                |  404 ---------------------------
 Makefile                               |   26 --
 NOTICE                                 |    5 -
 README                                 |   95 -------
 STATUS                                 |   21 --
 example.conf                           |   21 --
 header_filter.cc                       |  213 --------------
 lulu.h                                 |  108 -------
 plugins/header_filter/README           |   95 +++++++
 plugins/header_filter/example.conf     |   21 ++
 plugins/header_filter/header_filter.cc |  213 ++++++++++++++
 plugins/header_filter/lulu.h           |  108 +++++++
 plugins/header_filter/rules.cc         |  331 ++++++++++++++++++++++
 plugins/header_filter/rules.h          |  168 +++++++++++
 rules.cc                               |  331 ----------------------
 rules.h                                |  168 -----------
 17 files changed, 936 insertions(+), 1403 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/19921914/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
deleted file mode 100644
index 511f257..0000000
--- a/CHANGES
+++ /dev/null
@@ -1,11 +0,0 @@
-                                                         -*- coding: utf-8 -*-
-
-Changes with Apache Traffic Server header_filter 1.0
-
-  *) Added support for the "add" and "set" operators, e.g.
-
-        [SEND_REQUEST_HDR]
-            Host =www.ogre.com=
-            X-Append-Header +Added by ATS+
-
-  *) This is a basic plugin for doing header_filtering.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/19921914/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 <Todd.Miller@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/19921914/Makefile
----------------------------------------------------------------------
diff --git a/Makefile b/Makefile
deleted file mode 100644
index 7cb1a3b..0000000
--- a/Makefile
+++ /dev/null
@@ -1,26 +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.
-
-TSXS?=tsxs
-
-all:	header_filter.cc rules.cc
-	$(TSXS) -v -C $? -o header_filter.so
-
-install:
-	$(TSXS) -i -o header_filter.so
-
-clean:
-	rm -f *.lo *.so

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/19921914/NOTICE
----------------------------------------------------------------------
diff --git a/NOTICE b/NOTICE
deleted file mode 100644
index 5282dde..0000000
--- a/NOTICE
+++ /dev/null
@@ -1,5 +0,0 @@
-Apache Traffic Server
-Copyright 2011 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/19921914/README
----------------------------------------------------------------------
diff --git a/README b/README
deleted file mode 100644
index f10a9ac..0000000
--- a/README
+++ /dev/null
@@ -1,95 +0,0 @@
-Apache Traffic Server Header Filter plugin
-==========================================
-
-This is a simple plugin for filtering out headers from requests (or
-responses). Typical configuration is done either with a global
-configuration, in .../etc/trafficserver/plugin.config:
-
-    header_filter.so /usr/local/etc/hdr_filters.conf
-
-
-Or, alternatively, in a per-remap rule configuration 
-
-    map http://a.com/ http://b.com @plugin=header_filter.so @pparam=hdr_filters.conf
-
-
-Even if you don't have a global configuration, if your remap rules
-schedules actions in hooks other than during remap, you must also add the
-header_filter.so to the plugin.config (see above), but without args:
-
-    header_filter.so
-
-
-The configuration files looks like
-
-[READ_REQUEST_HDR]
-	X-From-Someone
-	Cookie
-
-[READ_RESPONSE_HDR]
-	X-From-Server
-	Set-Cookie
-
-[SEND_RESPONSE_HDR]
-	X-Fie "Test"    # Match the entire string
-	X-Foo /Test/    # Match the (Perl) regex
-	X-Bar [Test*    # Match the prefix string
-	X-Fum *Test]    # Match the postfix string
-
-
-Comments are prefixed with #, and in most cases, the regular expression
-matching is the best choice (very little overhead). The pattern matches
-can also take an option '!' to reverse the test. The default action is
-to delete all headers that do (not) match the pattern. E.g.
-
-[SEND_REQUEST_HDR]
-	X-Fie   /test/
-	X-Foo ! /test/i
-
-
-The final "i" qualifier (works on all pattern matches) forces the match or
-comparison to be made case insensitive (just like in Perl).
-
-
-It's also possible to replace or add headers, using the = and +
-operators. For example
-
-[SEND_REQUEST_HDR]
-	Host =www.example.com=
-	X-Foo +ATS+
-
-
-This will force the Host: header to have exactly one value,
-www.example.com, while X-Foo will have at least one header with the value
-ATS, but there could be more instances of the header from the existing
-header in the request.
-
-
-Possible hooks are
-
-	 READ_REQUEST_HDR
-	 SEND_REQUEST_HDR
-	 READ_RESPONSE_HDR
-	 SEND_RESPONSE_HDR
-
-
-If not specified, the default hook to add the rules (headers to filter) is
-READ_REQUEST_HDR. It's completely acceptable (and useful) to configure a
-remap rule to delete headers in a later hook (e.g. when reading a response
-from the server). This is what actually makes the plugin even remotely
-useful.
-
-
-
-BUILDING
-========
-
-A simple
-
-    % make
-    % make install
-
-
-should do it, assuming that you have the tsxs script in your search
-path. This script is installed with your installation of Apache Traffic
-Server.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/19921914/STATUS
----------------------------------------------------------------------
diff --git a/STATUS b/STATUS
deleted file mode 100644
index e6f3c71..0000000
--- a/STATUS
+++ /dev/null
@@ -1,21 +0,0 @@
-Traffic Server Header Filter 1.0 STATUS:                                              -*-text-*-
-Last modified at [$Date: 2010-09-23 10:18:00 -0600 (Thu, 23 Sep 2010) $]
-
-The current version of this file can be found at:
-
-  * https://svn.apache.org/repos/asf/trafficserver/plugins/header_filter/STATUS
-
-
-Release history:
-    1.0.0     : Released June 27th, 2011
-
-
-Contributors looking for a mission:
-
-  * Just do an egrep on "TODO" or "XXX" in the source.
-
-  * Review the bug database at: https://issues.apache.org/jira/browse/TS
-
-      - Download, test and review patches attached to open bugs
-
-  * Open bugs in the bug database.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/19921914/example.conf
----------------------------------------------------------------------
diff --git a/example.conf b/example.conf
deleted file mode 100644
index 8914b9e..0000000
--- a/example.conf
+++ /dev/null
@@ -1,21 +0,0 @@
-#
-# This following will:
-#    - nuke the cookie headers (all of them)
-#    - Replace the Host: header with www.ogre.com
-#    - Add a header X-Append-Header: Added by ATS
-#
-[READ_RESPONSE_HDR]
-  Set-Cookie
-  Expires
-  Vary /user-agent/i
-  X-Foo ! "test"
-
-
-#
-# There can only ever be one Host: header (the plugin assures that since we use the set-operator)
-# but there can be more than one X-Append-Header (since we use the add-operator).
-#
-[SEND_REQUEST_HDR]
-	Cookie
-	Host =www.ogre.com=
-	X-Append-Header +Added by ATS+

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/19921914/header_filter.cc
----------------------------------------------------------------------
diff --git a/header_filter.cc b/header_filter.cc
deleted file mode 100644
index 48425d1..0000000
--- a/header_filter.cc
+++ /dev/null
@@ -1,213 +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.
-*/
-
-
-//////////////////////////////////////////////////////////////////////////////////////////////
-// 
-// Main entry points for the plugin hooks etc.
-//
-#include <ts/ts.h>
-#include <ts/remap.h>
-#include <stdio.h>
-
-#include "rules.h"
-
-using namespace ::HeaderFilter;
-
-// Global plugin rules
-Rules global;
-int arg_idx;
-
-// TODO: Maybe we should use wrappers for TSmalloc() for pcre_malloc (and _free),
-// but since we only compile at config time, it's really not that important.
-
-
-///////////////////////////////////////////////////////////////////////////////
-// Continuation
-//
-static int
-cont_header_filter(TSCont contp, TSEvent event, void *edata)
-{
-  TSHttpTxn txnp = (TSHttpTxn) edata;
-  TSHttpHookID hook = TS_HTTP_LAST_HOOK;
-  TSMBuffer reqp;
-  TSMLoc hdr_loc;
-
-  // Get the resources necessary to process this event
-  switch (event) {
-  case TS_EVENT_HTTP_READ_REQUEST_HDR:
-    if (TS_SUCCESS == TSHttpTxnClientReqGet(txnp, &reqp, &hdr_loc))
-      hook = TS_HTTP_READ_REQUEST_HDR_HOOK;
-    break;
-  case TS_EVENT_HTTP_SEND_REQUEST_HDR:
-    if (TS_SUCCESS == TSHttpTxnServerReqGet(txnp, &reqp, &hdr_loc))
-      hook = TS_HTTP_SEND_REQUEST_HDR_HOOK;
-    break;
-  case TS_EVENT_HTTP_READ_RESPONSE_HDR:
-    if (TS_SUCCESS == TSHttpTxnServerRespGet(txnp, &reqp, &hdr_loc))
-      hook = TS_HTTP_READ_RESPONSE_HDR_HOOK;
-    break;
-  case TS_EVENT_HTTP_SEND_RESPONSE_HDR:
-    if (TS_SUCCESS == TSHttpTxnClientRespGet(txnp, &reqp, &hdr_loc))
-      hook = TS_HTTP_SEND_RESPONSE_HDR_HOOK;
-    break;
-  default:
-    TSError("header_filter: unknown event for this plugin");
-    TSDebug(PLUGIN_NAME, "unknown event for this plugin");
-    break;
-  }
-
-  if (hook != TS_HTTP_LAST_HOOK) {
-    Rules* from_remap;
-
-    global.execute(reqp, hdr_loc, hook);
-
-    if (TS_HTTP_READ_REQUEST_HDR_HOOK != hook) { // Don't run the hook handled by remap plugin
-      if ((from_remap = (Rules*)TSHttpTxnArgGet(txnp, arg_idx))) {
-        from_remap->execute(reqp, hdr_loc, hook);
-      }
-    }
-    TSHandleMLocRelease(reqp, TS_NULL_MLOC, hdr_loc);
-  }
-
-  TSHttpTxnReenable(txnp, TS_EVENT_HTTP_CONTINUE);
-  return 0;
-}
-
-
-///////////////////////////////////////////////////////////////////////////////
-// Initialize the InkAPI plugin for the global hooks we support.
-//
-void
-TSPluginInit(int argc, const char *argv[])
-{
-  TSPluginRegistrationInfo info;
-
-  info.plugin_name = const_cast<char*>(PLUGIN_NAME);
-  info.vendor_name = const_cast<char*>("Apache");
-  info.support_email = const_cast<char*>("users@trafficserver.apache.org");
-
-  if (!TSPluginRegister(TS_SDK_VERSION_3_0 , &info)) {
-    TSError("header_filter: plugin registration failed.\n"); 
-  }
-
-  // Parse the rules file
-  if ((argc > 1)) {
-    if (!global.parse_file(argv[1]))
-      TSError("header_filter: failed to parse configuration file");
-  }
-
-  TSCont cont = TSContCreate(cont_header_filter, NULL);
-
-  for (int i=TS_HTTP_READ_REQUEST_HDR_HOOK; i < TS_HTTP_LAST_HOOK; ++i) {
-    if (global.supported_hook(static_cast<TSHttpHookID>(i))) {
-      TSDebug(PLUGIN_NAME, "Registering hook %d", i);
-      TSHttpHookAdd(static_cast<TSHttpHookID>(i), cont);
-    }
-  }
-  if (TSHttpArgIndexReserve(PLUGIN_NAME, "Filter out headers in various hooks", &arg_idx) != TS_SUCCESS) {
-    TSError("header_filter: failed to reserve private data slot");
-  }
-}
-
-
-///////////////////////////////////////////////////////////////////////////////
-// Initialize the plugin as a remap plugin.
-//
-TSReturnCode
-TSRemapInit(TSRemapInterface* api_info, char *errbuf, int errbuf_size)
-{
-  if (!api_info) {
-    strncpy(errbuf, "[tsremap_init] - Invalid TSRemapInterface argument", errbuf_size - 1);
-    return TS_ERROR;
-  }
-
-  if (api_info->size < sizeof(TSRemapInterface)) {
-    strncpy(errbuf, "[tsremap_init] - Incorrect size of TSRemapInterface structure", errbuf_size - 1);
-    return TS_ERROR;
-  }
-
-  if (api_info->tsremap_version < TSREMAP_VERSION) {
-    snprintf(errbuf, errbuf_size - 1, "[tsremap_init] - Incorrect API version %ld.%ld",
-             api_info->tsremap_version >> 16, (api_info->tsremap_version & 0xffff));
-    return TS_ERROR;
-  }
-
-  TSDebug(PLUGIN_NAME, "remap plugin is succesfully initialized");
-  return TS_SUCCESS;                     /* success */
-}
-
-
-TSReturnCode
-TSRemapNewInstance(int argc, char* argv[], void** ih, char* errbuf, int errbuf_size)
-{
-  if (argc < 3) {
-    TSError("Unable to create remap instance, need rules file");
-    return TS_ERROR;
-  } else {
-    Rules* conf = new(Rules);
-
-    conf->parse_file(argv[2]);
-    *ih = static_cast<void*>(conf);
-  }
-
-  return TS_SUCCESS;
-}
-
-void
-TSRemapDeleteInstance(void* ih)
-{
-  Rules* conf = static_cast<Rules*>(ih);
-
-  delete conf;
-}
-
-
-///////////////////////////////////////////////////////////////////////////////
-// Main entry point when used as a remap plugin.
-//
-TSRemapStatus
-TSRemapDoRemap(void* ih, TSHttpTxn rh, TSRemapRequestInfo *rri)
-{
-  if (NULL == ih) {
-    TSDebug(PLUGIN_NAME, "No Rules configured, falling back to default mapping rule");
-  } else {
-    Rules* confp = static_cast<Rules*>(ih);
-
-    TSHttpTxnArgSet(rh, arg_idx, static_cast<void*>(ih)); // Save for later hooks
-    confp->execute(rri->requestBufp, rri->requestHdrp, TS_HTTP_READ_REQUEST_HDR_HOOK);
-  }
-
-  return TSREMAP_NO_REMAP;
-}
-
-
-/*
-  local variables:
-  mode: C++
-  indent-tabs-mode: nil
-  c-basic-offset: 2
-  c-comment-only-line-offset: 0
-  c-file-offsets: ((statement-block-intro . +)
-  (label . 0)
-  (statement-cont . +)
-  (innamespace . 0))
-  end:
-
-  Indent with: /usr/bin/indent -ncs -nut -npcs -l 120 logstats.cc
-*/

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/19921914/lulu.h
----------------------------------------------------------------------
diff --git a/lulu.h b/lulu.h
deleted file mode 100644
index 47b08d0..0000000
--- a/lulu.h
+++ /dev/null
@@ -1,108 +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.
-*/
-
-
-//////////////////////////////////////////////////////////////////////////////////////////////
-// 
-// Implement the classes for the various types of hash keys we support.
-//
-#ifndef __LULU_H__
-#define __LULU_H__ 1
-
-// Define UNUSED properly.
-#if ((__GNUC__ >= 3) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 7)))
-#define UNUSED __attribute__ ((unused))
-#else
-#define UNUSED
-#endif /* #if ((__GNUC__ >= 3) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 7))) */
-
-#include <sys/types.h>
-
-// Memory barriers on i386 / linux / gcc
-#if defined(__i386__)
-#define mb()  __asm__ __volatile__ ( "lock; addl $0,0(%%esp)" : : : "memory" )
-#define rmb() __asm__ __volatile__ ( "lock; addl $0,0(%%esp)" : : : "memory" )
-#define wmb() __asm__ __volatile__ ( "" : : : "memory")
-#elif defined(__x86_64__)
-#define mb()  __asm__ __volatile__ ( "mfence" : : : "memory")
-#define rmb() __asm__ __volatile__ ( "lfence" : : : "memory")
-#define wmb() __asm__ __volatile__ ( "" : : : "memory")
-#else
-#error "Define barriers"
-#endif
-
-// Used for Debug etc.
-static const char* PLUGIN_NAME = "header_filter";
-static const char* PLUGIN_NAME_DBG = "header_filter_dbg";
-
-
-// From the atomic portions of ATS
-typedef int int32;
-typedef unsigned int intu32;
-typedef long long int64;
-typedef unsigned long long intu64;
-
-typedef volatile int32 vint32;
-typedef volatile int64 vint64;
-typedef volatile void *vvoidp;
-typedef vint32 *pvint32;
-typedef vint64 *pvint64;
-typedef vvoidp *pvvoidp;
-
-#if defined(__GNUC__) && (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 1)
-
-/* see http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Atomic-Builtins.html */
-static inline int32 ink_atomic_swap(pvint32 mem, int32 value) { return __sync_lock_test_and_set(mem, value); }
-static inline int64 ink_atomic_swap64(pvint64 mem, int64 value) { return __sync_lock_test_and_set(mem, value); }
-static inline void *ink_atomic_swap_ptr(vvoidp mem, void *value) { return __sync_lock_test_and_set((void**)mem, value); }
-static inline int ink_atomic_cas(pvint32 mem, int old, int new_value) { return __sync_bool_compare_and_swap(mem, old, new_value); }
-static inline int64 ink_atomic_cas64(pvint64 mem, int64 old, int64 new_value) { return __sync_bool_compare_and_swap(mem, old, new_value); }
-static inline int ink_atomic_cas_ptr(pvvoidp mem, void* old, void* new_value) { return __sync_bool_compare_and_swap(mem, old, new_value); }
-static inline int ink_atomic_increment(pvint32 mem, int value) { return __sync_fetch_and_add(mem, value); }
-static inline int64 ink_atomic_increment64(pvint64 mem, int64 value) { return __sync_fetch_and_add(mem, value); }
-static inline void *ink_atomic_increment_ptr(pvvoidp mem, intptr_t value) { return __sync_fetch_and_add((void**)mem, value); }
-#else
-// TODO: Deal with this case?
-#failure
-#endif
-
-
-// From google styleguide: http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml
-#define DISALLOW_COPY_AND_ASSIGN(TypeName)      \
-  TypeName(const TypeName&);                    \
-  void operator=(const TypeName&)
-
-
-#endif // __LULU_H__
-
-
-
-/*
-  local variables:
-  mode: C++
-  indent-tabs-mode: nil
-  c-basic-offset: 2
-  c-comment-only-line-offset: 0
-  c-file-offsets: ((statement-block-intro . +)
-  (label . 0)
-  (statement-cont . +)
-  (innamespace . 0))
-  end:
-
-  Indent with: /usr/bin/indent -ncs -nut -npcs -l 120 logstats.cc
-*/

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/19921914/plugins/header_filter/README
----------------------------------------------------------------------
diff --git a/plugins/header_filter/README b/plugins/header_filter/README
new file mode 100644
index 0000000..f10a9ac
--- /dev/null
+++ b/plugins/header_filter/README
@@ -0,0 +1,95 @@
+Apache Traffic Server Header Filter plugin
+==========================================
+
+This is a simple plugin for filtering out headers from requests (or
+responses). Typical configuration is done either with a global
+configuration, in .../etc/trafficserver/plugin.config:
+
+    header_filter.so /usr/local/etc/hdr_filters.conf
+
+
+Or, alternatively, in a per-remap rule configuration 
+
+    map http://a.com/ http://b.com @plugin=header_filter.so @pparam=hdr_filters.conf
+
+
+Even if you don't have a global configuration, if your remap rules
+schedules actions in hooks other than during remap, you must also add the
+header_filter.so to the plugin.config (see above), but without args:
+
+    header_filter.so
+
+
+The configuration files looks like
+
+[READ_REQUEST_HDR]
+	X-From-Someone
+	Cookie
+
+[READ_RESPONSE_HDR]
+	X-From-Server
+	Set-Cookie
+
+[SEND_RESPONSE_HDR]
+	X-Fie "Test"    # Match the entire string
+	X-Foo /Test/    # Match the (Perl) regex
+	X-Bar [Test*    # Match the prefix string
+	X-Fum *Test]    # Match the postfix string
+
+
+Comments are prefixed with #, and in most cases, the regular expression
+matching is the best choice (very little overhead). The pattern matches
+can also take an option '!' to reverse the test. The default action is
+to delete all headers that do (not) match the pattern. E.g.
+
+[SEND_REQUEST_HDR]
+	X-Fie   /test/
+	X-Foo ! /test/i
+
+
+The final "i" qualifier (works on all pattern matches) forces the match or
+comparison to be made case insensitive (just like in Perl).
+
+
+It's also possible to replace or add headers, using the = and +
+operators. For example
+
+[SEND_REQUEST_HDR]
+	Host =www.example.com=
+	X-Foo +ATS+
+
+
+This will force the Host: header to have exactly one value,
+www.example.com, while X-Foo will have at least one header with the value
+ATS, but there could be more instances of the header from the existing
+header in the request.
+
+
+Possible hooks are
+
+	 READ_REQUEST_HDR
+	 SEND_REQUEST_HDR
+	 READ_RESPONSE_HDR
+	 SEND_RESPONSE_HDR
+
+
+If not specified, the default hook to add the rules (headers to filter) is
+READ_REQUEST_HDR. It's completely acceptable (and useful) to configure a
+remap rule to delete headers in a later hook (e.g. when reading a response
+from the server). This is what actually makes the plugin even remotely
+useful.
+
+
+
+BUILDING
+========
+
+A simple
+
+    % make
+    % make install
+
+
+should do it, assuming that you have the tsxs script in your search
+path. This script is installed with your installation of Apache Traffic
+Server.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/19921914/plugins/header_filter/example.conf
----------------------------------------------------------------------
diff --git a/plugins/header_filter/example.conf b/plugins/header_filter/example.conf
new file mode 100644
index 0000000..8914b9e
--- /dev/null
+++ b/plugins/header_filter/example.conf
@@ -0,0 +1,21 @@
+#
+# This following will:
+#    - nuke the cookie headers (all of them)
+#    - Replace the Host: header with www.ogre.com
+#    - Add a header X-Append-Header: Added by ATS
+#
+[READ_RESPONSE_HDR]
+  Set-Cookie
+  Expires
+  Vary /user-agent/i
+  X-Foo ! "test"
+
+
+#
+# There can only ever be one Host: header (the plugin assures that since we use the set-operator)
+# but there can be more than one X-Append-Header (since we use the add-operator).
+#
+[SEND_REQUEST_HDR]
+	Cookie
+	Host =www.ogre.com=
+	X-Append-Header +Added by ATS+

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/19921914/plugins/header_filter/header_filter.cc
----------------------------------------------------------------------
diff --git a/plugins/header_filter/header_filter.cc b/plugins/header_filter/header_filter.cc
new file mode 100644
index 0000000..48425d1
--- /dev/null
+++ b/plugins/header_filter/header_filter.cc
@@ -0,0 +1,213 @@
+/*
+  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.
+*/
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// 
+// Main entry points for the plugin hooks etc.
+//
+#include <ts/ts.h>
+#include <ts/remap.h>
+#include <stdio.h>
+
+#include "rules.h"
+
+using namespace ::HeaderFilter;
+
+// Global plugin rules
+Rules global;
+int arg_idx;
+
+// TODO: Maybe we should use wrappers for TSmalloc() for pcre_malloc (and _free),
+// but since we only compile at config time, it's really not that important.
+
+
+///////////////////////////////////////////////////////////////////////////////
+// Continuation
+//
+static int
+cont_header_filter(TSCont contp, TSEvent event, void *edata)
+{
+  TSHttpTxn txnp = (TSHttpTxn) edata;
+  TSHttpHookID hook = TS_HTTP_LAST_HOOK;
+  TSMBuffer reqp;
+  TSMLoc hdr_loc;
+
+  // Get the resources necessary to process this event
+  switch (event) {
+  case TS_EVENT_HTTP_READ_REQUEST_HDR:
+    if (TS_SUCCESS == TSHttpTxnClientReqGet(txnp, &reqp, &hdr_loc))
+      hook = TS_HTTP_READ_REQUEST_HDR_HOOK;
+    break;
+  case TS_EVENT_HTTP_SEND_REQUEST_HDR:
+    if (TS_SUCCESS == TSHttpTxnServerReqGet(txnp, &reqp, &hdr_loc))
+      hook = TS_HTTP_SEND_REQUEST_HDR_HOOK;
+    break;
+  case TS_EVENT_HTTP_READ_RESPONSE_HDR:
+    if (TS_SUCCESS == TSHttpTxnServerRespGet(txnp, &reqp, &hdr_loc))
+      hook = TS_HTTP_READ_RESPONSE_HDR_HOOK;
+    break;
+  case TS_EVENT_HTTP_SEND_RESPONSE_HDR:
+    if (TS_SUCCESS == TSHttpTxnClientRespGet(txnp, &reqp, &hdr_loc))
+      hook = TS_HTTP_SEND_RESPONSE_HDR_HOOK;
+    break;
+  default:
+    TSError("header_filter: unknown event for this plugin");
+    TSDebug(PLUGIN_NAME, "unknown event for this plugin");
+    break;
+  }
+
+  if (hook != TS_HTTP_LAST_HOOK) {
+    Rules* from_remap;
+
+    global.execute(reqp, hdr_loc, hook);
+
+    if (TS_HTTP_READ_REQUEST_HDR_HOOK != hook) { // Don't run the hook handled by remap plugin
+      if ((from_remap = (Rules*)TSHttpTxnArgGet(txnp, arg_idx))) {
+        from_remap->execute(reqp, hdr_loc, hook);
+      }
+    }
+    TSHandleMLocRelease(reqp, TS_NULL_MLOC, hdr_loc);
+  }
+
+  TSHttpTxnReenable(txnp, TS_EVENT_HTTP_CONTINUE);
+  return 0;
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+// Initialize the InkAPI plugin for the global hooks we support.
+//
+void
+TSPluginInit(int argc, const char *argv[])
+{
+  TSPluginRegistrationInfo info;
+
+  info.plugin_name = const_cast<char*>(PLUGIN_NAME);
+  info.vendor_name = const_cast<char*>("Apache");
+  info.support_email = const_cast<char*>("users@trafficserver.apache.org");
+
+  if (!TSPluginRegister(TS_SDK_VERSION_3_0 , &info)) {
+    TSError("header_filter: plugin registration failed.\n"); 
+  }
+
+  // Parse the rules file
+  if ((argc > 1)) {
+    if (!global.parse_file(argv[1]))
+      TSError("header_filter: failed to parse configuration file");
+  }
+
+  TSCont cont = TSContCreate(cont_header_filter, NULL);
+
+  for (int i=TS_HTTP_READ_REQUEST_HDR_HOOK; i < TS_HTTP_LAST_HOOK; ++i) {
+    if (global.supported_hook(static_cast<TSHttpHookID>(i))) {
+      TSDebug(PLUGIN_NAME, "Registering hook %d", i);
+      TSHttpHookAdd(static_cast<TSHttpHookID>(i), cont);
+    }
+  }
+  if (TSHttpArgIndexReserve(PLUGIN_NAME, "Filter out headers in various hooks", &arg_idx) != TS_SUCCESS) {
+    TSError("header_filter: failed to reserve private data slot");
+  }
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+// Initialize the plugin as a remap plugin.
+//
+TSReturnCode
+TSRemapInit(TSRemapInterface* api_info, char *errbuf, int errbuf_size)
+{
+  if (!api_info) {
+    strncpy(errbuf, "[tsremap_init] - Invalid TSRemapInterface argument", errbuf_size - 1);
+    return TS_ERROR;
+  }
+
+  if (api_info->size < sizeof(TSRemapInterface)) {
+    strncpy(errbuf, "[tsremap_init] - Incorrect size of TSRemapInterface structure", errbuf_size - 1);
+    return TS_ERROR;
+  }
+
+  if (api_info->tsremap_version < TSREMAP_VERSION) {
+    snprintf(errbuf, errbuf_size - 1, "[tsremap_init] - Incorrect API version %ld.%ld",
+             api_info->tsremap_version >> 16, (api_info->tsremap_version & 0xffff));
+    return TS_ERROR;
+  }
+
+  TSDebug(PLUGIN_NAME, "remap plugin is succesfully initialized");
+  return TS_SUCCESS;                     /* success */
+}
+
+
+TSReturnCode
+TSRemapNewInstance(int argc, char* argv[], void** ih, char* errbuf, int errbuf_size)
+{
+  if (argc < 3) {
+    TSError("Unable to create remap instance, need rules file");
+    return TS_ERROR;
+  } else {
+    Rules* conf = new(Rules);
+
+    conf->parse_file(argv[2]);
+    *ih = static_cast<void*>(conf);
+  }
+
+  return TS_SUCCESS;
+}
+
+void
+TSRemapDeleteInstance(void* ih)
+{
+  Rules* conf = static_cast<Rules*>(ih);
+
+  delete conf;
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+// Main entry point when used as a remap plugin.
+//
+TSRemapStatus
+TSRemapDoRemap(void* ih, TSHttpTxn rh, TSRemapRequestInfo *rri)
+{
+  if (NULL == ih) {
+    TSDebug(PLUGIN_NAME, "No Rules configured, falling back to default mapping rule");
+  } else {
+    Rules* confp = static_cast<Rules*>(ih);
+
+    TSHttpTxnArgSet(rh, arg_idx, static_cast<void*>(ih)); // Save for later hooks
+    confp->execute(rri->requestBufp, rri->requestHdrp, TS_HTTP_READ_REQUEST_HDR_HOOK);
+  }
+
+  return TSREMAP_NO_REMAP;
+}
+
+
+/*
+  local variables:
+  mode: C++
+  indent-tabs-mode: nil
+  c-basic-offset: 2
+  c-comment-only-line-offset: 0
+  c-file-offsets: ((statement-block-intro . +)
+  (label . 0)
+  (statement-cont . +)
+  (innamespace . 0))
+  end:
+
+  Indent with: /usr/bin/indent -ncs -nut -npcs -l 120 logstats.cc
+*/

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/19921914/plugins/header_filter/lulu.h
----------------------------------------------------------------------
diff --git a/plugins/header_filter/lulu.h b/plugins/header_filter/lulu.h
new file mode 100644
index 0000000..47b08d0
--- /dev/null
+++ b/plugins/header_filter/lulu.h
@@ -0,0 +1,108 @@
+/*
+  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.
+*/
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// 
+// Implement the classes for the various types of hash keys we support.
+//
+#ifndef __LULU_H__
+#define __LULU_H__ 1
+
+// Define UNUSED properly.
+#if ((__GNUC__ >= 3) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 7)))
+#define UNUSED __attribute__ ((unused))
+#else
+#define UNUSED
+#endif /* #if ((__GNUC__ >= 3) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 7))) */
+
+#include <sys/types.h>
+
+// Memory barriers on i386 / linux / gcc
+#if defined(__i386__)
+#define mb()  __asm__ __volatile__ ( "lock; addl $0,0(%%esp)" : : : "memory" )
+#define rmb() __asm__ __volatile__ ( "lock; addl $0,0(%%esp)" : : : "memory" )
+#define wmb() __asm__ __volatile__ ( "" : : : "memory")
+#elif defined(__x86_64__)
+#define mb()  __asm__ __volatile__ ( "mfence" : : : "memory")
+#define rmb() __asm__ __volatile__ ( "lfence" : : : "memory")
+#define wmb() __asm__ __volatile__ ( "" : : : "memory")
+#else
+#error "Define barriers"
+#endif
+
+// Used for Debug etc.
+static const char* PLUGIN_NAME = "header_filter";
+static const char* PLUGIN_NAME_DBG = "header_filter_dbg";
+
+
+// From the atomic portions of ATS
+typedef int int32;
+typedef unsigned int intu32;
+typedef long long int64;
+typedef unsigned long long intu64;
+
+typedef volatile int32 vint32;
+typedef volatile int64 vint64;
+typedef volatile void *vvoidp;
+typedef vint32 *pvint32;
+typedef vint64 *pvint64;
+typedef vvoidp *pvvoidp;
+
+#if defined(__GNUC__) && (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 1)
+
+/* see http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Atomic-Builtins.html */
+static inline int32 ink_atomic_swap(pvint32 mem, int32 value) { return __sync_lock_test_and_set(mem, value); }
+static inline int64 ink_atomic_swap64(pvint64 mem, int64 value) { return __sync_lock_test_and_set(mem, value); }
+static inline void *ink_atomic_swap_ptr(vvoidp mem, void *value) { return __sync_lock_test_and_set((void**)mem, value); }
+static inline int ink_atomic_cas(pvint32 mem, int old, int new_value) { return __sync_bool_compare_and_swap(mem, old, new_value); }
+static inline int64 ink_atomic_cas64(pvint64 mem, int64 old, int64 new_value) { return __sync_bool_compare_and_swap(mem, old, new_value); }
+static inline int ink_atomic_cas_ptr(pvvoidp mem, void* old, void* new_value) { return __sync_bool_compare_and_swap(mem, old, new_value); }
+static inline int ink_atomic_increment(pvint32 mem, int value) { return __sync_fetch_and_add(mem, value); }
+static inline int64 ink_atomic_increment64(pvint64 mem, int64 value) { return __sync_fetch_and_add(mem, value); }
+static inline void *ink_atomic_increment_ptr(pvvoidp mem, intptr_t value) { return __sync_fetch_and_add((void**)mem, value); }
+#else
+// TODO: Deal with this case?
+#failure
+#endif
+
+
+// From google styleguide: http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml
+#define DISALLOW_COPY_AND_ASSIGN(TypeName)      \
+  TypeName(const TypeName&);                    \
+  void operator=(const TypeName&)
+
+
+#endif // __LULU_H__
+
+
+
+/*
+  local variables:
+  mode: C++
+  indent-tabs-mode: nil
+  c-basic-offset: 2
+  c-comment-only-line-offset: 0
+  c-file-offsets: ((statement-block-intro . +)
+  (label . 0)
+  (statement-cont . +)
+  (innamespace . 0))
+  end:
+
+  Indent with: /usr/bin/indent -ncs -nut -npcs -l 120 logstats.cc
+*/

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/19921914/plugins/header_filter/rules.cc
----------------------------------------------------------------------
diff --git a/plugins/header_filter/rules.cc b/plugins/header_filter/rules.cc
new file mode 100644
index 0000000..41b0014
--- /dev/null
+++ b/plugins/header_filter/rules.cc
@@ -0,0 +1,331 @@
+/*
+  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.
+*/
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// 
+// Implemenation details for the rules class.
+//
+#include <fstream>
+#include <ts/ts.h>
+
+#include "rules.h"
+
+namespace HeaderFilter {
+
+const char* QUAL_DELIMITERS = "!/\"*[+=";
+
+
+// RulesEntry implementations
+void
+RulesEntry::append(RulesEntry* entry)
+{
+  RulesEntry* n = this;
+
+  while (NULL != n->_next)
+    n = n->_next;
+  n->_next = entry;
+}
+
+inline void
+add_header(TSMBuffer& reqp, TSMLoc& hdr_loc, const char* hdr, int hdr_len, const char* val, int val_len)
+{
+  if (val_len <= 0) {
+    TSDebug(PLUGIN_NAME, "\tWould set header %s to an empty value, skipping", hdr);
+  } else {
+    TSMLoc new_field;
+
+    if (TS_SUCCESS == TSMimeHdrFieldCreateNamed(reqp, hdr_loc, hdr, hdr_len, &new_field)) {
+      if (TS_SUCCESS == TSMimeHdrFieldValueStringInsert(reqp, hdr_loc, new_field, -1,  val, val_len))
+        if (TS_SUCCESS == TSMimeHdrFieldAppend(reqp, hdr_loc, new_field))
+          TSDebug(PLUGIN_NAME, "\tAdded header %s: %s", hdr, val);
+      TSHandleMLocRelease(reqp, hdr_loc, new_field);
+    }
+  }
+}
+
+void
+RulesEntry::execute(TSMBuffer& reqp, TSMLoc& hdr_loc) const
+{
+  if (_q_type == QUAL_ADD) {
+    add_header(reqp, hdr_loc, _header, _h_len, _qualifier, _q_len);
+  } else {
+    TSMLoc field = TSMimeHdrFieldFind(reqp, hdr_loc, _header, _h_len);
+    bool first_set = true;
+
+    while (field) {
+      TSMLoc tmp;
+      int val_len = 0;
+      const char* val = NULL;
+      bool nuke = false;
+      
+      if (_q_type != QUAL_NONE)
+        val = TSMimeHdrFieldValueStringGet(reqp, hdr_loc, field, 0, &val_len);
+
+      switch (_q_type) {
+      case QUAL_NONE:
+        nuke = true;
+        break;
+      case QUAL_REGEX:
+        if (val_len > 0) {
+          nuke = pcre_exec(_rex,            // the compiled pattern
+                           _extra,          // Extra data from study (maybe)
+                           val,                // the subject string
+                           val_len,            // the length of the subject
+                           0,                  // start at offset 0 in the subject
+                           0,                  // default options
+                           NULL,               // no output vector for substring information
+                           0) >= 0;
+        }
+        break;
+
+      case QUAL_STRING:
+        if (static_cast<size_t>(val_len) == _q_len) {
+          if (_options & PCRE_CASELESS) {
+            nuke = !strncasecmp(_qualifier, val, val_len);
+          } else {
+            nuke = !memcmp(_qualifier, val, val_len);
+          }
+        }
+        break;
+
+      case QUAL_PREFIX:
+        if (static_cast<size_t>(val_len) >= _q_len) {
+          if (_options & PCRE_CASELESS) {
+            nuke = !strncasecmp(_qualifier, val, _q_len);
+          } else {
+            nuke = !memcmp(_qualifier, val, _q_len);
+          }
+        }
+        break;
+
+      case QUAL_POSTFIX: 
+        if (static_cast<size_t>(val_len) >= _q_len) {
+          if (_options & PCRE_CASELESS) {
+            nuke = !strncasecmp(_qualifier, val + val_len - _q_len, _q_len);
+          } else {
+            nuke = !memcmp(_qualifier, val + val_len - _q_len, _q_len);
+          }
+        }
+        break;
+      case QUAL_SET:
+        if (first_set) {
+          nuke = false;
+          first_set = false;
+          if (TS_SUCCESS == TSMimeHdrFieldValueStringSet(reqp, hdr_loc, field, -1, _qualifier, _q_len))
+            TSDebug(PLUGIN_NAME, "\tSet header:  %s: %s", _header, _qualifier);
+        } else {
+          // Nuke all other "duplicates" of this header
+          nuke = true;
+        }
+        
+      default:
+        break;
+      }
+
+      tmp = TSMimeHdrFieldNextDup(reqp, hdr_loc, field);
+      if (_inverse)
+        nuke = !nuke;
+      if (nuke) {
+        if (TS_SUCCESS == TSMimeHdrFieldDestroy(reqp, hdr_loc, field))
+          TSDebug(PLUGIN_NAME, "\tDeleting header %.*s", static_cast<int>(_h_len), _header);
+      }
+      TSHandleMLocRelease(reqp, hdr_loc, field);
+      field = tmp;
+    }
+  }
+}
+
+
+// Rules class implementations
+Rules::~Rules()
+{
+  TSDebug(PLUGIN_NAME_DBG, "Calling DTOR for Rules");
+
+  for (int i = 0; i < TS_HTTP_LAST_HOOK; ++i)
+    delete _entries[i];
+}
+
+RulesEntry*
+Rules::add_entry(const TSHttpHookID hook, const std::string& s, const std::string& q, QualifierTypes type, bool inverse, int options)
+{
+  RulesEntry* e = new(RulesEntry)(s, q, type, inverse, options);
+
+  TSAssert(supported_hook(hook));
+  if (NULL == _entries[hook]) {
+    _entries[hook] = e;
+  } else {
+    _entries[hook]->append(e);
+  }
+  
+  return e;
+}
+
+bool
+Rules::parse_file(const char* filename)
+{
+  std::ifstream f;
+  TSHttpHookID hook = TS_HTTP_READ_REQUEST_HDR_HOOK;
+  int lineno = 0;
+
+  // TODO: Should we support "glob" here, to specify more than one filename?
+  // TODO: Should we support a 'default' prefix here for the rules?
+  f.open(filename, std::ios::in);
+  if (!f.is_open()) {
+    TSError("unable to open %s", filename);
+    return false;
+  }
+  TSDebug(PLUGIN_NAME, "Parsing config file %s", filename);
+  while (!f.eof()) {
+    bool inverse = false;
+    int options = 0;
+    QualifierTypes type = QUAL_NONE;
+    std::string line, word, qualifier;
+    std::string::size_type pos1, pos2;
+
+    getline(f, line);
+    ++lineno;
+    if (line.empty())
+      continue;
+
+    pos1 = line.find_first_not_of(" \t\n");
+    if (pos1 != std::string::npos) {
+      if (line[pos1] == '#') {
+        continue; // Skip comments
+      } else {
+        pos2 = line.find_first_of("# \t\n", pos1+1); // end of word
+        if (pos2 == std::string::npos) {
+          word = line.substr(pos1);
+          pos1 = pos2;
+        } else {
+          word = line.substr(pos1, pos2-pos1);
+          pos1 = line.find_first_of(QUAL_DELIMITERS, pos2+1);
+        }
+
+        if (word == "[READ_REQUEST_HDR]") {
+          hook = TS_HTTP_READ_REQUEST_HDR_HOOK;
+        } else if (word == "[SEND_REQUEST_HDR]") {
+          hook = TS_HTTP_SEND_REQUEST_HDR_HOOK;
+        } else if (word == "[READ_RESPONSE_HDR]") {
+          hook = TS_HTTP_READ_RESPONSE_HDR_HOOK;
+        } else if (word == "[SEND_RESPONSE_HDR]") {
+          hook = TS_HTTP_SEND_RESPONSE_HDR_HOOK;
+        } else  if (word.empty()) {
+          // Error case, but shouldn't happen?
+        } else {
+          // Treat everything else as headers (+ possibly a qualifier)
+          if (pos1 != std::string::npos) { // Found a specifier
+            if (line[pos1] == '!') {
+              inverse = true;
+              pos1 =  line.find_first_of(QUAL_DELIMITERS, pos1+1);
+            }
+            if (pos1 != std::string::npos) {
+              char trailer = ' ';
+
+              switch (line[pos1]) {
+              case '/':
+                type = QUAL_REGEX;
+                trailer = '/';
+                break;
+              case '"':
+                type = QUAL_STRING;
+                trailer = '"';
+                break;
+              case '*':
+                type = QUAL_POSTFIX;
+                trailer = ']';
+                break;
+              case '[':
+                type = QUAL_PREFIX;
+                trailer = '*';
+                break;
+              case '+':
+                type = QUAL_ADD;
+                inverse = false; // Can never inverse the add operator
+                trailer = '+';
+                break;
+              case '=':
+                type = QUAL_SET;
+                inverse = false; // Can never inverse the set operator
+                trailer = '=';
+                break;
+              default:
+                // TODO: Error case?
+                break;
+              }
+                
+              pos2 = line.find_first_of(trailer, pos1+1);
+              if (pos2 != std::string::npos) {
+                qualifier = line.substr(pos1+1, pos2-pos1-1);
+                if (line[pos2+1] == 'i')
+                  options |= PCRE_CASELESS;
+                TSDebug(PLUGIN_NAME, "Adding '%s' to hook %d, type is %d, qualifier is %c %s (%c)",
+                        word.c_str(), hook, type, inverse ? '!' : ' ', qualifier.c_str(), options & PCRE_CASELESS ? 'i' : ' ');
+                add_entry(hook, word, qualifier, type, inverse, options);
+              } else {
+                TSError("Missing trailing delimiter in qualifier");
+              }
+            } else {
+              TSError("Missing leading delimiter in qualifier");
+            }
+          } else {
+            // No qualifier, so we'll nuke this header for all values
+            TSDebug(PLUGIN_NAME, "Adding %s to hook %d (unqualified)", word.c_str(), hook);
+            add_entry(hook, word);
+          }
+        }
+      }
+    }
+  }
+
+  return true;
+}
+
+
+void
+Rules::execute(TSMBuffer& reqp, TSMLoc& hdr_loc, const TSHttpHookID hook) const
+{
+  TSAssert(supported_hook(hook));
+
+  if (_entries[hook]) {
+    RulesEntry* n = _entries[hook];
+
+    TSDebug(PLUGIN_NAME, "Executing rules(s) for hook %d", hook);
+    do {
+      n->execute(reqp, hdr_loc);
+    } while (NULL != (n = n->next()));
+  }
+}
+
+
+} // End of namespace ::HeaderFilter
+
+
+/*
+  local variables:
+  mode: C++
+  indent-tabs-mode: nil
+  c-basic-offset: 2
+  c-comment-only-line-offset: 0
+  c-file-offsets: ((statement-block-intro . +)
+  (label . 0)
+  (statement-cont . +)
+  (innamespace . 0))
+  end:
+
+  Indent with: /usr/bin/indent -ncs -nut -npcs -l 120 logstats.cc
+*/

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/19921914/plugins/header_filter/rules.h
----------------------------------------------------------------------
diff --git a/plugins/header_filter/rules.h b/plugins/header_filter/rules.h
new file mode 100644
index 0000000..99043ca
--- /dev/null
+++ b/plugins/header_filter/rules.h
@@ -0,0 +1,168 @@
+/*
+    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.
+*/
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+// 
+// Class for holding a set of configurations. There would be one global configuration, used
+// by all hooks / requests, and one optional configuration for each remap rule.
+//
+#ifndef __RULES_H__
+#define __RULES_H__ 1
+
+#include <string>
+#include <string.h>
+#include <ts/ts.h>
+#include <pcre.h>
+#include "lulu.h"
+
+namespace HeaderFilter {
+
+// The delimiters might look arbitrary, but are choosen to make parsing trivial
+enum QualifierTypes {
+  QUAL_NONE = 0,
+  QUAL_REGEX = 1,		// Regular expression, /match/
+  QUAL_STRING = 2,		// Full string, "match"
+  QUAL_PREFIX = 3,		// Sub-string prefix, [match*
+  QUAL_POSTFIX = 4,		// Sub-string postfix, *match]
+  // This is a semi-hack, but whatever (for now, until we get Lua module done!
+  QUAL_ADD = 5,			// Add the header +string+
+  QUAL_SET = 6			// Set the header =string=, leaving only one header with the new value
+};
+
+
+class RulesEntry
+{
+public:
+  RulesEntry(const std::string& s, const std::string& q, QualifierTypes type, bool inverse, int options)
+    : _header(NULL), _h_len(0), _qualifier(NULL), _q_len(0), _q_type(type), _rex(NULL), _extra(NULL),
+      _inverse(inverse), _options(options), _next(NULL)
+  {
+    if (s.length() > 0) {
+      _header = TSstrdup(s.c_str());
+      _h_len = s.length();
+    }
+    
+    if (q.length() > 0) {
+      _qualifier = TSstrdup(q.c_str());
+      _q_len = q.length();
+      if (_q_type == QUAL_REGEX) {
+        const char* error;
+        int erroffset;
+
+        _rex = pcre_compile(_qualifier,           // the pattern
+                            _options,             // default options
+                            &error,               // for error message
+                            &erroffset,           // for error offset
+                            NULL);                // use default character tables
+        if (!_rex)
+          TSError("header_filter: PCRE failed on %s at offset %d: %s\n", _qualifier, erroffset, error);
+      }
+    }
+
+    TSDebug(PLUGIN_NAME_DBG, "Calling CTOR for RulesEntry, header is %s, qualifier is %s", _header, _qualifier);
+  }
+
+  ~RulesEntry()
+  {
+    TSDebug(PLUGIN_NAME_DBG, "Calling DTOR for RulesEntry");
+    delete _next; // Potentially "deep" recursion, but should be OK.
+    if (_header)
+      TSfree(_header);
+
+    if (QUAL_REGEX == _q_type) {
+      if (_rex)
+        pcre_free(_rex);
+      if (_extra)
+        pcre_free(_extra);
+    }
+    if (_qualifier)
+      TSfree(_qualifier);
+  }
+
+  void append(RulesEntry* entry);
+  void execute(TSMBuffer& reqp, TSMLoc& hdr_loc) const; // This is really the meat of the app
+  RulesEntry* next() const { return _next; }
+
+private:
+  DISALLOW_COPY_AND_ASSIGN(RulesEntry);
+
+  char* _header;
+  size_t _h_len,;
+  char* _qualifier;
+  size_t _q_len;
+  QualifierTypes _q_type;
+  pcre* _rex;
+  pcre_extra* _extra;
+  bool _inverse;
+  int _options;
+  RulesEntry* _next;
+};
+
+
+class Rules
+{
+public:
+  Rules()
+  {
+    TSDebug(PLUGIN_NAME_DBG, "Calling CTOR for Rules");
+    memset(_entries, 0, sizeof(_entries));
+  }
+
+  virtual ~Rules();
+
+  RulesEntry* add_entry(const TSHttpHookID hook, const std::string& s, const std::string& q="", QualifierTypes type = QUAL_NONE,
+                        bool inverse=false, int options=0);
+  bool parse_file(const char* filename);
+
+  bool supported_hook(const TSHttpHookID hook) const
+  {
+    return ((hook == TS_HTTP_READ_REQUEST_HDR_HOOK) ||
+	    (hook == TS_HTTP_SEND_REQUEST_HDR_HOOK) ||
+	    (hook == TS_HTTP_READ_RESPONSE_HDR_HOOK) ||
+	    (hook == TS_HTTP_SEND_RESPONSE_HDR_HOOK));
+  }
+
+  void execute(TSMBuffer& reqp, TSMLoc& hdr_loc, const TSHttpHookID hook) const;
+
+private:
+  DISALLOW_COPY_AND_ASSIGN(Rules);
+
+  RulesEntry* _entries[TS_HTTP_LAST_HOOK]; // One possible set of entries for each hook
+};
+
+} // End of namespace ::HeaderFilter
+
+
+#endif // __RULES_H__
+
+
+
+/*
+  local variables:
+  mode: C++
+  indent-tabs-mode: nil
+  c-basic-offset: 2
+  c-comment-only-line-offset: 0
+  c-file-offsets: ((statement-block-intro . +)
+  (label . 0)
+  (statement-cont . +)
+  (innamespace . 0))
+  end:
+
+  Indent with: /usr/bin/indent -ncs -nut -npcs -l 120 logstats.cc
+*/

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/19921914/rules.cc
----------------------------------------------------------------------
diff --git a/rules.cc b/rules.cc
deleted file mode 100644
index 41b0014..0000000
--- a/rules.cc
+++ /dev/null
@@ -1,331 +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.
-*/
-
-//////////////////////////////////////////////////////////////////////////////////////////////
-// 
-// Implemenation details for the rules class.
-//
-#include <fstream>
-#include <ts/ts.h>
-
-#include "rules.h"
-
-namespace HeaderFilter {
-
-const char* QUAL_DELIMITERS = "!/\"*[+=";
-
-
-// RulesEntry implementations
-void
-RulesEntry::append(RulesEntry* entry)
-{
-  RulesEntry* n = this;
-
-  while (NULL != n->_next)
-    n = n->_next;
-  n->_next = entry;
-}
-
-inline void
-add_header(TSMBuffer& reqp, TSMLoc& hdr_loc, const char* hdr, int hdr_len, const char* val, int val_len)
-{
-  if (val_len <= 0) {
-    TSDebug(PLUGIN_NAME, "\tWould set header %s to an empty value, skipping", hdr);
-  } else {
-    TSMLoc new_field;
-
-    if (TS_SUCCESS == TSMimeHdrFieldCreateNamed(reqp, hdr_loc, hdr, hdr_len, &new_field)) {
-      if (TS_SUCCESS == TSMimeHdrFieldValueStringInsert(reqp, hdr_loc, new_field, -1,  val, val_len))
-        if (TS_SUCCESS == TSMimeHdrFieldAppend(reqp, hdr_loc, new_field))
-          TSDebug(PLUGIN_NAME, "\tAdded header %s: %s", hdr, val);
-      TSHandleMLocRelease(reqp, hdr_loc, new_field);
-    }
-  }
-}
-
-void
-RulesEntry::execute(TSMBuffer& reqp, TSMLoc& hdr_loc) const
-{
-  if (_q_type == QUAL_ADD) {
-    add_header(reqp, hdr_loc, _header, _h_len, _qualifier, _q_len);
-  } else {
-    TSMLoc field = TSMimeHdrFieldFind(reqp, hdr_loc, _header, _h_len);
-    bool first_set = true;
-
-    while (field) {
-      TSMLoc tmp;
-      int val_len = 0;
-      const char* val = NULL;
-      bool nuke = false;
-      
-      if (_q_type != QUAL_NONE)
-        val = TSMimeHdrFieldValueStringGet(reqp, hdr_loc, field, 0, &val_len);
-
-      switch (_q_type) {
-      case QUAL_NONE:
-        nuke = true;
-        break;
-      case QUAL_REGEX:
-        if (val_len > 0) {
-          nuke = pcre_exec(_rex,            // the compiled pattern
-                           _extra,          // Extra data from study (maybe)
-                           val,                // the subject string
-                           val_len,            // the length of the subject
-                           0,                  // start at offset 0 in the subject
-                           0,                  // default options
-                           NULL,               // no output vector for substring information
-                           0) >= 0;
-        }
-        break;
-
-      case QUAL_STRING:
-        if (static_cast<size_t>(val_len) == _q_len) {
-          if (_options & PCRE_CASELESS) {
-            nuke = !strncasecmp(_qualifier, val, val_len);
-          } else {
-            nuke = !memcmp(_qualifier, val, val_len);
-          }
-        }
-        break;
-
-      case QUAL_PREFIX:
-        if (static_cast<size_t>(val_len) >= _q_len) {
-          if (_options & PCRE_CASELESS) {
-            nuke = !strncasecmp(_qualifier, val, _q_len);
-          } else {
-            nuke = !memcmp(_qualifier, val, _q_len);
-          }
-        }
-        break;
-
-      case QUAL_POSTFIX: 
-        if (static_cast<size_t>(val_len) >= _q_len) {
-          if (_options & PCRE_CASELESS) {
-            nuke = !strncasecmp(_qualifier, val + val_len - _q_len, _q_len);
-          } else {
-            nuke = !memcmp(_qualifier, val + val_len - _q_len, _q_len);
-          }
-        }
-        break;
-      case QUAL_SET:
-        if (first_set) {
-          nuke = false;
-          first_set = false;
-          if (TS_SUCCESS == TSMimeHdrFieldValueStringSet(reqp, hdr_loc, field, -1, _qualifier, _q_len))
-            TSDebug(PLUGIN_NAME, "\tSet header:  %s: %s", _header, _qualifier);
-        } else {
-          // Nuke all other "duplicates" of this header
-          nuke = true;
-        }
-        
-      default:
-        break;
-      }
-
-      tmp = TSMimeHdrFieldNextDup(reqp, hdr_loc, field);
-      if (_inverse)
-        nuke = !nuke;
-      if (nuke) {
-        if (TS_SUCCESS == TSMimeHdrFieldDestroy(reqp, hdr_loc, field))
-          TSDebug(PLUGIN_NAME, "\tDeleting header %.*s", static_cast<int>(_h_len), _header);
-      }
-      TSHandleMLocRelease(reqp, hdr_loc, field);
-      field = tmp;
-    }
-  }
-}
-
-
-// Rules class implementations
-Rules::~Rules()
-{
-  TSDebug(PLUGIN_NAME_DBG, "Calling DTOR for Rules");
-
-  for (int i = 0; i < TS_HTTP_LAST_HOOK; ++i)
-    delete _entries[i];
-}
-
-RulesEntry*
-Rules::add_entry(const TSHttpHookID hook, const std::string& s, const std::string& q, QualifierTypes type, bool inverse, int options)
-{
-  RulesEntry* e = new(RulesEntry)(s, q, type, inverse, options);
-
-  TSAssert(supported_hook(hook));
-  if (NULL == _entries[hook]) {
-    _entries[hook] = e;
-  } else {
-    _entries[hook]->append(e);
-  }
-  
-  return e;
-}
-
-bool
-Rules::parse_file(const char* filename)
-{
-  std::ifstream f;
-  TSHttpHookID hook = TS_HTTP_READ_REQUEST_HDR_HOOK;
-  int lineno = 0;
-
-  // TODO: Should we support "glob" here, to specify more than one filename?
-  // TODO: Should we support a 'default' prefix here for the rules?
-  f.open(filename, std::ios::in);
-  if (!f.is_open()) {
-    TSError("unable to open %s", filename);
-    return false;
-  }
-  TSDebug(PLUGIN_NAME, "Parsing config file %s", filename);
-  while (!f.eof()) {
-    bool inverse = false;
-    int options = 0;
-    QualifierTypes type = QUAL_NONE;
-    std::string line, word, qualifier;
-    std::string::size_type pos1, pos2;
-
-    getline(f, line);
-    ++lineno;
-    if (line.empty())
-      continue;
-
-    pos1 = line.find_first_not_of(" \t\n");
-    if (pos1 != std::string::npos) {
-      if (line[pos1] == '#') {
-        continue; // Skip comments
-      } else {
-        pos2 = line.find_first_of("# \t\n", pos1+1); // end of word
-        if (pos2 == std::string::npos) {
-          word = line.substr(pos1);
-          pos1 = pos2;
-        } else {
-          word = line.substr(pos1, pos2-pos1);
-          pos1 = line.find_first_of(QUAL_DELIMITERS, pos2+1);
-        }
-
-        if (word == "[READ_REQUEST_HDR]") {
-          hook = TS_HTTP_READ_REQUEST_HDR_HOOK;
-        } else if (word == "[SEND_REQUEST_HDR]") {
-          hook = TS_HTTP_SEND_REQUEST_HDR_HOOK;
-        } else if (word == "[READ_RESPONSE_HDR]") {
-          hook = TS_HTTP_READ_RESPONSE_HDR_HOOK;
-        } else if (word == "[SEND_RESPONSE_HDR]") {
-          hook = TS_HTTP_SEND_RESPONSE_HDR_HOOK;
-        } else  if (word.empty()) {
-          // Error case, but shouldn't happen?
-        } else {
-          // Treat everything else as headers (+ possibly a qualifier)
-          if (pos1 != std::string::npos) { // Found a specifier
-            if (line[pos1] == '!') {
-              inverse = true;
-              pos1 =  line.find_first_of(QUAL_DELIMITERS, pos1+1);
-            }
-            if (pos1 != std::string::npos) {
-              char trailer = ' ';
-
-              switch (line[pos1]) {
-              case '/':
-                type = QUAL_REGEX;
-                trailer = '/';
-                break;
-              case '"':
-                type = QUAL_STRING;
-                trailer = '"';
-                break;
-              case '*':
-                type = QUAL_POSTFIX;
-                trailer = ']';
-                break;
-              case '[':
-                type = QUAL_PREFIX;
-                trailer = '*';
-                break;
-              case '+':
-                type = QUAL_ADD;
-                inverse = false; // Can never inverse the add operator
-                trailer = '+';
-                break;
-              case '=':
-                type = QUAL_SET;
-                inverse = false; // Can never inverse the set operator
-                trailer = '=';
-                break;
-              default:
-                // TODO: Error case?
-                break;
-              }
-                
-              pos2 = line.find_first_of(trailer, pos1+1);
-              if (pos2 != std::string::npos) {
-                qualifier = line.substr(pos1+1, pos2-pos1-1);
-                if (line[pos2+1] == 'i')
-                  options |= PCRE_CASELESS;
-                TSDebug(PLUGIN_NAME, "Adding '%s' to hook %d, type is %d, qualifier is %c %s (%c)",
-                        word.c_str(), hook, type, inverse ? '!' : ' ', qualifier.c_str(), options & PCRE_CASELESS ? 'i' : ' ');
-                add_entry(hook, word, qualifier, type, inverse, options);
-              } else {
-                TSError("Missing trailing delimiter in qualifier");
-              }
-            } else {
-              TSError("Missing leading delimiter in qualifier");
-            }
-          } else {
-            // No qualifier, so we'll nuke this header for all values
-            TSDebug(PLUGIN_NAME, "Adding %s to hook %d (unqualified)", word.c_str(), hook);
-            add_entry(hook, word);
-          }
-        }
-      }
-    }
-  }
-
-  return true;
-}
-
-
-void
-Rules::execute(TSMBuffer& reqp, TSMLoc& hdr_loc, const TSHttpHookID hook) const
-{
-  TSAssert(supported_hook(hook));
-
-  if (_entries[hook]) {
-    RulesEntry* n = _entries[hook];
-
-    TSDebug(PLUGIN_NAME, "Executing rules(s) for hook %d", hook);
-    do {
-      n->execute(reqp, hdr_loc);
-    } while (NULL != (n = n->next()));
-  }
-}
-
-
-} // End of namespace ::HeaderFilter
-
-
-/*
-  local variables:
-  mode: C++
-  indent-tabs-mode: nil
-  c-basic-offset: 2
-  c-comment-only-line-offset: 0
-  c-file-offsets: ((statement-block-intro . +)
-  (label . 0)
-  (statement-cont . +)
-  (innamespace . 0))
-  end:
-
-  Indent with: /usr/bin/indent -ncs -nut -npcs -l 120 logstats.cc
-*/

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/19921914/rules.h
----------------------------------------------------------------------
diff --git a/rules.h b/rules.h
deleted file mode 100644
index 99043ca..0000000
--- a/rules.h
+++ /dev/null
@@ -1,168 +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.
-*/
-
-//////////////////////////////////////////////////////////////////////////////////////////////
-// 
-// Class for holding a set of configurations. There would be one global configuration, used
-// by all hooks / requests, and one optional configuration for each remap rule.
-//
-#ifndef __RULES_H__
-#define __RULES_H__ 1
-
-#include <string>
-#include <string.h>
-#include <ts/ts.h>
-#include <pcre.h>
-#include "lulu.h"
-
-namespace HeaderFilter {
-
-// The delimiters might look arbitrary, but are choosen to make parsing trivial
-enum QualifierTypes {
-  QUAL_NONE = 0,
-  QUAL_REGEX = 1,		// Regular expression, /match/
-  QUAL_STRING = 2,		// Full string, "match"
-  QUAL_PREFIX = 3,		// Sub-string prefix, [match*
-  QUAL_POSTFIX = 4,		// Sub-string postfix, *match]
-  // This is a semi-hack, but whatever (for now, until we get Lua module done!
-  QUAL_ADD = 5,			// Add the header +string+
-  QUAL_SET = 6			// Set the header =string=, leaving only one header with the new value
-};
-
-
-class RulesEntry
-{
-public:
-  RulesEntry(const std::string& s, const std::string& q, QualifierTypes type, bool inverse, int options)
-    : _header(NULL), _h_len(0), _qualifier(NULL), _q_len(0), _q_type(type), _rex(NULL), _extra(NULL),
-      _inverse(inverse), _options(options), _next(NULL)
-  {
-    if (s.length() > 0) {
-      _header = TSstrdup(s.c_str());
-      _h_len = s.length();
-    }
-    
-    if (q.length() > 0) {
-      _qualifier = TSstrdup(q.c_str());
-      _q_len = q.length();
-      if (_q_type == QUAL_REGEX) {
-        const char* error;
-        int erroffset;
-
-        _rex = pcre_compile(_qualifier,           // the pattern
-                            _options,             // default options
-                            &error,               // for error message
-                            &erroffset,           // for error offset
-                            NULL);                // use default character tables
-        if (!_rex)
-          TSError("header_filter: PCRE failed on %s at offset %d: %s\n", _qualifier, erroffset, error);
-      }
-    }
-
-    TSDebug(PLUGIN_NAME_DBG, "Calling CTOR for RulesEntry, header is %s, qualifier is %s", _header, _qualifier);
-  }
-
-  ~RulesEntry()
-  {
-    TSDebug(PLUGIN_NAME_DBG, "Calling DTOR for RulesEntry");
-    delete _next; // Potentially "deep" recursion, but should be OK.
-    if (_header)
-      TSfree(_header);
-
-    if (QUAL_REGEX == _q_type) {
-      if (_rex)
-        pcre_free(_rex);
-      if (_extra)
-        pcre_free(_extra);
-    }
-    if (_qualifier)
-      TSfree(_qualifier);
-  }
-
-  void append(RulesEntry* entry);
-  void execute(TSMBuffer& reqp, TSMLoc& hdr_loc) const; // This is really the meat of the app
-  RulesEntry* next() const { return _next; }
-
-private:
-  DISALLOW_COPY_AND_ASSIGN(RulesEntry);
-
-  char* _header;
-  size_t _h_len,;
-  char* _qualifier;
-  size_t _q_len;
-  QualifierTypes _q_type;
-  pcre* _rex;
-  pcre_extra* _extra;
-  bool _inverse;
-  int _options;
-  RulesEntry* _next;
-};
-
-
-class Rules
-{
-public:
-  Rules()
-  {
-    TSDebug(PLUGIN_NAME_DBG, "Calling CTOR for Rules");
-    memset(_entries, 0, sizeof(_entries));
-  }
-
-  virtual ~Rules();
-
-  RulesEntry* add_entry(const TSHttpHookID hook, const std::string& s, const std::string& q="", QualifierTypes type = QUAL_NONE,
-                        bool inverse=false, int options=0);
-  bool parse_file(const char* filename);
-
-  bool supported_hook(const TSHttpHookID hook) const
-  {
-    return ((hook == TS_HTTP_READ_REQUEST_HDR_HOOK) ||
-	    (hook == TS_HTTP_SEND_REQUEST_HDR_HOOK) ||
-	    (hook == TS_HTTP_READ_RESPONSE_HDR_HOOK) ||
-	    (hook == TS_HTTP_SEND_RESPONSE_HDR_HOOK));
-  }
-
-  void execute(TSMBuffer& reqp, TSMLoc& hdr_loc, const TSHttpHookID hook) const;
-
-private:
-  DISALLOW_COPY_AND_ASSIGN(Rules);
-
-  RulesEntry* _entries[TS_HTTP_LAST_HOOK]; // One possible set of entries for each hook
-};
-
-} // End of namespace ::HeaderFilter
-
-
-#endif // __RULES_H__
-
-
-
-/*
-  local variables:
-  mode: C++
-  indent-tabs-mode: nil
-  c-basic-offset: 2
-  c-comment-only-line-offset: 0
-  c-file-offsets: ((statement-block-intro . +)
-  (label . 0)
-  (statement-cont . +)
-  (innamespace . 0))
-  end:
-
-  Indent with: /usr/bin/indent -ncs -nut -npcs -l 120 logstats.cc
-*/


Mime
View raw message