You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Marcos Mendez <ma...@gmail.com> on 2009/10/21 16:56:15 UTC

[users@httpd] mod_ext_filter cmd output is garbage

Hi,

I'm having problem running anything other than the sample sed command
used with ext_filter in the documentation (eg cmd="/bin/sed
s/verdana/aria/g"). When I try to run a script (sh, bash, or php) I
always get (binary) garbage in the output. Any ideas?

My filters are defined as:

ExtFilterDefine myfilter1 mode=output intype=text/html
cmd="/usr/bin/php -f /etc/apache2/script1.php"
ExtFilterDefine myfilter2 mode=output intype=text/html cmd="/bin/sh -f
/etc/apache2/script2.sh"
ExtFilterDefine myfilter3 mode=output intype=text/html
cmd="/etc/apache2/script3.sh"

Regards,

Marcos

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_ext_filter cmd output is garbage

Posted by Marcos Mendez <ma...@gmail.com>.
Thanks Andre. I got Substitute working in no time. :)

On Wed, Oct 21, 2009 at 6:32 PM, André Warnier <aw...@ice-sa.com> wrote:
> I'll continue to top-post..
>
> I really don't know enough about how mod_proxy handles things in the forward
> direction, to be able to help more.  I see a mod_deflate somewhere in your
> log, indicating that some compression is taking place, but I don't know if
> that's before or after your filter comes into play.
>
> Only one thing : the response from the remote server may be text/html (in
> the Content-type header), but it may also be compressed (as per the
> Transfer-encoding header). I don't know if mod_proxy, per se, would always
> decompress it before passing it to, or through, your filter.
> If not, then your filter may be seeing alternatively uncompressed and
> compressed html pages; and your example sed filter may just have been
> "lucky", and happened to run only on uncompressed stuff.
>
> For the charset and encoding, you have to look at the possible "charset"
> attribute in the Content-type.  There also, you may have been lucky :
> characters in the strict US-ASCII printable range have the same encoding in
> iso-8859-1 (the default in http) as in UTF-8 (a single byte per character,
> and the same value indidentally).  But if you ever got html pages with these
> funny accented non-English characters, that would no longer be the case, and
> your s/foo/bar/ stuff may create a real mess.
>
> And we haven't even started talking about chunked encoding here...
>
> All in all, for this kind of usage, and supposing that all you are trying to
> do is to add some kind of footer or so to incoming html pages, even for that
> you would really need to
> a) parse the incoming html into some kind of memory structure
> b) insert your stuff where appropriate in the structure
> c) re-assemble the html before forwarding it to the client
> I am not sure that the investment to do that is really worth it for your
> expected benefit.
>
> By the way, have you looked at :
> http://httpd.apache.org/docs/2.2/mod/mod_substitute.html
> (but I'm not sure even that one takes charsets into account).
> and maybe also
> http://httpd.apache.org/docs/2.2/mod/mod_charset_lite.html
>
> I also remember vaguely that there was a module which really allowed to
> modify html content on the way out, but I don't find it in the list of
> standard Apache 2.2 modules.
>
>
> Marcos Mendez wrote:
>>
>> Yes absolutely. I've setup a forward proxy, where I have to open a
>> port (8080) for people to use it. I've set the filter type to
>> text/html. So I guess it's definately an encoding issue. Any way how
>> to solve that? Strangely enough, the sed filter examples work no
>> matter what. So I don't understand why this doesn't.
>>
>> I'm including the log output for the request...
>>
> ...
>
>> [Wed Oct 21 17:25:31 2009] [debug] mod_ext_filter.c(628): [client
>> 172.16.1.199] filtering `http://skyblender.com/' of type `text/html'
>> through `/etc/apache2/simple.php', cfg ExtFilterOptions DebugLevel=10
>> NoLogStderr !PreserveContentLength ExtFilterInType text/html
>> ExtFilterOuttype (unchanged)
>
> ...
>>
>> [Wed Oct 21 17:25:31 2009] [debug] mod_deflate.c(619): [client
>> 172.16.1.199] Zlib: Compressed 531 to 362 : URL http://skyblender.com/
>> [Wed Oct 21 17:25:31 2009] [debug] mod_proxy_http.c(1807): proxy: end body
>> send
>> [Wed Oct 21 17:25:31 2009] [debug] proxy_util.c(2009): proxy: HTTP:
>> has released connection for (*)
>>
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>  "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_ext_filter cmd output is garbage

Posted by André Warnier <aw...@ice-sa.com>.
I'll continue to top-post..

I really don't know enough about how mod_proxy handles things in the 
forward direction, to be able to help more.  I see a mod_deflate 
somewhere in your log, indicating that some compression is taking place, 
but I don't know if that's before or after your filter comes into play.

Only one thing : the response from the remote server may be text/html 
(in the Content-type header), but it may also be compressed (as per the 
Transfer-encoding header). I don't know if mod_proxy, per se, would 
always decompress it before passing it to, or through, your filter.
If not, then your filter may be seeing alternatively uncompressed and 
compressed html pages; and your example sed filter may just have been 
"lucky", and happened to run only on uncompressed stuff.

For the charset and encoding, you have to look at the possible "charset" 
attribute in the Content-type.  There also, you may have been lucky : 
characters in the strict US-ASCII printable range have the same encoding 
in iso-8859-1 (the default in http) as in UTF-8 (a single byte per 
character, and the same value indidentally).  But if you ever got html 
pages with these funny accented non-English characters, that would no 
longer be the case, and your s/foo/bar/ stuff may create a real mess.

And we haven't even started talking about chunked encoding here...

All in all, for this kind of usage, and supposing that all you are 
trying to do is to add some kind of footer or so to incoming html pages, 
even for that you would really need to
a) parse the incoming html into some kind of memory structure
b) insert your stuff where appropriate in the structure
c) re-assemble the html before forwarding it to the client
I am not sure that the investment to do that is really worth it for your 
expected benefit.

By the way, have you looked at :
http://httpd.apache.org/docs/2.2/mod/mod_substitute.html
(but I'm not sure even that one takes charsets into account).
and maybe also
http://httpd.apache.org/docs/2.2/mod/mod_charset_lite.html

I also remember vaguely that there was a module which really allowed to 
modify html content on the way out, but I don't find it in the list of 
standard Apache 2.2 modules.


Marcos Mendez wrote:
> Yes absolutely. I've setup a forward proxy, where I have to open a
> port (8080) for people to use it. I've set the filter type to
> text/html. So I guess it's definately an encoding issue. Any way how
> to solve that? Strangely enough, the sed filter examples work no
> matter what. So I don't understand why this doesn't.
> 
> I'm including the log output for the request...
> 
...

> [Wed Oct 21 17:25:31 2009] [debug] mod_ext_filter.c(628): [client
> 172.16.1.199] filtering `http://skyblender.com/' of type `text/html'
> through `/etc/apache2/simple.php', cfg ExtFilterOptions DebugLevel=10
> NoLogStderr !PreserveContentLength ExtFilterInType text/html
> ExtFilterOuttype (unchanged)
...
> [Wed Oct 21 17:25:31 2009] [debug] mod_deflate.c(619): [client
> 172.16.1.199] Zlib: Compressed 531 to 362 : URL http://skyblender.com/
> [Wed Oct 21 17:25:31 2009] [debug] mod_proxy_http.c(1807): proxy: end body send
> [Wed Oct 21 17:25:31 2009] [debug] proxy_util.c(2009): proxy: HTTP:
> has released connection for (*)
> 


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_ext_filter cmd output is garbage

Posted by Marcos Mendez <ma...@gmail.com>.
would mod_filter solve this? i'm going to try some changes and see if
that works.

On Wed, Oct 21, 2009 at 5:37 PM, Marcos Mendez <ma...@gmail.com> wrote:
> Yes absolutely. I've setup a forward proxy, where I have to open a
> port (8080) for people to use it. I've set the filter type to
> text/html. So I guess it's definately an encoding issue. Any way how
> to solve that? Strangely enough, the sed filter examples work no
> matter what. So I don't understand why this doesn't.
>
> I'm including the log output for the request...
>
> [Wed Oct 21 17:25:31 2009] [debug] mod_proxy_http.c(56): proxy: HTTP:
> canonicalising URL //skyblender.com/
> [Wed Oct 21 17:25:31 2009] [debug] proxy_util.c(1498): [client
> 172.16.1.199] proxy: *: found forward proxy worker for
> http://skyblender.com/
> [Wed Oct 21 17:25:31 2009] [debug] mod_proxy.c(993): Running scheme
> http handler (attempt 0)
> [Wed Oct 21 17:25:31 2009] [debug] mod_proxy_http.c(1931): proxy:
> HTTP: serving URL http://skyblender.com/
> [Wed Oct 21 17:25:31 2009] [debug] proxy_util.c(1991): proxy: HTTP:
> has acquired connection for (*)
> [Wed Oct 21 17:25:31 2009] [debug] proxy_util.c(2047): proxy:
> connecting http://skyblender.com/ to skyblender.com:80
> [Wed Oct 21 17:25:31 2009] [debug] proxy_util.c(2145): proxy:
> connected / to skyblender.com:80
> [Wed Oct 21 17:25:31 2009] [debug] proxy_util.c(2300): proxy: HTTP:
> fam 2 socket created to connect to *
> [Wed Oct 21 17:25:31 2009] [debug] proxy_util.c(2406): proxy: HTTP:
> connection complete to 97.74.154.241:80 (skyblender.com)
> [Wed Oct 21 17:25:31 2009] [debug] mod_proxy_http.c(1714): proxy:
> start body send
> [Wed Oct 21 17:25:31 2009] [debug] mod_ext_filter.c(628): [client
> 172.16.1.199] filtering `http://skyblender.com/' of type `text/html'
> through `/etc/apache2/simple.php', cfg ExtFilterOptions DebugLevel=10
> NoLogStderr !PreserveContentLength ExtFilterInType text/html
> ExtFilterOuttype (unchanged)
> [Wed Oct 21 17:25:31 2009] [debug] mod_ext_filter.c(820): [client
> 172.16.1.199] (11)Resource temporarily unavailable:
> apr_file_read(child output), len -1
> [Wed Oct 21 17:25:31 2009] [debug] mod_ext_filter.c(820): [client
> 172.16.1.199] apr_file_read(child output), len 5
> [Wed Oct 21 17:25:31 2009] [debug] mod_ext_filter.c(820): [client
> 172.16.1.199] apr_file_read(child output), len 526
> [Wed Oct 21 17:25:31 2009] [debug] mod_ext_filter.c(820): [client
> 172.16.1.199] (70014)End of file found: apr_file_read(child output),
> len -1
> [Wed Oct 21 17:25:31 2009] [debug] mod_deflate.c(619): [client
> 172.16.1.199] Zlib: Compressed 531 to 362 : URL http://skyblender.com/
> [Wed Oct 21 17:25:31 2009] [debug] mod_proxy_http.c(1807): proxy: end body send
> [Wed Oct 21 17:25:31 2009] [debug] proxy_util.c(2009): proxy: HTTP:
> has released connection for (*)
>
> On Wed, Oct 21, 2009 at 5:33 PM, André Warnier <aw...@ice-sa.com> wrote:
>> Now wait, you are talking about a "forward proxy" here ? You mean that the
>> browsers of your network have this one set up as a http proxy, and it goes
>> and gets the pages out there for them, and returns them ?
>>
>> If that's the case, then of course you could have character set issues,
>> unless you parse all the documents on the way back, and figure out
>> a) what kind of data this is (a jpeg image, a css stylesheet ?)
>> b) if it is a "text" type, what character set and encoding it's in
>> c) what kind of transfer encoding may have been used (compressed ?)
>> etc..
>> I don't think that "s/foo/bar/g" will really do it.
>>
>> Marcos Mendez wrote:
>>>
>>> Could it be some output encoding issue (UTF vs ASCII)? Or perhaps
>>> compression issue?
>>>
>>> On Wed, Oct 21, 2009 at 1:19 PM, Marcos Mendez <ma...@gmail.com>
>>> wrote:
>>>>
>>>> I should probably also mention that being through mod_proxy. I've
>>>> setup a transparent proxy and I'm trying to add some content on the
>>>> fly. Just doesn't seem to work with my php script.
>>>>
>>>> --- example proxy conf ---
>>>>
>>>> ExtFilterDefine myfilter1 mode=output intype=text/html
>>>> cmd="/usr/bin/php -f /etc/apache2/script1.php"
>>>>
>>>> <IfModule mod_proxy.c>
>>>> <Proxy *>
>>>> SetOutputFilter myfilter1
>>>> </Proxy>
>>>> </IfModule>
>>>>
>>>> Regards,
>>>>
>>>> Marcos
>>>>
>>>>
>>>> On Wed, Oct 21, 2009 at 12:06 PM, Marcos Mendez <ma...@gmail.com>
>>>> wrote:
>>>>>
>>>>> Heheheh... I doubt my script-writing abilities! Here's a simple php5
>>>>> script to echo the output.
>>>>>
>>>>> <? php
>>>>>
>>>>> $stdin = file_get_contents('php://stdin');
>>>>>
>>>>> print($stdin);
>>>>>
>>>>> ?>
>>>>>
>>>>> I've tried the script with cat sometextfile | php -f test.php and it
>>>>> echoes the standard input.
>>>>>
>>>>> Regards,
>>>>>
>>>>> Marcos
>>>>>
>>>>> On Wed, Oct 21, 2009 at 11:15 AM, André Warnier <aw...@ice-sa.com> wrote:
>>>>>>
>>>>>> Marcos Mendez wrote:
>>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> I'm having problem running anything other than the sample sed command
>>>>>>> used with ext_filter in the documentation (eg cmd="/bin/sed
>>>>>>> s/verdana/aria/g"). When I try to run a script (sh, bash, or php) I
>>>>>>> always get (binary) garbage in the output. Any ideas?
>>>>>>>
>>>>>>> My filters are defined as:
>>>>>>>
>>>>>>> ExtFilterDefine myfilter1 mode=output intype=text/html
>>>>>>> cmd="/usr/bin/php -f /etc/apache2/script1.php"
>>>>>>> ExtFilterDefine myfilter2 mode=output intype=text/html cmd="/bin/sh -f
>>>>>>> /etc/apache2/script2.sh"
>>>>>>> ExtFilterDefine myfilter3 mode=output intype=text/html
>>>>>>> cmd="/etc/apache2/script3.sh"
>>>>>>>
>>>>>> Not that we question your script-writing abilities, but it is a bit
>>>>>> difficult to figure out what happens without actually seeing any of
>>>>>> these
>>>>>> scripts.
>>>>>> Can you create a simple one, try it and show it here ?
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> The official User-To-User support forum of the Apache HTTP Server
>>>>>> Project.
>>>>>> See <URL:http://httpd.apache.org/userslist.html> for more info.
>>>>>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>>>>>>  "   from the digest: users-digest-unsubscribe@httpd.apache.org
>>>>>> For additional commands, e-mail: users-help@httpd.apache.org
>>>>>>
>>>>>>
>>>
>>> ---------------------------------------------------------------------
>>> The official User-To-User support forum of the Apache HTTP Server Project.
>>> See <URL:http://httpd.apache.org/userslist.html> for more info.
>>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>>>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
>>> For additional commands, e-mail: users-help@httpd.apache.org
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> The official User-To-User support forum of the Apache HTTP Server Project.
>> See <URL:http://httpd.apache.org/userslist.html> for more info.
>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>>  "   from the digest: users-digest-unsubscribe@httpd.apache.org
>> For additional commands, e-mail: users-help@httpd.apache.org
>>
>>
>

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_ext_filter cmd output is garbage

Posted by Marcos Mendez <ma...@gmail.com>.
Yes absolutely. I've setup a forward proxy, where I have to open a
port (8080) for people to use it. I've set the filter type to
text/html. So I guess it's definately an encoding issue. Any way how
to solve that? Strangely enough, the sed filter examples work no
matter what. So I don't understand why this doesn't.

I'm including the log output for the request...

[Wed Oct 21 17:25:31 2009] [debug] mod_proxy_http.c(56): proxy: HTTP:
canonicalising URL //skyblender.com/
[Wed Oct 21 17:25:31 2009] [debug] proxy_util.c(1498): [client
172.16.1.199] proxy: *: found forward proxy worker for
http://skyblender.com/
[Wed Oct 21 17:25:31 2009] [debug] mod_proxy.c(993): Running scheme
http handler (attempt 0)
[Wed Oct 21 17:25:31 2009] [debug] mod_proxy_http.c(1931): proxy:
HTTP: serving URL http://skyblender.com/
[Wed Oct 21 17:25:31 2009] [debug] proxy_util.c(1991): proxy: HTTP:
has acquired connection for (*)
[Wed Oct 21 17:25:31 2009] [debug] proxy_util.c(2047): proxy:
connecting http://skyblender.com/ to skyblender.com:80
[Wed Oct 21 17:25:31 2009] [debug] proxy_util.c(2145): proxy:
connected / to skyblender.com:80
[Wed Oct 21 17:25:31 2009] [debug] proxy_util.c(2300): proxy: HTTP:
fam 2 socket created to connect to *
[Wed Oct 21 17:25:31 2009] [debug] proxy_util.c(2406): proxy: HTTP:
connection complete to 97.74.154.241:80 (skyblender.com)
[Wed Oct 21 17:25:31 2009] [debug] mod_proxy_http.c(1714): proxy:
start body send
[Wed Oct 21 17:25:31 2009] [debug] mod_ext_filter.c(628): [client
172.16.1.199] filtering `http://skyblender.com/' of type `text/html'
through `/etc/apache2/simple.php', cfg ExtFilterOptions DebugLevel=10
NoLogStderr !PreserveContentLength ExtFilterInType text/html
ExtFilterOuttype (unchanged)
[Wed Oct 21 17:25:31 2009] [debug] mod_ext_filter.c(820): [client
172.16.1.199] (11)Resource temporarily unavailable:
apr_file_read(child output), len -1
[Wed Oct 21 17:25:31 2009] [debug] mod_ext_filter.c(820): [client
172.16.1.199] apr_file_read(child output), len 5
[Wed Oct 21 17:25:31 2009] [debug] mod_ext_filter.c(820): [client
172.16.1.199] apr_file_read(child output), len 526
[Wed Oct 21 17:25:31 2009] [debug] mod_ext_filter.c(820): [client
172.16.1.199] (70014)End of file found: apr_file_read(child output),
len -1
[Wed Oct 21 17:25:31 2009] [debug] mod_deflate.c(619): [client
172.16.1.199] Zlib: Compressed 531 to 362 : URL http://skyblender.com/
[Wed Oct 21 17:25:31 2009] [debug] mod_proxy_http.c(1807): proxy: end body send
[Wed Oct 21 17:25:31 2009] [debug] proxy_util.c(2009): proxy: HTTP:
has released connection for (*)

On Wed, Oct 21, 2009 at 5:33 PM, André Warnier <aw...@ice-sa.com> wrote:
> Now wait, you are talking about a "forward proxy" here ? You mean that the
> browsers of your network have this one set up as a http proxy, and it goes
> and gets the pages out there for them, and returns them ?
>
> If that's the case, then of course you could have character set issues,
> unless you parse all the documents on the way back, and figure out
> a) what kind of data this is (a jpeg image, a css stylesheet ?)
> b) if it is a "text" type, what character set and encoding it's in
> c) what kind of transfer encoding may have been used (compressed ?)
> etc..
> I don't think that "s/foo/bar/g" will really do it.
>
> Marcos Mendez wrote:
>>
>> Could it be some output encoding issue (UTF vs ASCII)? Or perhaps
>> compression issue?
>>
>> On Wed, Oct 21, 2009 at 1:19 PM, Marcos Mendez <ma...@gmail.com>
>> wrote:
>>>
>>> I should probably also mention that being through mod_proxy. I've
>>> setup a transparent proxy and I'm trying to add some content on the
>>> fly. Just doesn't seem to work with my php script.
>>>
>>> --- example proxy conf ---
>>>
>>> ExtFilterDefine myfilter1 mode=output intype=text/html
>>> cmd="/usr/bin/php -f /etc/apache2/script1.php"
>>>
>>> <IfModule mod_proxy.c>
>>> <Proxy *>
>>> SetOutputFilter myfilter1
>>> </Proxy>
>>> </IfModule>
>>>
>>> Regards,
>>>
>>> Marcos
>>>
>>>
>>> On Wed, Oct 21, 2009 at 12:06 PM, Marcos Mendez <ma...@gmail.com>
>>> wrote:
>>>>
>>>> Heheheh... I doubt my script-writing abilities! Here's a simple php5
>>>> script to echo the output.
>>>>
>>>> <? php
>>>>
>>>> $stdin = file_get_contents('php://stdin');
>>>>
>>>> print($stdin);
>>>>
>>>> ?>
>>>>
>>>> I've tried the script with cat sometextfile | php -f test.php and it
>>>> echoes the standard input.
>>>>
>>>> Regards,
>>>>
>>>> Marcos
>>>>
>>>> On Wed, Oct 21, 2009 at 11:15 AM, André Warnier <aw...@ice-sa.com> wrote:
>>>>>
>>>>> Marcos Mendez wrote:
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I'm having problem running anything other than the sample sed command
>>>>>> used with ext_filter in the documentation (eg cmd="/bin/sed
>>>>>> s/verdana/aria/g"). When I try to run a script (sh, bash, or php) I
>>>>>> always get (binary) garbage in the output. Any ideas?
>>>>>>
>>>>>> My filters are defined as:
>>>>>>
>>>>>> ExtFilterDefine myfilter1 mode=output intype=text/html
>>>>>> cmd="/usr/bin/php -f /etc/apache2/script1.php"
>>>>>> ExtFilterDefine myfilter2 mode=output intype=text/html cmd="/bin/sh -f
>>>>>> /etc/apache2/script2.sh"
>>>>>> ExtFilterDefine myfilter3 mode=output intype=text/html
>>>>>> cmd="/etc/apache2/script3.sh"
>>>>>>
>>>>> Not that we question your script-writing abilities, but it is a bit
>>>>> difficult to figure out what happens without actually seeing any of
>>>>> these
>>>>> scripts.
>>>>> Can you create a simple one, try it and show it here ?
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> The official User-To-User support forum of the Apache HTTP Server
>>>>> Project.
>>>>> See <URL:http://httpd.apache.org/userslist.html> for more info.
>>>>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>>>>>  "   from the digest: users-digest-unsubscribe@httpd.apache.org
>>>>> For additional commands, e-mail: users-help@httpd.apache.org
>>>>>
>>>>>
>>
>> ---------------------------------------------------------------------
>> The official User-To-User support forum of the Apache HTTP Server Project.
>> See <URL:http://httpd.apache.org/userslist.html> for more info.
>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
>> For additional commands, e-mail: users-help@httpd.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>  "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_ext_filter cmd output is garbage

Posted by André Warnier <aw...@ice-sa.com>.
Now wait, you are talking about a "forward proxy" here ? You mean that 
the browsers of your network have this one set up as a http proxy, and 
it goes and gets the pages out there for them, and returns them ?

If that's the case, then of course you could have character set issues, 
unless you parse all the documents on the way back, and figure out
a) what kind of data this is (a jpeg image, a css stylesheet ?)
b) if it is a "text" type, what character set and encoding it's in
c) what kind of transfer encoding may have been used (compressed ?)
etc..
I don't think that "s/foo/bar/g" will really do it.

Marcos Mendez wrote:
> Could it be some output encoding issue (UTF vs ASCII)? Or perhaps
> compression issue?
> 
> On Wed, Oct 21, 2009 at 1:19 PM, Marcos Mendez <ma...@gmail.com> wrote:
>> I should probably also mention that being through mod_proxy. I've
>> setup a transparent proxy and I'm trying to add some content on the
>> fly. Just doesn't seem to work with my php script.
>>
>> --- example proxy conf ---
>>
>> ExtFilterDefine myfilter1 mode=output intype=text/html
>> cmd="/usr/bin/php -f /etc/apache2/script1.php"
>>
>> <IfModule mod_proxy.c>
>> <Proxy *>
>> SetOutputFilter myfilter1
>> </Proxy>
>> </IfModule>
>>
>> Regards,
>>
>> Marcos
>>
>>
>> On Wed, Oct 21, 2009 at 12:06 PM, Marcos Mendez <ma...@gmail.com> wrote:
>>> Heheheh... I doubt my script-writing abilities! Here's a simple php5
>>> script to echo the output.
>>>
>>> <? php
>>>
>>> $stdin = file_get_contents('php://stdin');
>>>
>>> print($stdin);
>>>
>>> ?>
>>>
>>> I've tried the script with cat sometextfile | php -f test.php and it
>>> echoes the standard input.
>>>
>>> Regards,
>>>
>>> Marcos
>>>
>>> On Wed, Oct 21, 2009 at 11:15 AM, André Warnier <aw...@ice-sa.com> wrote:
>>>> Marcos Mendez wrote:
>>>>> Hi,
>>>>>
>>>>> I'm having problem running anything other than the sample sed command
>>>>> used with ext_filter in the documentation (eg cmd="/bin/sed
>>>>> s/verdana/aria/g"). When I try to run a script (sh, bash, or php) I
>>>>> always get (binary) garbage in the output. Any ideas?
>>>>>
>>>>> My filters are defined as:
>>>>>
>>>>> ExtFilterDefine myfilter1 mode=output intype=text/html
>>>>> cmd="/usr/bin/php -f /etc/apache2/script1.php"
>>>>> ExtFilterDefine myfilter2 mode=output intype=text/html cmd="/bin/sh -f
>>>>> /etc/apache2/script2.sh"
>>>>> ExtFilterDefine myfilter3 mode=output intype=text/html
>>>>> cmd="/etc/apache2/script3.sh"
>>>>>
>>>> Not that we question your script-writing abilities, but it is a bit
>>>> difficult to figure out what happens without actually seeing any of these
>>>> scripts.
>>>> Can you create a simple one, try it and show it here ?
>>>>
>>>> ---------------------------------------------------------------------
>>>> The official User-To-User support forum of the Apache HTTP Server Project.
>>>> See <URL:http://httpd.apache.org/userslist.html> for more info.
>>>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>>>>  "   from the digest: users-digest-unsubscribe@httpd.apache.org
>>>> For additional commands, e-mail: users-help@httpd.apache.org
>>>>
>>>>
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 
> 


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_ext_filter cmd output is garbage

Posted by Marcos Mendez <ma...@gmail.com>.
Could it be some output encoding issue (UTF vs ASCII)? Or perhaps
compression issue?

On Wed, Oct 21, 2009 at 1:19 PM, Marcos Mendez <ma...@gmail.com> wrote:
> I should probably also mention that being through mod_proxy. I've
> setup a transparent proxy and I'm trying to add some content on the
> fly. Just doesn't seem to work with my php script.
>
> --- example proxy conf ---
>
> ExtFilterDefine myfilter1 mode=output intype=text/html
> cmd="/usr/bin/php -f /etc/apache2/script1.php"
>
> <IfModule mod_proxy.c>
> <Proxy *>
> SetOutputFilter myfilter1
> </Proxy>
> </IfModule>
>
> Regards,
>
> Marcos
>
>
> On Wed, Oct 21, 2009 at 12:06 PM, Marcos Mendez <ma...@gmail.com> wrote:
>> Heheheh... I doubt my script-writing abilities! Here's a simple php5
>> script to echo the output.
>>
>> <? php
>>
>> $stdin = file_get_contents('php://stdin');
>>
>> print($stdin);
>>
>> ?>
>>
>> I've tried the script with cat sometextfile | php -f test.php and it
>> echoes the standard input.
>>
>> Regards,
>>
>> Marcos
>>
>> On Wed, Oct 21, 2009 at 11:15 AM, André Warnier <aw...@ice-sa.com> wrote:
>>> Marcos Mendez wrote:
>>>>
>>>> Hi,
>>>>
>>>> I'm having problem running anything other than the sample sed command
>>>> used with ext_filter in the documentation (eg cmd="/bin/sed
>>>> s/verdana/aria/g"). When I try to run a script (sh, bash, or php) I
>>>> always get (binary) garbage in the output. Any ideas?
>>>>
>>>> My filters are defined as:
>>>>
>>>> ExtFilterDefine myfilter1 mode=output intype=text/html
>>>> cmd="/usr/bin/php -f /etc/apache2/script1.php"
>>>> ExtFilterDefine myfilter2 mode=output intype=text/html cmd="/bin/sh -f
>>>> /etc/apache2/script2.sh"
>>>> ExtFilterDefine myfilter3 mode=output intype=text/html
>>>> cmd="/etc/apache2/script3.sh"
>>>>
>>> Not that we question your script-writing abilities, but it is a bit
>>> difficult to figure out what happens without actually seeing any of these
>>> scripts.
>>> Can you create a simple one, try it and show it here ?
>>>
>>> ---------------------------------------------------------------------
>>> The official User-To-User support forum of the Apache HTTP Server Project.
>>> See <URL:http://httpd.apache.org/userslist.html> for more info.
>>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>>>  "   from the digest: users-digest-unsubscribe@httpd.apache.org
>>> For additional commands, e-mail: users-help@httpd.apache.org
>>>
>>>
>>
>

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_ext_filter cmd output is garbage

Posted by Marcos Mendez <ma...@gmail.com>.
I should probably also mention that being through mod_proxy. I've
setup a transparent proxy and I'm trying to add some content on the
fly. Just doesn't seem to work with my php script.

--- example proxy conf ---

ExtFilterDefine myfilter1 mode=output intype=text/html
cmd="/usr/bin/php -f /etc/apache2/script1.php"

<IfModule mod_proxy.c>
<Proxy *>
SetOutputFilter myfilter1
</Proxy>
</IfModule>

Regards,

Marcos


On Wed, Oct 21, 2009 at 12:06 PM, Marcos Mendez <ma...@gmail.com> wrote:
> Heheheh... I doubt my script-writing abilities! Here's a simple php5
> script to echo the output.
>
> <? php
>
> $stdin = file_get_contents('php://stdin');
>
> print($stdin);
>
> ?>
>
> I've tried the script with cat sometextfile | php -f test.php and it
> echoes the standard input.
>
> Regards,
>
> Marcos
>
> On Wed, Oct 21, 2009 at 11:15 AM, André Warnier <aw...@ice-sa.com> wrote:
>> Marcos Mendez wrote:
>>>
>>> Hi,
>>>
>>> I'm having problem running anything other than the sample sed command
>>> used with ext_filter in the documentation (eg cmd="/bin/sed
>>> s/verdana/aria/g"). When I try to run a script (sh, bash, or php) I
>>> always get (binary) garbage in the output. Any ideas?
>>>
>>> My filters are defined as:
>>>
>>> ExtFilterDefine myfilter1 mode=output intype=text/html
>>> cmd="/usr/bin/php -f /etc/apache2/script1.php"
>>> ExtFilterDefine myfilter2 mode=output intype=text/html cmd="/bin/sh -f
>>> /etc/apache2/script2.sh"
>>> ExtFilterDefine myfilter3 mode=output intype=text/html
>>> cmd="/etc/apache2/script3.sh"
>>>
>> Not that we question your script-writing abilities, but it is a bit
>> difficult to figure out what happens without actually seeing any of these
>> scripts.
>> Can you create a simple one, try it and show it here ?
>>
>> ---------------------------------------------------------------------
>> The official User-To-User support forum of the Apache HTTP Server Project.
>> See <URL:http://httpd.apache.org/userslist.html> for more info.
>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>>  "   from the digest: users-digest-unsubscribe@httpd.apache.org
>> For additional commands, e-mail: users-help@httpd.apache.org
>>
>>
>

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_ext_filter cmd output is garbage

Posted by Marcos Mendez <ma...@gmail.com>.
Heheheh... I doubt my script-writing abilities! Here's a simple php5
script to echo the output.

<? php

$stdin = file_get_contents('php://stdin');

print($stdin);

?>

I've tried the script with cat sometextfile | php -f test.php and it
echoes the standard input.

Regards,

Marcos

On Wed, Oct 21, 2009 at 11:15 AM, André Warnier <aw...@ice-sa.com> wrote:
> Marcos Mendez wrote:
>>
>> Hi,
>>
>> I'm having problem running anything other than the sample sed command
>> used with ext_filter in the documentation (eg cmd="/bin/sed
>> s/verdana/aria/g"). When I try to run a script (sh, bash, or php) I
>> always get (binary) garbage in the output. Any ideas?
>>
>> My filters are defined as:
>>
>> ExtFilterDefine myfilter1 mode=output intype=text/html
>> cmd="/usr/bin/php -f /etc/apache2/script1.php"
>> ExtFilterDefine myfilter2 mode=output intype=text/html cmd="/bin/sh -f
>> /etc/apache2/script2.sh"
>> ExtFilterDefine myfilter3 mode=output intype=text/html
>> cmd="/etc/apache2/script3.sh"
>>
> Not that we question your script-writing abilities, but it is a bit
> difficult to figure out what happens without actually seeing any of these
> scripts.
> Can you create a simple one, try it and show it here ?
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>  "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_ext_filter cmd output is garbage

Posted by André Warnier <aw...@ice-sa.com>.
Marcos Mendez wrote:
> Hi,
> 
> I'm having problem running anything other than the sample sed command
> used with ext_filter in the documentation (eg cmd="/bin/sed
> s/verdana/aria/g"). When I try to run a script (sh, bash, or php) I
> always get (binary) garbage in the output. Any ideas?
> 
> My filters are defined as:
> 
> ExtFilterDefine myfilter1 mode=output intype=text/html
> cmd="/usr/bin/php -f /etc/apache2/script1.php"
> ExtFilterDefine myfilter2 mode=output intype=text/html cmd="/bin/sh -f
> /etc/apache2/script2.sh"
> ExtFilterDefine myfilter3 mode=output intype=text/html
> cmd="/etc/apache2/script3.sh"
> 
Not that we question your script-writing abilities, but it is a bit 
difficult to figure out what happens without actually seeing any of 
these scripts.
Can you create a simple one, try it and show it here ?

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org