RE: [mp2][QUESTION]: Filter to modify request headers on a proxy server

2003-09-19 Thread Pringle, Chris (HP-PSG)
Hi,

I've just tried that script again (see link below) using a POST request.
In the error log file, there is the content of the POST Request e.g.
user=cpringlepassword=x but nothing else. There is no HTTP headers.
My Apache directive to enable the filter is

PerlInputFilterHandler iPAQApache::ResetBrowser

Is this the correct directive?


   _/***
* _/   **Chris Pringle**
 _/ *Industrial Trainee   **
*** _/_/_/ _/_/_/   *Personal Systems Group (PSG) **
***_/  _/ _/  _/*Hewlett Packard - Bristol**
***   _/  _/ _/_/_/ * **
_/ INVENT  **Tel   - +44 (0) 117 31 29664 **
** _/Email - [EMAIL PROTECTED] **
***   _/   * 



-Original Message-
From: Stas Bekman [mailto:[EMAIL PROTECTED] 
Sent: 18 September 2003 11:37
To: Pringle, Chris (HP-PSG)
Cc: [EMAIL PROTECTED]
Subject: Re: [mp2][QUESTION]: Filter to modify request headers on a
proxy server


Pringle, Chris (HP-PSG) wrote:
 Hi,
 
 I am trying to write a filter that will sit on a proxy server and
 alter HTTP requests. Basically, what I want it to do is modify the 
 User-Agent header field so that when the request is proxied, the 
 remote web server gets a different User-Agent header field to the one 
 that was originally sent by the browser. There are also other header 
 fields I may need to modify, but I would imagine this is a simple task

 once I've worked out how to alter the User-Agent field.
 
 Does anyone have any ideas how I might go about doing this? I've tried
 writing several PerlInputFilterHandlers, all with no success. Will 
 input filters work with a proxy? I've got output filters working with 
 no problem.
 
 Any sample code to do what I want, along with the relavent Apache
 directives would be very  much appreciated!

The sample code that you need is here:
http://perl.apache.org/docs/2.0/user/handlers/filters.html#Connection_In
put_Filters

I haven't tried to mix filters with proxy, but I see no reason why
shouldn't 
it work. It might not work if proxy is implemented as a filter itself
and is 
running before the modperl filters, need to look at the actual
implementation.

__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com



Re: [mp2][QUESTION]: Filter to modify request headers on a proxy server

2003-09-19 Thread Stas Bekman
Pringle, Chris (HP-PSG) wrote:
Hi,

I've just tried that script again (see link below) using a POST request.
In the error log file, there is the content of the POST Request e.g.
user=cpringlepassword=x but nothing else. There is no HTTP headers.
My Apache directive to enable the filter is
PerlInputFilterHandler iPAQApache::ResetBrowser

Is this the correct directive?
The directive is correct, but you don't show your code and your config, so I 
have no idea if the rest is correct or not. This directive is used to 
configure both, connection and request level filters. It's the attribute of 
the handler subroutine is what makes the difference and the placement in 
httpd.conf.

You need to declare it as:

package iPAQApache::ResetBrowser;
use base qw(Apache::Filter);
sub handler : FilterConnectionHandler { your code is here }
1;
and you need to put it outside of Location or similar block in httpd.conf 
just like shown at:
http://perl.apache.org/docs/2.0/user/handlers/filters.html#Connection_Input_Filters

Also make sure that you run at least mod_perl 1.99_09, or even better the 
current cvs. And in the future please follow the info at 
http://perl.apache.org/bugs/ so we know more about your setup.

__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


RE: [mp2][QUESTION]: Filter to modify request headers on a proxy server

2003-09-19 Thread Pringle, Chris (HP-PSG)
Thanks for this. I had put 'PerlInputFilterHandler
iPAQApache::ResetBrowser' inside the proxy block, and it should have
been outside like you said.


   _/***
* _/   **Chris Pringle**
 _/ *Industrial Trainee   **
*** _/_/_/ _/_/_/   *Personal Systems Group (PSG) **
***_/  _/ _/  _/*Hewlett Packard - Bristol**
***   _/  _/ _/_/_/ * **
_/ INVENT  **Tel   - +44 (0) 117 31 29664 **
** _/Email - [EMAIL PROTECTED] **
***   _/   * 



 PerlInputFilterHandler iPAQApache::ResetBrowser
 
 Is this the correct directive?

The directive is correct, but you don't show your code and your config,
so I 
have no idea if the rest is correct or not. This directive is used to 
configure both, connection and request level filters. It's the attribute
of 
the handler subroutine is what makes the difference and the placement in

httpd.conf.

You need to declare it as:

package iPAQApache::ResetBrowser;
use base qw(Apache::Filter);
sub handler : FilterConnectionHandler { your code is here }
1;

and you need to put it outside of Location or similar block in
httpd.conf 
just like shown at:
http://perl.apache.org/docs/2.0/user/handlers/filters.html#Connection_In
put_Filters

Also make sure that you run at least mod_perl 1.99_09, or even better
the 
current cvs. And in the future please follow the info at 
http://perl.apache.org/bugs/ so we know more about your setup.

__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com



Re: [mp2][QUESTION]: Filter to modify request headers on a proxy server

2003-09-19 Thread Stas Bekman
Pringle, Chris (HP-PSG) wrote:
Thanks for this. I had put 'PerlInputFilterHandler
iPAQApache::ResetBrowser' inside the proxy block, and it should have
been outside like you said.
So it did work this time, right? Perhaps we should issue a warning if a 
connection filter is found insider Location or alike.

PerlInputFilterHandler iPAQApache::ResetBrowser

Is this the correct directive?


The directive is correct, but you don't show your code and your config,
so I 
have no idea if the rest is correct or not. This directive is used to 
configure both, connection and request level filters. It's the attribute
of 
the handler subroutine is what makes the difference and the placement in

httpd.conf.

You need to declare it as:

package iPAQApache::ResetBrowser;
use base qw(Apache::Filter);
sub handler : FilterConnectionHandler { your code is here }
1;
and you need to put it outside of Location or similar block in
httpd.conf 
just like shown at:
http://perl.apache.org/docs/2.0/user/handlers/filters.html#Connection_In
put_Filters

Also make sure that you run at least mod_perl 1.99_09, or even better
the 
current cvs. And in the future please follow the info at 
http://perl.apache.org/bugs/ so we know more about your setup.
__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: Use of Apache::Directive in BEGIN block

2003-09-19 Thread Matisse Enzer
Title: Re: Use of Apache::Directive in BEGIN
block


Thank you very much.
I had looked at
http://perl.apache.org/docs/2.0/user/help/help.html, but did
not see the instructions about running t/REPORT

I will certainly use t/REPORT in the future until mp2bug is part
of the distro.

Perhaps that instruction could be more, um, blatant?

At 3:03 PM -0700 9/18/03, Stas Bekman wrote:
Matisse, your bug report is incomplete,
you have missed the report about your environment as explained at the
guidelines (http://perl.apache.org/bugs/). In the future please
include it, it's probably unimportant for this case.

To address this issue upgrade to 1.99_09 or may be you even need the
current cvs, I don't remember when Philippe has fixed that, check the
Changes file.
t/response/TestApache/conftree.pm does
the testing of this feature and works just fine in the current
cvs.

-- 

--
Matisse Enzer
Hamilton Partners
707-431-4300 ext. 212 (office)
415-225-6703 (mobile)



Re: Use of Apache::Directive in BEGIN block

2003-09-19 Thread Stas Bekman
Matisse Enzer wrote:
Thank you very much.
So does it work now?

I had looked at http://perl.apache.org/docs/2.0/user/help/help.html, but 
did not see the instructions about running  t/REPORT
You mean, you missed it, since it's there:
http://perl.apache.org/docs/2.0/user/help/help.html#Important_Information
I will certainly use t/REPORT in the future until mp2bug is part of the 
distro.
it's actually in the distro (outdated META tag), i just need to make it 
working before 'make install', as now it works only post 'make install'.

Perhaps that instruction could be more, um, blatant?
patches to improve things are always welcome.

__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


[Fwd: Re: Perl 5.8.1 and mod_perl2 and FreeBSD]

2003-09-19 Thread Stas Bekman
FYI

 Original Message 
Date: Fri, 19 Sep 2003 10:44:13 +0800
From: Autrijus Tang [EMAIL PROTECTED]
To: John Peacock [EMAIL PROTECTED]
CC: Perl 5 Porters [EMAIL PROTECTED]
 ??, 2003-09-19 00:05, John Peacock 
What is the status of thread support on FreeBSD vis-a-vis Perl?  There is some 
comment on the Installing mod_perl 2.0 web page that seems to suggest that the 
thread support by FreeBSD is unstable.  Is that still true?  Am I going to be 
sorry if I try this?
My production servers runs with that exact setup (FreeBSD, maintperl,
mod_perl2, svn, mason) without any problems.  The trick is simple: do
*not* use threads; build a non-threaded perl, and avoid using a threaded
MPM.
Thanks,
/Autrijus/


signature.asc
Description: PGP signature


Re: Use of Apache::Directive in BEGIN block

2003-09-19 Thread Matisse Enzer
At 11:19 AM -0700 9/19/03, Stas Bekman wrote:
Matisse Enzer wrote:
Thank you very much.
So does it work now?


 I wasn't able to get 1.99_09 to install.



-8-- Start Bug Report 8--
1. Problem Description:
   make install

for 1.99_09 failed with:

cp xs/modperl_xs_sv_convert.h xs/modperl_xs_typedefs.h xs/modperl_xs_util.h
cp: copying multiple files, but last argument `xs/modperl_xs_util.h' 
is not a directory
Try `cp --help' for more information.
make: *** [modperl_xs_h_install] Error 1



2. Used Components and their Configuration:

*** using lib/Apache/BuildConfig.pm
*** Makefile.PL options:
  MP_COMPAT_1X   = 1
  MP_GENERATE_XS = 1
  MP_LIBNAME = mod_perl
  MP_USE_DSO = 1
  MP_USE_STATIC  = 1
*** /usr/local/apache2/bin/httpd -V
Server version: Apache/2.0.45
Server built:   May  6 2003 14:05:29
Server's Module Magic Number: 20020903:0
Architecture:   32-bit
Server compiled with
 -D APACHE_MPM_DIR=server/mpm/prefork
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D APR_USE_SYSVSEM_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D HTTPD_ROOT=/usr/local/apache2
 -D SUEXEC_BIN=/usr/local/apache2/bin/suexec
 -D DEFAULT_PIDLOG=logs/httpd.pid
 -D DEFAULT_SCOREBOARD=logs/apache_runtime_status
 -D DEFAULT_LOCKFILE=logs/accept.lock
 -D DEFAULT_ERRORLOG=logs/error_log
 -D AP_TYPES_CONFIG_FILE=conf/mime.types
 -D SERVER_CONFIG_FILE=conf/httpd.conf
*** /usr/bin/perl -V
Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration:
  Platform:
osname=linux, osvers=2.4.18-11smp, archname=i386-linux-thread-multi
uname='linux daffy.perf.redhat.com 2.4.18-11smp #1 smp thu aug 15 
06:41:59 edt 2002 i686 i686 i386 gnulinux '
config_args='-des -Doptimize=-O2 -march=i386 -mcpu=i686 
-Dmyhostname=localhost [EMAIL PROTECTED] -Dcc=gcc 
-Dcf_by=Red Hat, Inc. -Dinstallprefix=/usr -Dprefix=/usr 
-Darchname=i386-linux -Dvendorprefix=/usr -Dsiteprefix=/usr 
-Duseshrplib -Dusethreads -Duseithreads -Duselargefiles -Dd_dosuid 
-Dd_semctl_semun -Di_db -Ui_ndbm -Di_gdbm -Di_shadow -Di_syslog 
-Dman3ext=3pm -Duseperlio -Dinstallusrbinperl -Ubincompat5005 
-Uversiononly -Dpager=/usr/bin/less -isr'
hint=recommended, useposix=true, d_sigaction=define
usethreads=define use5005threads=undef useithreads=define 
usemultiplicity=define
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
  Compiler:
cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE 
-fno-strict-aliasing -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 
-I/usr/include/gdbm',
optimize='-O2 -march=i386 -mcpu=i686',
cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing 
-I/usr/include/gdbm'
ccversion='', gccversion='3.2 20020822 (Red Hat Linux Rawhide 
3.2-5)', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, 
Off_t='off_t', lseeksize=8
alignbytes=4, prototype=define
  Linker and Libraries:
ld='gcc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lnsl -lgdbm -ldb -ldl -lm -lpthread -lc -lcrypt -lutil
perllibs=-lnsl -ldl -lm -lpthread -lc -lcrypt -lutil
libc=/lib/libc-2.2.92.so, so=so, useshrplib=true, libperl=libperl.so
gnulibc_version='2.2.92'
  Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, 
ccdlflags='-rdynamic 
-Wl,-rpath,/usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE'
cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Characteristics of this binary (from libperl):
  Compile-time options: MULTIPLICITY USE_ITHREADS USE_LARGE_FILES 
PERL_IMPLICIT_CONTEXT
  Built under linux
  Compiled at Sep  1 2002 23:56:49
  %ENV:
PERL_LWP_USE_HTTP_10=1
  @INC:
/usr/lib/perl5/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/5.8.0
/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.0
/usr/lib/perl5/site_perl
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.0
/usr/lib/perl5/vendor_perl
.

3. This is the core dump trace: (if you get a core dump):

  [CORE TRACE COMES HERE]

This report was generated by t/REPORT on Fri Sep 19 19:40:52 2003 GMT.

-8-- End Bug Report --8--



--
--
Matisse Enzer
Hamilton Partners
707-431-4300 ext. 212 (office)
415-225-6703 (mobile)


message type 0x49 arrived from server while idle

2003-09-19 Thread Tobias Kremer
I have developed an application based on Apache 1.3.27,
mod_perl 1.27, Postgres 7.3.2, Class::DBI 0.94 (utilizes
Ima::DBI) on SuSE Linux 7.0 with a 2.4.20 kernel.

I already posted my problem to the Class::DBI userlist
but unfortunately didn't get any answers yet so I'm trying
my luck here hoping that somebody can help.

The problem described below is very similar to the one
posted by David Wheeler (of bricolage fame) some time ago
(Topic mod_perl + Apache 1.3.28,
http://www.gossamer-threads.com/perl/mailarc/gforum.cgi?post=75733;search_string=0x49;guest=1213631t=search_engine#75733)

Here we go:
The problem is that everytime more than one request at
a time is made to the server I find the following error message
in my logs and from then on apache seems to be stalled and is
unable to process any further requests:
message type 0x49 arrived from server while idle

Nobody seems to have seen this error message before (I grep'd
through my perl lib dir and found nothing). 

It seems to have got something to do with many apache children
accessing the postgres database (I'm using Apache::DBI but also
tried without it) because the problems are completely gone when
starting apache in single-process mode.

I'm really stuck with this problem and have absolutely no clue
where to look. I tried building some stripped-down scripts to
reproduce the error in a smaller environment but strangely that
always worked.

I'd be very grateful if somebody here could share some ideas on
this. The solution David and others found is not applicable to
my problem because I'm already running apache 1.3.27 (not 1.3.28
which seems to be causing this trouble)

Thank you very much in advance!

-- 
Cheers,
Tobias

---
http://www.funkreich.de // may the funk be with you


Re: Use of Apache::Directive in BEGIN block

2003-09-19 Thread Stas Bekman
Matisse Enzer wrote:
At 11:19 AM -0700 9/19/03, Stas Bekman wrote:

Matisse Enzer wrote:

Thank you very much.


So does it work now?


 I wasn't able to get 1.99_09 to install.



-8-- Start Bug Report 8--
1. Problem Description:
   make install

for 1.99_09 failed with:

cp xs/modperl_xs_sv_convert.h xs/modperl_xs_typedefs.h xs/modperl_xs_util.h
cp: copying multiple files, but last argument `xs/modperl_xs_util.h' is 
not a directory
Try `cp --help' for more information.
make: *** [modperl_xs_h_install] Error 1
[...]
2. Used Components and their Configuration:

*** using lib/Apache/BuildConfig.pm
*** Makefile.PL options:
  MP_COMPAT_1X   = 1
  MP_GENERATE_XS = 1
  MP_LIBNAME = mod_perl
  MP_USE_DSO = 1
  MP_USE_STATIC  = 1
Cool, MODPERL_AP_INCLUDEDIR in your top level Makefile is not set.

Can you please try with the cvs version first:
http://perl.apache.org/download/source.html#Development_mod_perl_2_0_Source_Distribution
and if it still doesn't work, please try with this patch, which should go in 
in any case:

Index: Makefile.PL
===
RCS file: /home/cvs/modperl-2.0/Makefile.PL,v
retrieving revision 1.124
diff -u -r1.124 Makefile.PL
--- Makefile.PL 26 Aug 2003 22:22:15 -  1.124
+++ Makefile.PL 19 Sep 2003 21:27:30 -
@@ -71,7 +71,7 @@
 MODPERL_LIBMAKE= '$(MAKE) -f $(MODPERL_MAKEFILE)',
 PERL   = $build-perl_config('perlpath'),
 MOD_INSTALL= ModPerl::BuildMM::mod_install(),
-MODPERL_AP_INCLUDEDIR  = $build-apxs('-q' = 'INCLUDEDIR'),
+MODPERL_AP_INCLUDEDIR  = $build-ap_includedir(),
 MODPERL_XS_H_FILES = join( \\\n\t, @xs_h_files),
 },
 clean = {
__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: message type 0x49 arrived from server while idle

2003-09-19 Thread Ged Haywood
Hi there,

On Fri, 19 Sep 2003, Tobias Kremer wrote:

 I have developed an application based on Apache 1.3.27,
 mod_perl 1.27, Postgres 7.3.2, Class::DBI 0.94 (utilizes
 Ima::DBI) on SuSE Linux 7.0 with a 2.4.20 kernel.
 
 The problem is that everytime more than one request at
 a time is made to the server I find the following error message
 in my logs and from then on apache seems to be stalled and is
 unable to process any further requests:
 message type 0x49 arrived from server while idle

 Nobody seems to have seen this error message before (I grep'd
 through my perl lib dir and found nothing). 

I think it's from Postgres, not Perl.  Try Googling for

message type arrived from server while idle

 It seems to have got something to do with many apache children
 accessing the postgres database

I'm sure that's right, I think you're confusing Postgres somehow.
There are suspicions about threads in some of the messages that Google
found with the query above.  I've never used Postgres so I wouldn't
know where to point you, but have you checked the Postgres docs for
that message?  There are a few references such as this

http://developer.postgresql.org/docs/pgsql/src/interfaces/libpq/fe-protocol3.c

fairly late on in the Google results.

 The solution David and others found is not applicable to my problem
 because I'm already running apache 1.3.27 (not 1.3.28 which seems to
 be causing this trouble)

I'm not sure I understand what you're saying here.  At the beginning
of your message it looked like you were using 1.3.27, not 1.3.28.
Are you saying that the problem is present with a 1.3.27 Apache but
not with 1.3.28?  If so then could you not simply stay with 1.3.27?

73,
Ged.