Return-Path: Delivered-To: apmail-httpd-docs-archive@www.apache.org Received: (qmail 72768 invoked from network); 16 Sep 2008 13:20:57 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 16 Sep 2008 13:20:57 -0000 Received: (qmail 99752 invoked by uid 500); 16 Sep 2008 13:20:53 -0000 Delivered-To: apmail-httpd-docs-archive@httpd.apache.org Received: (qmail 99582 invoked by uid 500); 16 Sep 2008 13:20:52 -0000 Mailing-List: contact docs-help@httpd.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: docs@httpd.apache.org List-Id: Delivered-To: mailing list docs@httpd.apache.org Received: (qmail 99564 invoked by uid 99); 16 Sep 2008 13:20:52 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Sep 2008 06:20:52 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of poirier@pobox.com designates 207.106.133.19 as permitted sender) Received: from [207.106.133.19] (HELO sasl.smtp.pobox.com) (207.106.133.19) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Sep 2008 13:19:53 +0000 Received: from localhost.localdomain (localhost [127.0.0.1]) by a-sasl-fastnet.sasl.smtp.pobox.com (Postfix) with ESMTP id 4D0A6627C9 for ; Tue, 16 Sep 2008 09:19:53 -0400 (EDT) Received: from [9.37.243.67] (bi01p1.nc.us.ibm.com [129.33.49.251]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-sasl-fastnet.sasl.smtp.pobox.com (Postfix) with ESMTPSA id 05463627C8 for ; Tue, 16 Sep 2008 09:19:52 -0400 (EDT) Message-ID: <48CFB277.9040605@pobox.com> Date: Tue, 16 Sep 2008 09:19:51 -0400 From: Dan Poirier User-Agent: Thunderbird 2.0.0.16 (X11/20080724) MIME-Version: 1.0 To: docs@httpd.apache.org Subject: Re: [PATCH] grammar for mod_sed References: In-Reply-To: Content-Type: multipart/mixed; boundary="------------030803020206080604070902" X-Pobox-Relay-ID: 25F32E0E-83F2-11DD-B92A-D0CFFE4BC1C1-25076293!a-sasl-fastnet.pobox.com X-Virus-Checked: Checked by ClamAV on apache.org --------------030803020206080604070902 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sorry, here it is again as an attachment. --------------030803020206080604070902 Content-Type: text/plain; name="mod_sed.patch1.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="mod_sed.patch1.txt" Index: docs/manual/mod/mod_sed.xml =================================================================== --- docs/manual/mod/mod_sed.xml (revision 695466) +++ docs/manual/mod/mod_sed.xml (working copy) @@ -29,38 +29,38 @@

-mod_sed is a in-process content filter. mod_sed filter implement the sed edit -commands implemented by Solaris 10 sed -program as described in man -page. However unlike sed, mod_sed doesn't take data from +mod_sed is an in-process content filter. The mod_sed filter implements the sed edit +commands implemented by the Solaris 10 sed +program as described in the man +page. However, unlike sed, mod_sed doesn't take data from standard -input. Instead filter act on the entity data sent between client and -server. mod_sed can be used as a input or output filter. mod_sed is a -content filter which means that it can not be used to modify client or +input. Instead, the filter acts on the entity data sent between client and +server. mod_sed can be used as an input or output filter. mod_sed is a +content filter, which means that it cannot be used to modify client or server http headers.

-mod_sed output filter accept a chunk of data and execute the sed scripts on data and generates the output which is passed to next filter in the filter chain. +The mod_sed output filter accepts a chunk of data, executes the sed scripts on the data, and generates the output which is passed to next filter in the filter chain.

-mod_sed input filter reads the data from next filter in filter chain and executes the sed scripts and returns the generated data to caller filter in the filter chain. +The mod_sed input filter reads the data from the next filter in filter chain, executes the sed scripts, and returns the generated data to the caller filter in the filter chain.

-Both input and output filter only process the data if new line character is seen in the content. At the end of the data, rest of the data is treated as last line. +Both the input and output filter only process the data if new line characters are seen in the content. At the end of the data, the rest of the data is treated as the last line.

A tutorial article on mod_sed, and why it is more powerful than simple -string or regular expression search and replace, is available in on the author's blog.

Sample Configuration - Adding a output filter - # In following example, sed filter will replace the string
+ Adding an output filter + # In following example, the sed filter will change the string
# "monday" to "MON" and the string "sunday" to SUN in html document
# before sending to client.
@@ -74,8 +74,8 @@
- Adding a input filter - # In following example, sed filter will replace the string
+ Adding an input filter + # In following example, the sed filter will change the string
# "monday" to "MON" and the string "sunday" to SUN in the POST data
# sent to php
@@ -91,7 +91,7 @@
Sed Commands

- Complete details of the sed command can be found from + Complete details of the sed command can be found from the sed man page.

@@ -99,27 +99,27 @@
b
branch to the label specified (Similar to goto)
h
-
Copy the current line to hold buffer.
+
Copy the current line to the hold buffer.
H
-
Append the current line to hold buffer.
+
Append the current line to the hold buffer.
g
Copy the hold buffer into the current line
G
-
Append the hold buffer into the current line
+
Append the hold buffer to the current line
x
-
Swap the content of hold buffer and current line
+
Swap the content of the hold buffer and the current line
OutputSed -Sed command for filter the response content +Sed command for filtering the response content OutputSed sed-command directory.htaccess -

The OutputSed directive specify the sed +

The OutputSed directive specifies the sed command which will be executed on the response.

@@ -133,7 +133,7 @@ -

The InputSed directive specify the sed command +

The InputSed directive specifies the sed command which will be executed on the request data e.g POST data.

--------------030803020206080604070902 Content-Type: text/plain; charset=us-ascii --------------------------------------------------------------------- To unsubscribe, e-mail: docs-unsubscribe@httpd.apache.org For additional commands, e-mail: docs-help@httpd.apache.org --------------030803020206080604070902--