Re: duplicate sockets ? mod-perl 2.0.2, apache 2.2

2007-09-14 Thread Philippe M. Chiasson
Perrin Harkins wrote:
> On 9/13/07, André Warnier <[EMAIL PROTECTED]> wrote:
>> In summary, the problem is that in the authen module I open a tcp
>> connection to an external server *once*, but the server sees *two*
>> connections being opened.
> 
> Any chance you are running that code during startup, before the fork happens?

And that would be caused by the famous/infamous

http://perl.apache.org/docs/2.0/user/handlers/server.html#Start_Immediately_Restarts


Philippe M. Chiasson GPG: F9BFE0C2480E7680 1AE53631CB32A107 88C3A5A5
http://gozer.ectoplasm.org/   m/gozer\@(apache|cpan|ectoplasm)\.org/



signature.asc
Description: OpenPGP digital signature


Re: Problem with perl-status memory usage

2007-09-14 Thread RA Jones

Perrin Harkins wrote:

On 9/13/07, Richard Jones <[EMAIL PROTECTED]> wrote:
  

/opt/lampp/lib/perl5/site_perl/5.8.7/Devel/Symdump.pm



Ok, the next thing to try is a permissions check.  Become the user who
you run your web server as (often "nobody", but I don't know what
XAMPP does) and try to read this file.

- Perrin

  


Yes, user 'nobody' gets a display on 'cat 
/opt/lampp/lib/perl5/site_perl/5.8.7/Devel/Symdump.pm'

--
Richard Jones


Re: duplicate sockets ? mod-perl 2.0.2, apache 2.2

2007-09-14 Thread André Warnier



Philippe M. Chiasson wrote:

Perrin Harkins wrote:

On 9/13/07, André Warnier <[EMAIL PROTECTED]> wrote:

In summary, the problem is that in the authen module I open a tcp
connection to an external server *once*, but the server sees *two*
connections being opened.

Any chance you are running that code during startup, before the fork happens?



I don't think so, but then what do I know ?

The module is mentioned only in the  section mentioned 
earlier, and only as a PerlAuthenHandler.  It is not pre-loaded or 
anything.  There is some unconditional logging in the module, and it 
does not show up when starting/restarting Apache.
The log shows that the module is called when it should, iow when a user 
tries to access the protected area.


This link :
http://ska.dev.wissensbank.com/mod_perl_list/
gives temporary access to pretty much everything relevant : module 
source, apache logfiles, database module log, and a link to trigger the 
authentication and consequent module's execution (which you can follow 
later in the logfiles).


In the basic authentication dialog, you can enter whathever you want, 
the problem happens during the subsequent phase of checking that id.


In the Apache error.log, the first message that appears for a particular 
"click" on the protected link, is

Starting Authtest
That's a very good sign, but it's downhill from there..
(note : for the timestamp, the server in question in in Germany, I guess 
Western European time).


Sigh. I keep on expecting someone will find the absolute beginner 
bloober in my code and shame me, but I would like to understand what 
happens.


Thanks


post data

2007-09-14 Thread Eli Shemer
Hey there.

 

I yesterday compiled and installed  apache2  on our company's server but
it's currently on port 8080 for further testing.

I'm currently updating our perl code to run natural mod_perl 2 code and
there's something I've stumbled upon.

 

Usually what we do is grep the POST data using the apache request's content
method which I see is no more available.

 

$r = Apache->request();

 %params = $r->method eq 'POST' ? $r->content : $r->args; 

This is unusable code now days I gather.

 

Currently I'm using Apache::RequestRec in my tests but it only supports the
args method which doesn't fit my needs, cross project.

 

I've read through the docs and saw that I have two available options:

1.   using libapreq's Apache2::Request And then something like
$apr->param('var') would work.

2.   using Apache2::RequestIO directly and it's read method. Which seems
a bit dirty.

 

I would appreciate if someone could provide some more information and
possibly suggest the preferred way of doing this, before I implement it to
all of the files.

 

Thanks a lot.

 



Re: post data

2007-09-14 Thread Jim Brandt
In the mod_perl 2 book, I believe we recommend using your first option, 
which is the param method from Apache2::Request.


Jim


Eli Shemer wrote:

Hey there.

 

I yesterday compiled and installed  apache2  on our company's server but 
it's currently on port 8080 for further testing.


I'm currently updating our perl code to run natural mod_perl 2 code and 
there's something I've stumbled upon.


 

Usually what we do is grep the POST data using the apache request's 
content method which I see is no more available.


 


$r = Apache->request();

 %params = $r->method eq 'POST' ? $r->content : $r->args;

This is unusable code now days I gather.

 

Currently I'm using Apache::RequestRec in my tests but it only supports 
the args method which doesn’t fit my needs, cross project.


 


I've read through the docs and saw that I have two available options:

1.   using libapreq's Apache2::Request And then something like 
$apr->param('var') would work.


2.   using Apache2::RequestIO directly and it's read method. Which 
seems a bit dirty.


 

I would appreciate if someone could provide some more information and 
possibly suggest the preferred way of doing this, before I implement it 
to all of the files.


 


Thanks a lot.

 



--
Jim Brandt
Administrative Computing Services
University at Buffalo



Re: post data

2007-09-14 Thread André Warnier


Currently I'm using Apache::RequestRec in my tests but it only supports the
args method which doesn't fit my needs, cross project.


 > I've read through the docs and saw that I have two available options:


1.   using libapreq's Apache2::Request And then something like
$apr->param('var') would work.

2.   using Apache2::RequestIO directly and it's read method. Which seems
a bit dirty.

I believe you can also use the CGI.pm module. It provides several ways 
to get at the POST arguments.


You start with something like
my $r = shift;
my $Post = CGI->new($r);


Then you can use $Post->args() etc...

Hope this helps.


resend: Bug report re: Apache 2.2.6 on Windows

2007-09-14 Thread Tom Donovan

 Original Message 
Subject: Bug report
Date: Fri, 14 Sep 2007 10:27:19 -0400
From: Tom Donovan <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: modperl@perl.apache.org

-8<-- Start Bug Report 8<--
1. Problem Description:

  perl-script handler fails with Apache 2.2.6 on Windows
  due to changes in stdin/stdout/stderr handles in mpm_winnt

  Problem occurs with mod_perl 2.0.3 or with
 current (9/14/2007) SVN trunk.

  Problem is not seen if Apache is started as a single process
 > httpd.exe -X

  This is similar to, but not the same as, Apache bug 43329
http://issues.apache.org/bugzilla/show_bug.cgi?id=43329
  which concerns the APR 1.2.11 process-creation changes.

  This problem can be avoided if \server\mpm\winnt\mpm_winnt.c
  from Apache 2.2.4 is used - even with APR 1.2.11.
  Note that server\log.c line 411 also needs to be changed to
  work with this older mpm_winnt.

  Failure is at line 128 in modperl_io.c
(function modperl_io_perlio_override_stdin)

modperl_io.c - in function modperl_io_perlio_override_stdin
124/* open my $oldout, "<&STDIN" or die "Can't dup STDIN:
125status = do_open(handle_save, "<&STDIN", 7, FALSE,
126 O_RDONLY, 0, Nullfp);
127if (status == 0) {

128Perl_croak(aTHX_ "Failed to dup STDIN: %" SVf,

129}
-

2. Used Components and their Configuration:

*** mod_perl version 2.04

*** using C:\work\mod_perl-trunk\lib\Apache2\BuildConfig.pm

*** Makefile.PL options:
  MP_APR_LIB => aprext
  MP_COMPAT_1X   => 1
  MP_GENERATE_XS => 1
  MP_LIBNAME => mod_perl
  MP_USE_DSO => 1


*** httpd.exe -V
Server version: Apache/2.2.6 (Win32)
Server built:   Sep 14 2007 09:44:55
Server's Module Magic Number: 20051115:5
Server loaded:  APR 1.2.11, APR-Util 1.2.10
Compiled using: APR 1.2.11, APR-Util 1.2.10
Architecture:   32-bit
Server MPM: WinNT
  threaded: yes (fixed thread count)
forked: no
Server compiled with
 -D APACHE_MPM_DIR="server/mpm/winnt"
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D DYNAMIC_MODULE_LIMIT=128
 -D HTTPD_ROOT="/apache"
 -D SUEXEC_BIN="/apache/bin/suexec"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_ERRORLOG="logs/error.log"
 -D AP_TYPES_CONFIG_FILE="conf/mime.types"
 -D SERVER_CONFIG_FILE="conf/httpd.conf"


*** (apr|apu)-config linking info

(apr|apu)-config scripts were not found



*** C:\Perl\bin\perl.exe -V
Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
  Platform:
osname=MSWin32, osvers=5.00, archname=MSWin32-x86-multi-thread
uname=''
config_args='undef'
hint=recommended, useposix=true, d_sigaction=undef
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='cl', ccflags ='-nologo -GF -W3 -MD -Zi -DNDEBUG -O1 -DWIN32
-D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT -DNO_HASH_SEED
-DUSE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS
-DUSE_PERLIO -DPERL_MSVCRT_READFIX',
optimize='-MD -Zi -DNDEBUG -O1',
cppflags='-DWIN32'
ccversion='12.00.8804', gccversion='', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10
ivtype='long', ivsize=4, nvtype='double', nvsize=8,
Off_t='__int64', lseeksize=8
alignbytes=8, prototype=define
  Linker and Libraries:
ld='link', ldflags ='-nologo -nodefaultlib -debug -opt:ref,icf
-libpath:"C:\Perl\lib\CORE"  -machine:x86'
libpth=\lib
libs=  oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib
 comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib
netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib  version.lib
odbc32.lib odbccp32.lib msvcrt.lib
perllibs=  oldnames.lib kernel32.lib user32.lib gdi32.lib
winspool.lib  comdlg32.lib advapi32.lib shell32.lib ole32.lib
oleaut32.lib  netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib
version.lib odbc32.lib odbccp32.lib msvcrt.lib
libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl58.lib
gnulibc_version=''
  Dynamic Linking:
dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug
-opt:ref,icf  -libpath:"C:\Perl\lib\CORE"  -machine:x86'


Characteristics of this binary (from libperl):
  Compile-time options: MULTIPLICITY PERL_IMPLICIT_CONTEXT
PERL_IMPLICIT_SYS PERL_MALLOC_WRAP
PL_OP_SLAB_ALLOC USE_ITHREADS USE_LARGE_FILES
USE_PERLIO USE_SITECUSTOMIZE
  Locall

apr

2007-09-14 Thread Eli Shemer
Hey again

Once I add the apr object I get no error but I also receive no output on the
screen.

Any thoughts ?

 

#!/usr/bin/perl

use Apache2::Request; 

 

my $r=Apache2::RequestRec;

#my $apr = Apache2::Request->new($r);

$r->content_type('text/html'); 

$r->headers_out(); 

print "bla";



Re: apr

2007-09-14 Thread Perrin Harkins
On 9/14/07, Eli Shemer <[EMAIL PROTECTED]> wrote:
> Once I add the apr object I get no error but I also receive no output on the
> screen.

What are you trying to do?  You can't use the mod_perl stuff in a
command-line script outside of mod_perl.

> my $r=Apache2::RequestRec;

What does that do?  Is it assigning the string "Apache2::RequestRec"
to $r?  It's not calling any method.  You should get $r passed in to
your handler.

- Perrin


Re: Problem with perl-status memory usage

2007-09-14 Thread Perrin Harkins
On 9/14/07, RA Jones <[EMAIL PROTECTED]> wrote:
> Yes, user 'nobody' gets a display on 'cat
> /opt/lampp/lib/perl5/site_perl/5.8.7/Devel/Symdump.pm'

Okay, can you try making your own mod_perl handler that loads
Devel::Symdump and see if it works?

- Perrin


Re: resend: Bug report re: Apache 2.2.6 on Windows

2007-09-14 Thread William A. Rowe, Jr.
Tom Donovan wrote:
> 
> -8<-- Start Bug Report 8<--
> 1. Problem Description:
> 
>   perl-script handler fails with Apache 2.2.6 on Windows
>   due to changes in stdin/stdout/stderr handles in mpm_winnt
> 
>   Problem occurs with mod_perl 2.0.3 or with
>  current (9/14/2007) SVN trunk.

>   This is similar to, but not the same as, Apache bug 43329
> http://issues.apache.org/bugzilla/show_bug.cgi?id=43329
>   which concerns the APR 1.2.11 process-creation changes.
> 
>   This problem can be avoided if \server\mpm\winnt\mpm_winnt.c
>   from Apache 2.2.4 is used - even with APR 1.2.11.

Yes; definately a different problem although a side effect of the same
attempt to fix the issue.  What is interesting

>   Failure is at line 128 in modperl_io.c
> (function modperl_io_perlio_override_stdin)
> 
> modperl_io.c - in function modperl_io_perlio_override_stdin
> 124/* open my $oldout, "<&STDIN" or die "Can't dup STDIN:
> 125status = do_open(handle_save, "<&STDIN", 7, FALSE,
> 126 O_RDONLY, 0, Nullfp);
> 127if (status == 0) {
 128Perl_croak(aTHX_ "Failed to dup STDIN: %" SVf,

is that mod perl is attempting to protect us from ourselves even before
the fixes went into win32.  Of all of the adjustments in version 2.2.6,
try backing out only this single effect of the patch, which closed stdin
on both the parent and child, and please confirm if this alone is enough
to placate mod_perl?  (This would be patch -R to revert the following.)

--- httpd/httpd/branches/2.2.x/server/mpm/winnt/mpm_winnt.c 2006/09/15 
13:19:25
446606
+++ httpd/httpd/branches/2.2.x/server/mpm/winnt/mpm_winnt.c 2007/08/24 
22:04:23
569541
@@ -1297,6 +1297,9 @@
0, TRUE, DUPLICATE_SAME_ACCESS)) {
 SetStdHandle(STD_OUTPUT_HANDLE, nullstdout);
 }
+
+/* Close the original handle, we used the duplicate */
+apr_file_close(nullfile);
 }
 }
 }
@@ -1635,6 +1638,9 @@

 /* Set up the listeners */
 get_listeners_from_parent(s);
+
+/* Done reading from the parent, close that channel */
+CloseHandle(pipe);

 ap_my_generation = ap_scoreboard_image->global->running_generation;
 }


Re: resend: Bug report re: Apache 2.2.6 on Windows

2007-09-14 Thread William A. Rowe, Jr.
William A. Rowe, Jr. wrote:
> 
> is that mod perl is attempting to protect us from ourselves even before
> the fixes went into win32.  Of all of the adjustments in version 2.2.6,
> try backing out only this single effect of the patch, which closed stdin
> on both the parent and child, and please confirm if this alone is enough
> to placate mod_perl?  (This would be patch -R to revert the following.)
> 
> --- httpd/httpd/branches/2.2.x/server/mpm/winnt/mpm_winnt.c   2006/09/15 
> 13:19:25
> 446606
> +++ httpd/httpd/branches/2.2.x/server/mpm/winnt/mpm_winnt.c   2007/08/24 
> 22:04:23

Belay that request :)  I missed something.

I'll follow up with a patch that opens /device/null for stdio/faux-posix
as well as MS filehandles, and shoot that to the list in a bit (along with
post my concept to that other bug, so we can look at all of it.)