Hello, I'm currently playing with output filters. I thought of using awk to print out the number of each line. In my bash shell I used this: echo "<html>" | awk '{print NR ":" $N}' I add the following lines to my httpd.conf: ExtFilterDefine awk_line_numbering mode=output outtype=text/html cmd="/bin/awk '{print NR\": \" $N}'" <Location /> SetOutputFilter awk_line_numbering </Location> Now when I start the apache I get a syntax error. Unexpected parameter: `: \" $N}'"' I suppose this is a bug because some external programs like awk need to use quotation marks in order to work. A workaround is to put the awk command in an extra shell script but I assume this to be a bug. My friend Werner Schalk has already posted this to the users mailing list of apache but they said I should use back-slashes (what I did anyway) or to report a bug. Here it is :-) Bye and thanks, Sebastian Wolfgarten
Did you try ExtFilterDefine awk_line_numbering mode=output outtype=text/html cmd="/bin/awk '{print NR\\\": \\\" $N}'" In case the '\' escaping is eating the second double quote? If that's not the workaround, there is a bug in the parser.
This indeed seems to be a bug. parse_cmd in mod_ext_filter.c does not process escaping characters. It sees the first " and scans till it finds the next ". No checks for escape chars. I'll have a fix shortly.
If you need a line numbering ExtFilter urgently you can use pr without getting into escaping issues: ExtFilterDefine pr_line_numbering cmd="/usr/bin/pr -n -t"
This was fixed earlier today (go Paul!). I just verified that this cmd= parameter yields a filter that prefixes the response with line numbers: cmd="/bin/awk '{print NR\": \" $N}'" To pick up the fix, you need a new modules/experimental/mod_ext_filter.c and a new srclib/apr/strings/apr_cpystrn.c. This will all be in the next release of Apache 2.0.x. Thanks for your report, and thanks for using Apache.
*** Bug 11794 has been marked as a duplicate of this bug. ***