How to read request content without eating it ?

2016-02-28 Thread Ben RUBSON
Hello, I need to implement an access control handler based on request content. So here is my (very simplified) PerlAccessHandler code : sub handler { $r = shift; $r->read($content,$r->headers_in->{'Content-length'}); if($content =~ /signature=expected_signature/) { return Apache2::Con

Re: How to read request content without eating it ?

2016-02-29 Thread Ben RUBSON
gain, Ben > Le 28 févr. 2016 à 20:13, Joseph Schaefer a écrit : > > Use apreq. > > Sent from my iPhone > >> On Feb 28, 2016, at 1:04 PM, Ben RUBSON wrote: >> >> Hello, >> >> I need to implement an access control handler based on request conte

Thread-safe & vars scope clarification

2016-04-04 Thread Ben RUBSON
Hello, I have some questions regarding mod_perl, threads, thread-safe functions, special vars scope... From https://perl.apache.org/docs/2.0/user/coding/coding.html#toc_Thread_environment_Issues : "if you chdir() in one thread, all other thread now see the current working directory of that th

Re: Thread-safe & vars scope clarification

2016-04-04 Thread Ben RUBSON
threads, can I ask why > you're considering it? The memory footprint and performance of using forked > processes with Perl is generally going to be better than that of threads, due > to copy-on-write. > > - Perrin > > On Mon, Apr 4, 2016 at 4:44 PM, Ben RUBSON <

Re: Thread-safe & vars scope clarification

2016-04-07 Thread Ben RUBSON
>> If you want to try it yourself and report back, I'm sure we'd all be >> interested in what you find out. The main thing I'm aware of is that >> copy-on-write works very well for preforking and threads usually can't >> match it, but maybe your application is different. >> >> Regarding your thre

[Bug Report] mod_perl runs with GID 0 !

2016-04-11 Thread Ben RUBSON
-8<-- Start Bug Report 8<-- 1. Problem Description: Hello, Here is my Apache user and group : # grep -iE "user|group" httpd.conf User #1025 Group #1025 # ps axo uid,gid,comm | grep http 1025 1025 httpd 1025 1025 httpd 1025 1025 httpd Let's run the

Re: [Bug Report] mod_perl runs with GID 0 !

2016-04-11 Thread Ben RUBSON
Because this is the documented procedure : http://perl.apache.org/docs/2.0/user/help/help.html#Reporting_Problems > I'm confused. Why send this to the mailing list? > > > On Mon, Apr 11, 2016 at 11:04:17PM +0200, Ben RUBSON wrote: >> -8<-- Star

Re: [Bug Report] mod_perl runs with GID 0 !

2016-04-12 Thread Ben RUBSON
>> Because this is the documented procedure : >> http://perl.apache.org/docs/2.0/user/help/help.html#Reporting_Problems >> > > Interesting. I don't ever recall seeing a bug report on this list. I > always assumed there to be a developed list. I had a look at the Apache BugZilla, but there is n

Re: [Bug Report] mod_perl runs with GID 0 !

2016-04-12 Thread Ben RUBSON
>> Let's run the following example script in mod_perl : >> >> # more test.pl >> open(my $fh, ">", "/tmp/test.log"); >> print $fh "Your UID is " . $< . "\n"; >> my @groups = split '\s', $(; >> print $fh "You belong to these groups: "; >> print $fh $_ . " " foreach(@groups); > > How did you run the

Re: [Bug Report] mod_perl runs with GID 0 !

2016-04-12 Thread Ben RUBSON
>> Let's run the following example script in mod_perl : >> >> # more test.pl >> open(my $fh, ">", "/tmp/test.log"); >> print $fh "Your UID is " . $< . "\n"; >> my @groups = split '\s', $(; >> print $fh "You belong to these groups: "; >> print $fh $_ . " " foreach(@groups); > > How did you run the

Re: [Bug Report] mod_perl runs with GID 0 !

2016-04-12 Thread Ben RUBSON
>> Let's run the following example script in mod_perl : >> >> # more test.pl >> open(my $fh, ">", "/tmp/test.log"); >> print $fh "Your UID is " . $< . "\n"; >> my @groups = split '\s', $(; >> print $fh "You belong to these groups: "; >> print $fh $_ . " " foreach(@groups); > > How did you run the

Re: [Bug Report] mod_perl runs with GID 0 !

2016-04-12 Thread Ben RUBSON
>> And what is a little bit frightening here is that Apache is launched by the >> #1025 user itself. >> So how could it be possible for it to generate a file owned by group #0... >> Very strange ! > > Something is misconfigured, but its not related to modperl. You're totally right, and I would l

log_error and client IP

2016-12-28 Thread Ben RUBSON
Hello, I'm using the following to log error messages from mod_perl to Apache log files : $r->log_error("mymsg"); It produces the following : [Sat Dec 24 09:39:43.933388 2016] [:error] [pid 8015] mymsg I'm a little bit suprised that it does not produce the following : [Sat Dec 24 09:39:43.933388

Re: log_error and client IP

2016-12-30 Thread Ben RUBSON
> On 29 Dec 2016, at 17:26, Vincent Veyron wrote: > > On Wed, 28 Dec 2016 22:24:56 +0100 > Ben RUBSON wrote: > > >> I'm using the following to log error messages from mod_perl to Apache log >> files : >> $r->log_error("mymsg"); &

Flush headers ?

2017-02-06 Thread Ben RUBSON
Hi, I'm using mod_perl2 and I'm trying to flush headers before the body content. $r->content_type('application/zip'); $r->headers_out->add('Content-Disposition' => 'attachment'); $r->rflush; long_operation(); Unfortunately this does not work. The following works, but of course corrupts my outpu

Re: Flush headers ?

2017-02-06 Thread Ben RUBSON
> On 07 Feb 2017, at 02:40, André Warnier (tomcat) wrote: > > On 06.02.2017 18:33, Ben RUBSON wrote: >> Hi, >> >> I'm using mod_perl2 and I'm trying to flush headers before the body content. >> >> $r->content_type('application/zip')

Re: Flush headers ?

2017-02-07 Thread Ben RUBSON
> On 07 Feb 2017, at 03:21, Jie Gao wrote: > > Try moving the header addition line to after the flush statement. > > Regards, > > Jie Unfortunately it does not help :-/ Even keeping only one header line (the content-type one). I investigated further and found that the following example : my

Log and special characters

2017-08-01 Thread Ben RUBSON
Hi, The following UTF-8 : warn("warn with special char ééèè"); $r->log->error("log with special char ééèè"); Produces : warn with special char ééèè at ... [Tue Aug 01 19:25:28.914947 2017] [perl:error] [pid 56938] [client 127.0.0.1:59952] log with special char \xc3\xa9\xc3\xa9\xc3\xa8\xc3\xa8 W

Re: Log and special characters

2017-08-02 Thread Ben RUBSON
> On 01 Aug 2017, at 19:30, Ben RUBSON wrote: > > $r->log->error("log with special char ééèè"); > > [Tue Aug 01 19:25:28.914947 2017] [perl:error] [pid 56938] [client > 127.0.0.1:59952] log with special char \xc3\xa9\xc3\xa9\xc3\xa8\xc3\xa8 > > Why a

Re: Log and special characters

2017-08-02 Thread Ben RUBSON
> On 02 Aug 2017, at 10:52, André Warnier (tomcat) wrote: > > On 01.08.2017 19:30, Ben RUBSON wrote: >> Hi, >> >> The following UTF-8 : >> warn("warn with special char ééèè"); >> $r->log->error("log with special char ééèè"); &g

Re: Log and special characters

2017-08-02 Thread Ben RUBSON
> On 02 Aug 2017, at 11:17, André Warnier (tomcat) wrote: > > On 02.08.2017 10:59, Ben RUBSON wrote: >> >>> On 02 Aug 2017, at 10:52, André Warnier (tomcat) wrote: >>> >>> On 01.08.2017 19:30, Ben RUBSON wrote: >>>> Hi, >>>>

Modifying @INC on a Per-VirtualHost

2017-08-19 Thread Ben RUBSON
Hi list, I have a question regarding tuning @INC at VirtualHost level, with prefork MPM. In the doc : https://perl.apache.org/docs/2.0/user/config/config.html#Modifying_C__INC__on_a_Per_VirtualHost is written : "under prefork your procs will be huge, because you will build a pool of interpreters

Re: Modifying @INC on a Per-VirtualHost

2017-08-19 Thread Ben RUBSON
> On 19 Aug 2017, at 22:40, Ben RUBSON wrote: > > Hi list, > > I have a question regarding tuning @INC at VirtualHost level, with prefork > MPM. > (...) > will I have 2 (2 different PerlSwitches configurations) > or 11 (11 different VH using PerlSwitches) interpreter

Re: Modifying @INC on a Per-VirtualHost

2017-08-20 Thread Ben RUBSON
> On 20 Aug 2017, at 11:28, André Warnier (tomcat) wrote: > > On 19.08.2017 23:29, Ben RUBSON wrote: >>> On 19 Aug 2017, at 22:40, Ben RUBSON wrote: >>> >>> Hi list, >>> >>> I have a question regarding tuning @INC at VirtualHost level,

Re: Modifying @INC on a Per-VirtualHost

2017-08-20 Thread Ben RUBSON
> On 20 Aug 2017, at 11:45, Ben RUBSON wrote: > > I managed to get ride of (...) to get rid, you will have corrected :)

Apache2::Reload, Prototype mismatch

2017-08-22 Thread Ben RUBSON
Hello, I use Apache2::Reload on my dev env : PerlModule Apache2::Reload PerlInitHandler Apache2::Reload PerlSetVar ReloadDirectories "/d/" It works perfectly. Of course I get the warnings "Subroutine redefined" when modules are reloaded. But I also get : Prototype mismatch: sub Functions::to_jso

Re: Apache2::Reload, Prototype mismatch

2017-08-22 Thread Ben RUBSON
fault. > > so this just works fine for me: > > use strict; > use warnings; > use JSON; > > print to_json({a=>1,b=>2}); > > Your code seems did't pass arguments to the methods correctly? > > >> On August 22, 2017 at 6:25 PM Ben RUBSON

Re: Apache2::Reload, Prototype mismatch

2017-08-22 Thread Ben RUBSON
Thank you Randolf for your answer. Of course for the "subroutine redefined" messages, I agree. But what about the "Prototype mismatch" messages ? Ben > On 22 Aug 2017, at 16:50, Randolf Richardson wrote: > > The "subroutine redefined" warning is a normal side-effect of the > Apache2::R

Shared var between processes

2017-10-19 Thread Ben RUBSON
Hi, I'm trying to share a var between the different processes of my prefork Apache. I then tried the following idea : $r->server()->dir_config('var','val'); Unfortunately, $r->server()->dir_config('var') is not shared among the processes. I would have thought config was stored at the very f

Re: Shared var between processes

2017-10-19 Thread Ben RUBSON
y (ie any change will only affect the process that changed it.) https://perl.apache.org/docs/2.0/user/handlers/server.html#Startup_File Adam On 17-10-19 12:11 PM, Ben RUBSON wrote: Hi, I'm trying to share a var between the different processes of my prefork Apache. I then tried the foll

Re: Shared var between processes

2017-10-20 Thread Ben RUBSON
On 20 Oct 2017 10:38, André Warnier (tomcat) wrote: On 19.10.2017 22:02, John Dunlap wrote: To piggy back onto this question, what is the best way to do this such that the values of the variables are different for every virtual host? In our model, all virtual hosts shared the same interprete

Re: Shared var between processes

2017-10-20 Thread Ben RUBSON
On 20 Oct 2017 11:17, André Warnier (tomcat) wrote: On 20.10.2017 10:50, Ben RUBSON wrote: On 20 Oct 2017 10:38, André Warnier (tomcat) wrote: On 19.10.2017 22:02, John Dunlap wrote: To piggy back onto this question, what is the best way to do this such that the values of the variables are

Re: Shared var between processes

2017-10-22 Thread Ben RUBSON
On 21 Oct 2017 08:53, André Warnier (tomcat) wrote: On 20.10.2017 17:15, Adam Prime wrote: On 17-10-20 05:17 AM, André Warnier (tomcat) wrote: On 20.10.2017 10:50, Ben RUBSON wrote: On 20 Oct 2017 10:38, André Warnier (tomcat) wrote: I believe that there is much more of a performance hit

Re: Shared var between processes

2017-10-22 Thread Ben RUBSON
On 22 Oct 2017 23:15, André Warnier (tomcat) wrote: On 22.10.2017 18:59, John Dunlap wrote: In our case, we do not use Windows for anything. Even our desktops are Linux. We already employ Redis, which performs the same function as memcache, however, this doesn't really solve the problem beca