Re: mod_ext_filter cmd output is garbage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx> 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 <marcosrmendez@xxxxxxxxx>
>> 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 <marcosrmendez@xxxxxxxxx>
>>> 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@xxxxxxxxxx> 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@xxxxxxxxxxxxxxxx
>>>>>  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
>>>>> For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx
>>>>>
>>>>>
>>
>> ---------------------------------------------------------------------
>> 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@xxxxxxxxxxxxxxxx
>>   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
>> For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx
>>
>>
>
>
> ---------------------------------------------------------------------
> 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@xxxxxxxxxxxxxxxx
>  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
> For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx
>
>

---------------------------------------------------------------------
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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux