Re: [RELEASE CANDIDATE] mod_perl-2.0.13 RC1

2023-08-23 Thread Adam Prime

Sorry for the massive delay on this.


+1

all run on gentoo with 5.15.74 kernel

perl 5.38.0 w/ apache 2.2.34

All tests successful.
Files=245, Tests=2587, 145 wallclock secs ( 0.88 usr  0.35 sys + 114.04 
cusr 11.85 csys = 127.12 CPU)

Result: PASS


perl 5.38.0 w/ apache 2.4.57

I had to build httpd without mod_proxy to get the tests to run at all. 
I think this is probably an Apache::Test problem, i'll reply to Fred's 
email with some more details


Test Summary Report
---
t/filter/in_bbs_inject_header.t   (Wstat: 0 Tests: 36 Failed: 3)
  Failed tests:  22, 26, 30
Files=245, Tests=2586, 150 wallclock secs ( 0.89 usr  0.35 sys + 118.07 
cusr 13.44 csys = 132.75 CPU)

Result: FAIL

(expected failure)

perl 5.34.0 w/ apache 2.2.34

All tests successful.
Files=245, Tests=2587, 143 wallclock secs ( 0.91 usr  0.34 sys + 113.04 
cusr 11.40 csys = 125.69 CPU)

Result: PASS


perl 5.34.0 w/ apache 2.4.57

Test Summary Report
---
t/filter/in_bbs_inject_header.t   (Wstat: 0 Tests: 36 Failed: 3)
  Failed tests:  22, 26, 30
Files=245, Tests=2586, 148 wallclock secs ( 0.91 usr  0.36 sys + 116.59 
cusr 13.32 csys = 131.18 CPU)

Result: FAIL
Failed 1/245 test programs. 3/2586 subtests failed.


(expected failure)




On 8/6/23 08:00, Steve Hay wrote:

Please download, test, and report back on this mod_perl 2.0.13 release
candidate.

https://dist.apache.org/repos/dist/dev/perl/mod_perl-2.0.13-rc1.tar.gz

SHA256:
mod_perl-2.0.13-rc1.tar.gz: EC72BC99 EC01DAE5 BEB1DC8F 2F3807CB A4A9BF4D
 D492E846 858DABC0 EEA8E6B7

SHA512:
mod_perl-2.0.13-rc1.tar.gz: 15EA2E30 B5BE0B76 7E49FC46 20F93AA0 FF4E9EBA
 03E7EDFD 64166223 5C1E652B B3C1CB69 CB60DF33
 C64121C5 C74F3ABB A9ACDB6B 19E9B19A 46790DFE
 015C77C9

Major changes in this release are as follows:

Use get_server_banner() instead of deprecated get_server_version() in
Apache2::Status.  [Petr Písař ]

Fix build for perl >= 5.37.1. [Jitka Plesnikova ]

-
To unsubscribe, e-mail: dev-unsubscr...@perl.apache.org
For additional commands, e-mail: dev-h...@perl.apache.org



Re: [RELEASE CANDIDATE] mod_perl-2.0.13 RC1

2023-08-22 Thread Adam Prime
I can reproduce this on linux with perl 5.34.0 or 5.38.0, and probably 
other's I haven't tried. If I build httpd 2.4.57 with mod_proxy, then it 
happens.


t/logs/error_log shows this:

[Tue Aug 22 21:43:54.639949 2023] [proxy_balancer:emerg] [pid 3450] 
AH01177: Failed to lookup provider 'shm' for 'slotmem': is 
mod_slotmem_shm loaded??
[Tue Aug 22 21:43:54.639961 2023] [:emerg] [pid 3450] AH00020: 
Configuration Failed, exiting


If I uncomment the LoadModule for mod_slotmem_shm in the default 
httpd.conf that shipped with 2.4.57, then the tests run as expected with 
the one failure.


I think this could be a bug with the way that Apache::Test figures out 
what apache configuration it should use, possibly. It does seem to be 
related to the way I built apache too though, which is like this:


./configure \
  --prefix=$2 \
  --with-included-apr \
  --enable-deflate=static \
  --enable-proxy=static \
  --enable-auth_digest=static \
  --enable-include=static \
  --with-mpm=prefork && make && make install

Adam




On 8/18/23 01:10, Fred Moyer wrote:

[You don't often get email from f...@redhotpenguin.com. Learn why this is 
important at https://aka.ms/LearnAboutSenderIdentification ]

Hitting an issue on MacOS, perl 5.36.1, httpd 2.4.57. Not sure if this
is me out of practice or not. Do I need to build against httpd 2.2?

ulimit -c unlimited; /opt/homebrew/Cellar/perl/5.36.1/bin/perl
/Users/phred/dev/mod_perl-2.0.13-rc1/t/TEST -bugreport -verbose=0
/opt/homebrew/opt/httpd/bin/httpd  -d
/Users/phred/dev/mod_perl-2.0.13-rc1/t -f
/Users/phred/dev/mod_perl-2.0.13-rc1/t/conf/httpd.conf -D APACHE2 -D
APACHE2_4 -D PERL_USEITHREADS
using Apache/2.4.57 (prefork MPM)

waiting 300 seconds for server to start: .httpd: Syntax error on line
85 of /Users/phred/dev/mod_perl-2.0.13-rc1/t/conf/httpd.conf: Cannot
load /Users/phred/dev/mod_perl-2.0.13-rc1/src/modules/perl/mod_perl.so
into server: 
dlopen(/Users/phred/dev/hd_perl-2.0.13-rc1/src/modules/perl/mod_perl.so,
0x000A): symbol not found in flat namespace
'_modperl_handler_anon_add'
.^C[warning]
halting tests

On Sun, Aug 6, 2023 at 5:00 AM Steve Hay  wrote:


Please download, test, and report back on this mod_perl 2.0.13 release
candidate.

https://dist.apache.org/repos/dist/dev/perl/mod_perl-2.0.13-rc1.tar.gz

SHA256:
mod_perl-2.0.13-rc1.tar.gz: EC72BC99 EC01DAE5 BEB1DC8F 2F3807CB A4A9BF4D
 D492E846 858DABC0 EEA8E6B7

SHA512:
mod_perl-2.0.13-rc1.tar.gz: 15EA2E30 B5BE0B76 7E49FC46 20F93AA0 FF4E9EBA
 03E7EDFD 64166223 5C1E652B B3C1CB69 CB60DF33
 C64121C5 C74F3ABB A9ACDB6B 19E9B19A 46790DFE
 015C77C9

Major changes in this release are as follows:

Use get_server_banner() instead of deprecated get_server_version() in
Apache2::Status.  [Petr Písař ]

Fix build for perl >= 5.37.1. [Jitka Plesnikova ]

-
To unsubscribe, e-mail: dev-unsubscr...@perl.apache.org
For additional commands, e-mail: dev-h...@perl.apache.org



-
To unsubscribe, e-mail: dev-unsubscr...@perl.apache.org
For additional commands, e-mail: dev-h...@perl.apache.org



Re: [RELEASE CANDIDATE] mod_perl-2.0.13 RC1

2023-08-22 Thread Adam Prime

Sorry for the massive delay on this.


+1

all run on gentoo with 5.15.74 kernel

perl 5.38.0 w/ apache 2.2.34

All tests successful.
Files=245, Tests=2587, 145 wallclock secs ( 0.88 usr  0.35 sys + 114.04 
cusr 11.85 csys = 127.12 CPU)

Result: PASS


perl 5.38.0 w/ apache 2.4.57

I had to build httpd without mod_proxy to get the tests to run at all. I 
think this is probably an Apache::Test problem, i'll reply to Fred's 
email with some more details


Test Summary Report
---
t/filter/in_bbs_inject_header.t   (Wstat: 0 Tests: 36 Failed: 3)
  Failed tests:  22, 26, 30
Files=245, Tests=2586, 150 wallclock secs ( 0.89 usr  0.35 sys + 118.07 
cusr 13.44 csys = 132.75 CPU)

Result: FAIL

(expected failure)

perl 5.34.0 w/ apache 2.2.34

All tests successful.
Files=245, Tests=2587, 143 wallclock secs ( 0.91 usr  0.34 sys + 113.04 
cusr 11.40 csys = 125.69 CPU)

Result: PASS


perl 5.34.0 w/ apache 2.4.57

Test Summary Report
---
t/filter/in_bbs_inject_header.t   (Wstat: 0 Tests: 36 Failed: 3)
  Failed tests:  22, 26, 30
Files=245, Tests=2586, 148 wallclock secs ( 0.91 usr  0.36 sys + 116.59 
cusr 13.32 csys = 131.18 CPU)

Result: FAIL
Failed 1/245 test programs. 3/2586 subtests failed.


(expected failure)




On 8/6/23 08:00, Steve Hay wrote:

Please download, test, and report back on this mod_perl 2.0.13 release
candidate.

https://dist.apache.org/repos/dist/dev/perl/mod_perl-2.0.13-rc1.tar.gz

SHA256:
mod_perl-2.0.13-rc1.tar.gz: EC72BC99 EC01DAE5 BEB1DC8F 2F3807CB A4A9BF4D
 D492E846 858DABC0 EEA8E6B7

SHA512:
mod_perl-2.0.13-rc1.tar.gz: 15EA2E30 B5BE0B76 7E49FC46 20F93AA0 FF4E9EBA
 03E7EDFD 64166223 5C1E652B B3C1CB69 CB60DF33
 C64121C5 C74F3ABB A9ACDB6B 19E9B19A 46790DFE
 015C77C9

Major changes in this release are as follows:

Use get_server_banner() instead of deprecated get_server_version() in
Apache2::Status.  [Petr Písař ]

Fix build for perl >= 5.37.1. [Jitka Plesnikova ]

-
To unsubscribe, e-mail: dev-unsubscr...@perl.apache.org
For additional commands, e-mail: dev-h...@perl.apache.org



Re: [RELEASE CANDIDATE] Apache-SizeLimit-0.98 RC1

2023-07-29 Thread Adam Prime

+1

server localhost:8529 started
t/apache/all.t  skipped: apache version 1 required, 
this is version 2

t/apache2/basic.t . ok
t/apache2/check_n_requests2.t . ok,
t/apache2/deprecated.t  ok
t/apache2/zzz_check_n_requests.t .. ok
t/pod.t ... ok
All tests successful.
Files=6, Tests=38,  3 wallclock secs ( 0.03 usr  0.00 sys +  1.66 cusr 
0.19 csys =  1.88 CPU)

Result: PASS


All tests pass on linux with apache 2.4.41 prefork and perl 5.28.0

Adam

On 7/21/23 18:56, Steve Hay wrote:

In preparation for an upcoming release of mod_perl to support Perl
5.38.0, I am making a new release of Apache-SizeLimit.

Please download, test, and report back on this Apache-SizeLimit 0.98
release candidate.

https://people.apache.org/~stevehay/Apache-SizeLimit-0.98-rc1.tar.gz

MD5  = 8acfa750da6c4f4ae3f328e117dfa42c
SHA256 = 4a6cd22067d93bfd2e43ae1fb5902942576e7af6b0a7c2a1c466d550b573

(NOTE: Apache::SizeLimit is not implemented on Windows.)

Major changes in this release are as follows:

Overhaul $VERSION numbering scheme to align with other mod_perl
modules and avoid warnings from ExtUtils::MakeMaker.
[Steve Hay]

Remove use of Linux::Smaps - it is slow and uses wrong statistics anyway.
[Zefram , CPAN RT#93757]

Fix unshared memory values when using /proc/self/statm.
[Zefram , CPAN RT#73752]

Fix unnecessary FAIL reports on CPAN Testers by checking for mod_perl
or mod_perl2.
[Andreas Koenig ; Steve Hay]


Re: [RELEASE CANDIDATE] Apache-Reload-0.14 RC1

2023-07-29 Thread Adam Prime

+1

tests pass on apache 2.4.41 w/ perl 5.28.0, which is what i've got 
immediately available to test with.


Adam

On 7/21/23 18:56, Steve Hay wrote:

In preparation for an upcoming release of mod_perl to support Perl
5.38.0, I am making a new release of Apache-Reload.

Please download, test, and report back on this Apache-Reload 0.14
release candidate.

https://people.apache.org/~stevehay/Apache-Reload-0.14-rc1.tar.gz

MD5  = 53a2201f98d05b9868581b730d2032c3
SHA256 = 38fcc0234e9db91624b5bc704ffe93928aa3f1d044bcc26f4839787b21123769

Major changes in this release are as follows:

Fix unnecessary FAIL reports on CPAN Testers by checking for mod_perl
or mod_perl2.
[Andreas Koenig , CPAN RT#34316; Steve Hay]

Fix spelling error.
[, CPAN RT#127004]

Fix Makefile.PL when Apache::Test is not present.
[Nigel Gregoire, CPAN RT#113778]


Re: What would a mod_perl EOL look like?

2021-03-18 Thread adam . prime
If you go back to Sander's original email, he outlines what will  
happen if we can't staff the PMC sufficiently to meet Apache's  
guidelines. The project woudl go to the attic[1].  There are lots of  
projects in the Attic. Some of them have been forked and continue to  
have development done on them. At any rate, there will be some notice,  
though probably not years of notice, and the source code absolutely  
will not 'suddenly disappear'. I'd suggest following the link below  
and reading about what the attic is, and what it would mean to get  
more context if you're interested in more detail.


Adam

[1] http://attic.apache.org/




Quoting Jim Albert :


When mod_perl does come to an end what would an End of Life look like?
I'm told mod_perl is an Apache Software Foundation project. Do Apache
Software Foundation projects have a structured life cycle or do some
just suddenly disappear with no warning given various situations that
result in the need for EOL?

Jim






Re: [DISCUSS] The future of mod_perl

2021-03-17 Thread Adam Prime
I didn't say there are no developers, I said there is no active 
development happening. Steve Hay is a developer. Fred Moyer, who replied 
to this thread earlier this evening, has also made significant 
contributions to the project. I can dive into the C if I have to, to fix 
bugs or review code, but I'm likely not going to have the time or skills 
to make significant changes should they be required.


When significant bugs come up within mod_perl developers from httpd 
project may also get brought in. That's what happened last time anyway 
(https://nvd.nist.gov/vuln/detail/CVE-2011-2767)


Adam

On 3/17/2021 11:46 PM, Jim Albert wrote:

Sure... I'll start a new thread after I reply here.

I don't know about how apache projects are maintained and the logistics, 
but there are two issues here.
Foremost... from your previous response you need a few people to step up 
and file your described report indicating no new releases, but that's 
not necessarily a developer and it doesn't sound involved. I expect 
you'll get some volunteers.


However, aside from that is the bigger issue of you stated there are no 
developers maintaining mod_perl. That's the big red flag in this. Should 
some vulnerability be discovered or a future Apache release present some 
compatibility issue... maybe someone steps up and provides a fix... 
that's a big maybe.


Jim



Re: [DISCUSS] The future of mod_perl

2021-03-17 Thread Adam Prime
I think if you want to discuss alternatives, then a new thread would be 
the place to do that.


With regards to plug being pulled, I think that it is up to the 
community if, when, and how that happens. That's what the point of this 
thread is. If there aren't people that are committed enough to the 
project for whatever reason to step up and keep it from going to the 
attic, then that's what will happen.


Adam



On 3/17/2021 9:50 PM, Jim Albert wrote:
Not that I want to be the guy that says it sounds like we'll be pulling 
the mod_perl plug at any time the right scenario arises, but is it 
reasonable to have a discussion here on mod_perl alternatives inline 
with the various means of using mod_perl from the low level means of 
interfacing with the Apache server to the quick and dirty stuff 
(ModPerl::PerlRun, I believe to keep Perl and modules in memory).


For those drawing the same conclusions from this thread as me, I've seen 
mod_fcgid proposed as an alternative, but I haven't yet played with it. 
Anyone with similar thoughts would ideally be looking for something that 
doesn't require months of redeveloping to a proposed replacement to 
mod_perl.


I like mod_perl and it does a good job for what I use it for, but if we 
have no one developing, it sounds like we're waiting for the catalyst to 
come along that puts and end to it. EG.. some future Apache 
incompatibility.  I'd really like someone with mod_perl authority to 
tell me I'm wrong, but my take on Adam's reply pretty much leaves me 
with that conclusion. I don't see another way to draw a better conclusion.


Jim



Re: [DISCUSS] The future of mod_perl

2021-03-17 Thread Adam Prime
The projects current state is that no new development happening. This 
isn't to say that new development shouldn't happen, but it isn't. Apache 
and Perl both continue to move forward, and we are pretty lucky that the 
design that Stas, Phillipe, Geoff, etc built mod_perl 2 under is 
resilient enough to continue to despite the changes that both of these 
projects have made.


So, if the goal of the PMC is to maintain the status quo, then there is 
essentially no time required, aside from someone needing to file a 
report every few months saying that nothing has happened, and there were 
no releases. Things can only remain that way as long as there are no 
security problems that affect mod_perl, and neither Apache or Perl do 
anything that really breaks mod_perl.


Adam

On 3/17/2021 6:10 PM, Geoff Mottram wrote:

All,

I would certainly hate to see mod_perl no longer being maintained. I use 
it as a front-end for a library cataloging system that is very much 
alive, in-use and updated with recent HTML, CSS and JavaScript features. 
Rewriting this front-end in some other language would be a huge 
undertaking and would not provide much benefit because Apache + Perl + 
mod_perl not only do the job but do it extremely well.


While I don't understand what type of time commitment would be required, 
I would be happy to add my name to the bottom of any list should others 
have a strong desire to hold such a position.


Best,

Geoff Mottram

On 3/17/2021 3:40 PM, Sander Striker wrote:

Dear community members,

As projects mature, they will naturally reach a point where activity 
reduces to a level such that the project is no longer sustainable.  At 
Apache, projects reach this stage when there are not at least 3 active 
PMC members providing oversight. Projects that reach this stage are 
usually placed in the Attic [1] or absorbed by another Apache project 
willing to manage its releases.


If you are interested in seeing mod_perl remain an active project, and 
are able to help maintain and provide oversight, please respond in 
this thread indicating that you are interested in performing the 
duties of a PMC member[2].


Cheers,

Sander Striker
Director, The Apache Software Foundation

[1] https://attic.apache.org/ 
[2] https://www.apache.org/dev/pmc.html 





-
To unsubscribe, e-mail: dev-unsubscr...@perl.apache.org
For additional commands, e-mail: dev-h...@perl.apache.org



Re: [DISCUSS] The future of mod_perl

2021-03-17 Thread Adam Prime
When the roll call was done a month ago it's basically myself and Steve, 
with Steve really being the only one that has much knowledge of the guts 
of the project. Up until the last few months gozer (Phillippe Chaisson) 
was at least around enough to file reports, but has been MIA a few 
months. Some of the remainder of PMC list from the website are likely 
still at least subbed to lists, but are for all intents and purposes 
completely MIA or possibly formally retired from the project.


Adam

On 3/17/2021 6:52 PM, dc...@prosentient.com.au wrote:


I am not interested in performing those duties but could you clarify 
how many active PMC members there are currently? It looks like the 
list at https://perl.apache.org/about/pmc.html 
 is over 7 years out of date. 
It’s unclear how up-to-date the list at 
https://projects.apache.org/committee.html?perl 
 is as well.


David Cook

Software Engineer

Prosentient Systems

Suite 7.03

6a Glen St

Milsons Point NSW 2061

Australia

Office: 02 9212 0899

Online: 02 8005 0595

*From:*Sander Striker 
*Sent:* Thursday, 18 March 2021 6:41 AM
*To:* d...@perl.apache.org; modperl@perl.apache.org
*Subject:* [DISCUSS] The future of mod_perl

Dear community members,

As projects mature, they will naturally reach a point where activity 
reduces to a level such that the project is no longer sustainable.  At 
Apache, projects reach this stage when there are not at least 3 active 
PMC members providing oversight. Projects that reach this stage are 
usually placed in the Attic [1] or absorbed by another Apache project 
willing to manage its releases.


If you are interested in seeing mod_perl remain an active project, and 
are able to help maintain and provide oversight, please respond in 
this thread indicating that you are interested in performing the 
duties of a PMC member[2].



Cheers,

Sander Striker
Director, The Apache Software Foundation

[1] https://attic.apache.org/ 

[2] https://www.apache.org/dev/pmc.html 





Re:

2021-02-07 Thread Adam Prime
There is one other thing you can do relatively easily that may get you a 
marginal gain when Apache spins up new children. Load some or all of your Perl 
dependencies before Apache forks. There is also an opportunity to load other 
static resources at this time, but that can get a little more involved and/or 
confusing. There is some documentation here: 

https://perl.apache.org/docs/2.0/user/handlers/server.html#Startup_File

Adam


> On Feb 7, 2021, at 8:15 AM, Steven Haigh  wrote:
> 
> 
> In fact, I just realised that 'ab' test is rather restrictive So here's a 
> bit more of an extended test:
> 
> # ab -k -n 1000 -c 32
> 
> Apache + ExecCGI:
>   Requests per second:14.26 [#/sec] (mean)
>   Time per request:   2244.181 [ms] (mean)
>   Time per request:   70.131 [ms] (mean, across all concurrent 
> requests)
> 
> Apache + mod_perl (ModPerl::PerlRegistry): 
>   Requests per second:132.14 [#/sec] (mean)
>   Time per request:   242.175 [ms] (mean)
>   Time per request:   7.568 [ms] (mean, across all concurrent 
> requests)
> 
> Interestingly, without Keepalives, the story is much the same:
> 
> # ab -n 1000 -c 32
> 
> Apache + ExecCGI:
>   Requests per second:14.15 [#/sec] (mean)
>   Time per request:   2260.875 [ms] (mean)
>   Time per request:   70.652 [ms] (mean, across all concurrent 
> requests)
> 
> Apache + mod_perl (ModPerl::PerlRegistry): 
>   Requests per second:154.48 [#/sec] (mean)
>   Time per request:   207.140 [ms] (mean)
>   Time per request:   6.473 [ms] (mean, across all concurrent 
> requests)
> 
> Running some benchmarks across various parts of my site made me realise I 
> also had some RewriteRules in the apache config that still had H=cgi-script - 
> changed those to H=perl-script and saw similar improvements:
> 
>   ExecCGI - Requests per second:11.84 [#/sec] (mean)
>   mod_perl - Requests per second:130.97 [#/sec] (mean)
> 
> That's quite some gains for a days work.
> 
> --
> Steven Haigh
> 
>  net...@crc.id.au
>  https://www.crc.id.au
> 
>> On Sun, Feb 7, 2021 at 23:58, Steven Haigh  wrote:
>> Interestingly, I did get things working with ModPerl::PerlRegistry.
>> 
>> What I couldn't find *anywhere* is that the data I was loading in Template 
>> Toolkit was included in the file in the __DATA__ area - which causes 
>> mod_perl to fall over!
>> 
>> The only way I managed to find this was the following error in the *system* 
>> /var/log/httpd/error_log (didn't show up in the vhost error_log!):
>>  readline() on unopened filehandle DATA at 
>> /usr/lib64/perl5/vendor_perl/Template/Provider.pm line 638.
>> 
>> Took me a LONG time to find a vague post that reading in lines from  
>> kills mod_perl. Not sure why - but I stripped all the templates out and put 
>> them in a file instead and re-wrote that bit of code, and things started 
>> working.
>> 
>> I had to fix a few lib path issues, but after getting my head around that, 
>> most things seem to work as before - however I don't notice much of an 
>> improvement in execution times, I do see this improvement using 'ab -n 100 
>> -c32':
>> 
>>  Apache + ExecCGI: Requests per second:13.50 [#/sec] (mean)
>>  Apache + mod_perl: Requests per second:59.81 [#/sec] (mean)
>> 
>> This is obviously a good thing.
>> 
>> I haven't gotten into the preload or DBI sharing yet - as that'll end up 
>> needing a bit of a rewrite of code to take advantage of. I'd be open to 
>> suggestions here from those who have done it in the past to save me going 
>> down some dead ends :D
>> 
>> --
>> Steven Haigh
>> 
>>  net...@crc.id.au
>>  https://www.crc.id.au
>> 
>>> On Sun, Feb 7, 2021 at 12:49, James Smith  wrote:
>>> As welsey said – try Registry, that was the standard way of using mod_perl 
>>> to cache perl in the server  – but your problem might be due to the note in 
>>> PerlRun…
>>> 
>>> https://perl.apache.org/docs/2.0/api/ModPerl/PerlRun.html#Description
>>> META: document that for now we don't chdir() into the script's dir, because 
>>> it affects the whole process under threads. ModPerl::PerlRunPrefork should 
>>> be used by those who run only under prefork MPM.
>>> {tbh most people don’t use mod perl under threads anyway as there isn’t 
>>> really a gain from using them}
>>> 
>>> It suggests you use ModPerl/PerlRunPrefork – as this does an additional 
>>> step to cd to the script directory – which might be your issue….
>>>  
>>> From: Steven Haigh  
>>> Sent: 07 February 2021 01:00
>>> To: modperl@perl.apache.org
>>> Subject: Moving ExecCGI to mod_perl - performance and custom 'modules' [EXT]
>>>  
>>> Hi all,
>>>  
>>> So for many years I've been slack and writing perl scripts to do various 
>>> things - but never needed more than the normal apache +ExecCGI and Template 
>>> Toolkit.
>>>  
>>> One of my sites has become a bit more popular, so I'd like to spend a bit 
>>> of time on performance. Currently, I'm 

Re: HTML template for MP2

2020-12-29 Thread Adam Prime

On 12/29/20 8:55 PM, Matthias Peng wrote:
Currently my mp2 handler outputs the content just for an JSON API, which 
behaves well.
If I want mp2 to output a full HTML page, what's the suggested template 
for this?


There are a lot of ways to answer this, and I'm not sure what the 
question you're actually asking is.  If you're looking for a templating 
system to use in an application written for mod_perl, then you can use 
any of the various ones that exist for perl.  They should all work fine 
under mod_perl. I personally use Template Toolkit pretty much 
exclusively, but other people use other things.


But you might be asking what you can/should use to build a web 
application designed to run under mod_perl, which is a totally different 
set of things. Though those things probably use Template Toolkit, or 
something like it internally.


Alternatively you could just be asking how do i return a 200 response 
with a text/html Content Type.  In which case you can start with the 
sadly concise / incomplete examples here:


https://perl.apache.org/docs/2.0/user/intro/start_fast.html

Adam


Re: cache a object in modperl

2020-09-13 Thread Adam Prime
I left out the link to the thread.  Here it is. 

https://marc.info/?t=11906287072=1=2



> On Sep 14, 2020, at 1:18 AM, Wesley Peng  wrote:
> 
> That's great. Thank you Adam.
> 
> Adam Prime wrote:
>> If the database doesn't change very often, and you don't mind only getting 
>> updates to your database when you restart apache, and you're using prefork 
>> mod_perl, then you could use a startup.pl to load your database before 
>> apache forks, and get a shared copy globally in all your apache children.
>> https://perl.apache.org/docs/1.0/guide/config.html#The_Startup_File
>> This thread from 13 years ago seems to have a clear-ish example of how to 
>> use startup.pl to do what i'm talking about.
>> If you need it to update more frequently than when you restart apache, you 
>> could potentially use a PerlChildInitHandler to load the data when apache 
>> creates children.  This will use more memory, as each child will have it's 
>> own copy, and can also result in situation where children can have different 
>> versions of the database loaded and be serving requests at the same time.  
>> If you want to go this way you might want to also add a MaxRequestsPerChild 
>> directive to your apache config to make sure that you're children die and 
>> get refreshed on the regular, if you don't already have one.
>> Adam
>>> On 9/13/2020 10:51 PM, Wesley Peng wrote:
>>> Hello
>>> 
>>> I am not so familiar with modperl.
>>> 
>>> For work requirement, I need to access IANA TLD database.
>>> 
>>> So I wrote this perl module:
>>> https://metacpan.org/pod/Net::IANA::TLD
>>> 
>>> But, for each new() in the module, the database file will be downloaded 
>>> from IANA's website.
>>> 
>>> I know this is pretty Inefficient.
>>> 
>>> My question is, can I cache the new'ed object by modperl?
>>> 
>>> If so, how to do?
>>> 
>>> Thanks.


Re: cache a object in modperl

2020-09-13 Thread Adam Prime
If the database doesn't change very often, and you don't mind only 
getting updates to your database when you restart apache, and you're 
using prefork mod_perl, then you could use a startup.pl to load your 
database before apache forks, and get a shared copy globally in all your 
apache children.


https://perl.apache.org/docs/1.0/guide/config.html#The_Startup_File

This thread from 13 years ago seems to have a clear-ish example of how 
to use startup.pl to do what i'm talking about.


If you need it to update more frequently than when you restart apache, 
you could potentially use a PerlChildInitHandler to load the data when 
apache creates children.  This will use more memory, as each child will 
have it's own copy, and can also result in situation where children can 
have different versions of the database loaded and be serving requests 
at the same time.  If you want to go this way you might want to also add 
a MaxRequestsPerChild directive to your apache config to make sure that 
you're children die and get refreshed on the regular, if you don't 
already have one.


Adam


On 9/13/2020 10:51 PM, Wesley Peng wrote:

Hello

I am not so familiar with modperl.

For work requirement, I need to access IANA TLD database.

So I wrote this perl module:
https://metacpan.org/pod/Net::IANA::TLD

But, for each new() in the module, the database file will be 
downloaded from IANA's website.


I know this is pretty Inefficient.

My question is, can I cache the new'ed object by modperl?

If so, how to do?

Thanks.


Re: [RELEASE CANDIDATE] mod_perl-2.0.11 RC3

2019-10-01 Thread Adam Prime

+1 on gentoo with 2.4.41 prefork on perl 5.28.0

I still see the bbs tests failing as they have been.  I started to look 
into it a bit, and see what you're talking about with the ENV switch to 
'turn off LWP', but ran out of time. It kind of looked like when LWP was 
on, that the value of the header wasn't getting sent, but there seems to 
be a lot of magic going on in those tests in general, that i didn't have 
time to understand. It seemed like that test should be fixable though.


Adam

On 9/26/19 1:17 PM, Steve Hay wrote:

Please download, test, and report back on this mod_perl 2.0.11 release
candidate.

https://dist.apache.org/repos/dist/dev/perl/mod_perl-2.0.11-rc3.tar.gz

MD5  = dd6f7918fc492be21868a9774b2e58c5
SHA1 = e4af2eaabb40962cd7e5566e5ee3342090413b30

Changes since RC2 are as follows:

Fix t/api/request_rec.t failures [Steve Hay]



Re: [RELEASE CANDIDATE] mod_perl-2.0.11 RC2

2019-09-25 Thread Adam Prime


What happens if you revert the change in that file? I.e. Change
FINFO_NAME back to FINFO_NORM on line 168, and on line 18 (the
APR::Const -compile line)? Does that fix it for you?



With that change all the request_rec tests run and pass.

Adam


Re: [RELEASE CANDIDATE] mod_perl-2.0.11 RC2

2019-09-24 Thread Adam Prime
Still seeing the t/api/request_rec.t failures, which do not occur with 
the same machine and same settings with 2.0.10. It's failing after the 
mtime test, before the finfo test.


Test Summary Report
---
t/api/request_rec.t   (Wstat: 0 Tests: 43 Failed: 0)
  Parse errors: Bad plan.  You planned 55 tests but ran 43.
t/filter/in_bbs_inject_header.t   (Wstat: 0 Tests: 36 Failed: 3)
  Failed tests:  22, 26, 30
Files=245, Tests=3402, 98 wallclock secs ( 0.71 usr  0.30 sys + 67.05 
cusr 12.05 csys = 80.11 CPU)

Result: FAIL
Failed 2/245 test programs. 3/3402 subtests failed.


This is what i see in the error_log:

[Tue Sep 24 22:56:10.012601 2019] [perl:error] [pid 743] [client 
127.0.0.1:57720] APR::Finfo::stat: (70008) Partial results are valid but 
processing is incomplete at 
/tmp/mod_perl-2.0.11-rc2/t/response/TestAPI/request_rec.pm line 168


Not sure if this is a concern or not, but it seems like it should be?

Adam


On 9/24/19 12:53 PM, Steve Hay wrote:

Please download, test, and report back on this mod_perl 2.0.11 release
candidate.

https://dist.apache.org/repos/dist/dev/perl/mod_perl-2.0.11-rc2.tar.gz

MD5  = abc2c2168121a09b0fc3b6fc6adc00bd
SHA1 = 36ee7626506a3a461118b3957814dfe9331ef1de

Changes since RC1 are as follows:

Fix [CVE-2011-2767] Arbitrary Perl code execution in the context of the user
account via a user-owned .htaccess. Patch from bugs.debian.org #644169. [Jan
Ingvoldstad ]

Fix potential test suite hangs due to pipelined response deadlocks. Patch
from rt.cpan.org #82409. [Zefram ]

Fix t/compat/request.t failures [Steve Hay]



Re: [RELEASE CANDIDATE] mod_perl-2.0.11 RC1

2019-09-23 Thread Adam Prime
I'm seeing more test failures for 2.0.11 RC1 than for 2.0.10 with the 
same setup.


Test Summary Report
---
t/api/request_rec.t   (Wstat: 0 Tests: 43 Failed: 0)
  Parse errors: Bad plan.  You planned 55 tests but ran 43.
t/compat/request.t(Wstat: 0 Tests: 12 Failed: 0)
  Parse errors: Bad plan.  You planned 22 tests but ran 12.
t/filter/in_bbs_inject_header.t   (Wstat: 0 Tests: 36 Failed: 3)
  Failed tests:  22, 26, 30
Files=245, Tests=3392, 102 wallclock secs ( 0.76 usr  0.34 sys + 72.85 
cusr 11.27 csys = 85.22 CPU)

Result: FAIL
Failed 3/245 test programs. 3/3392 subtests failed.


The compat/request.t failures don't occur on the previous version. Is 
this expected?  I'm using perl 5.28.0, and  httpd 2.4.41 prefork.


Adam

On 9/2/19 8:34 AM, Steve Hay wrote:

Please download, test, and report back on this mod_perl 2.0.11 release
candidate.

https://dist.apache.org/repos/dist/dev/perl/mod_perl-2.0.11-rc1.tar.gz

MD5  = 417823274b32e5ca8759cf3760ad1591
SHA1 = e47c72337e6766c403d0a76b59d3808625e5162b

Major changes in this release are as follows:

Fix use-after-free segfault in ap_server_config_defines seen on
start-up on OpenBSD. [Found/fixed by Sam Vaughan/Joe Orton]

Fix build with Perls earlier than 5.13.6. [Rainer Jung
]

Fix filter/in_bbs_inject_header.t test failure with Apache 2.4.25+.
[Stefan Fritsch ]

Fix apache/read.t test failure with Apache 2.4.25+. [Niko Tyni
]



Re: [RELEASE CANDIDATE] mod_perl-2.0.11 RC1

2019-09-17 Thread Adam Prime
I keep forgetting, but I’ll do this tonight. 

> On Sep 17, 2019, at 8:45 AM, Steve Hay  
> wrote:
> 
>> On Mon, 2 Sep 2019 at 13:37, Steve Hay  wrote:
>> 
>>> On Mon, 2 Sep 2019 at 13:34, Steve Hay  wrote:
>>> 
>>> Please download, test, and report back on this mod_perl 2.0.11 release
>>> candidate.
>>> 
>>> https://dist.apache.org/repos/dist/dev/perl/mod_perl-2.0.11-rc1.tar.gz
>>> 
>> 
>> So far +1 from me in the following builds:
>> 
>> Apache 2.4.33 / Perl 5.28.0 / VC2017 v15.9 (x64) with/without LWP
>> Apache 2.4.41 / Perl 5.31.3 / VC2019 v16.1 (x64) with/without LWP
> 
> It's sad that there have not been any replies to this in more than a
> fortnight... :-/
> 
> -
> To unsubscribe, e-mail: dev-unsubscr...@perl.apache.org
> For additional commands, e-mail: dev-h...@perl.apache.org
> 



Re: Apache 2.4 Authentication/Authorization

2019-05-16 Thread Adam Prime
Honestly, the best, and possibly only, source for the information you're 
after is probably the httpd source code. Unless there is some high level 
documentation that has more details than this does:


https://httpd.apache.org/docs/2.4/howto/auth.html

There's also this, which is supposed to be the documentation for  the C 
API that mod_perl is built on, but it has a gaping hole where the 
information about AAA should be


https://httpd.apache.org/docs/2.4/developer/API.html

You might be able to get some help from people on the httpd list as well.

Adam



On 2019-05-16 5:43 a.m., André Warnier (tomcat) wrote:

Additional info, from the mod_perl 2 documentation and elsewhere :

1) mod_perl :
http://perl.apache.org/docs/2.0/user/handlers/http.html#PerlAuthenHandler
says that this phase is of type RUN_FIRST,
and
http://perl.apache.org/docs/2.0/user/handlers/intro.html#C_RUN_FIRST_
says "If the return value is Apache2::Const::DECLINED, the next handler 
in the chain will be run. If the return value is Apache2::Const::OK the 
next phase will start. In all other cases the execution will be aborted."


/If that information is still valid for Apache 2.4/, then it seems that 
the only way to achieve what I want (and which in my views matches the 
2.4 general AAA logic), would be to let the authentication method return 
Apache2::Const::OK, /even if the user is not authenticated/ by the 
configured authentication method.


2) from 
https://metacpan.org/pod/distribution/Apache-AuthCookie/README.apache-2.4.pod 


(the httpd.conf section)
This may well be the most explicit information readily available, about 
how the Apache 2.4 authentication/authorization logic really works 
"underneath".  At any rate, I have not been able to find a better 
documentation anywhere.



On 15.05.2019 15:42, André Warnier (tomcat) wrote:

Hi.

I am trying to figure out what Apache2::Const return codes /can/ be 
returned by a mod_perl
/authentication/ method under Apache 2.4+, and what consequences each 
of these return

codes has, in terms of what Apache does next.
(And also, where to find a commented list of the Apache "AH" error 
messages)


Does anyone know where I could find this information, other than 
perhaps the Apache httpd

source code ? (and if only there, where ?)

I have done multiple searches in Google, but nothing really relevant 
shows up (lots of

"receipes" there for specific cases, but no general explanation).
I have also consulted :
- the cpan Apache2::Const documentation which lists all the return 
codes, but without

comments as to what they're used for or where they are applicable.
- the mod_perl2 documentation
(http://perl.apache.org/docs/2.0/user/handlers/http.html#PerlAuthenHandler) 
/may/ be

somewhat outdated, as it is in other respects for the Apache 2.4 AAA API.

Thanks in advance

(long) Context:

With a lot of inspiration and cut-and-paste from Apache2::AuthCookie 
(thanks Michael
Schout, also for the 2.4 doc add-on), I have written a mod_perl AAA 
framework

(aka "PerlAddAuthzProvider xxx Our::Own::Module->authz_user" ),
adapted to the particular needs of our applications, and which 
is/should be able to work
in conjunction with most built-in or third-party add-on Apache 
authentication modules
(such as mod_authnz_ldap, mod_shib2, etc). (This because each of our 
corporate customers
each have their own web-AAA infrastructure, and we need to be 
compatible with all of them).


Now I have the case where the authentication method itself (aka 
"PerlAuthenHandler
Our::Own::Module::XXX->authenticate") is one which we need to develop 
ourselves, because

the customer's corporate framework is somewhat "non-standard" itself.
Thus, our authenticate() method calls the customer's back-end method, 
and looks at what it

returns.
The back-end external framework can sometimes fail to authenticate a 
user, and returns a
specific response in such a case. Our authenticate() method catches 
this, and should then
itself return an appropriate return code, such that Apache 2.4 next 
calls the (our)
authz_user() method again, which can then e.g. deny/allow access to 
the resource.


If authenticate() returns Apache2::Const::HTTP_UNAUTHORIZED, then it 
seems that Apache
immediately aborts the request and returns a 401 Unauthorised response 
to the browser.

(In any case, it does /not/ call the perl AuthzProvider again).
(That is not really what I want; I'd like it to call authz_user() 
anyway, and let

authz_user() decide what happens next).

If authenticate() returns Apache2::Const::OK, then there is no Apache 
log message; but
when it calls authz_user() next, that authz_user() should be able to 
find out that the

authentication failed.
Or should I just leave $r->user empty in that case and check on that ? 
is that what the

other (standard) authentication modules do ?

If authenticate() returns Apache2::Const::DECLINE, Apache subsequently 
prints a message in

the server error log, such as :
[Thu May 09 20:52:31.197841 

Re: AuthCookieDBI and Apache 2.4

2019-02-15 Thread Adam Prime
Apache2::AuthCookieDBI looks like it might work just fine with just that 
simple change. In theory you could grab the distribution, make the 
change and run the tests and get a pretty good idea if it will. You'll 
likely need to pay attention to MSCHOUT's documentation about what 
changed in 2.4 though, depending on which features of AuthCookieDBI 
you're using.


Adam

On 2019-02-12 2:25 p.m., Edward J. Sabol wrote:

Hello! I have a project that has successfully used Apache2::AuthCookieDBI
with mod_perl on Apache 2.2 and Apache 2.0 before that for many years. For
various reasons, we are looking at moving this project to a new system that
uses Apache 2.4 exclusively, and the custodians of this new system are
disinclined to use Apache 2.2 even in a dual lightweight/heavyweight server
configuration.

I know AuthCookie has been updated by the magnificient Michael Schout to
support Apache 2.4, but AuthCookieDBI hasn't seen a release in many years.
Has anyone tried using AuthCookieDBI with Apache 2.4 or porting AuthCookieDBI
to 2.4? I presume it's more involved than just installing the latest
version of AuthCookie and changing "use base qw( Apache2::AuthCookie );" to
"use base qw( Apache2_4::AuthCookie );" in Apache2::AuthCookieDBI?
I've looked over Michael Schout's Apache 2.4 authentication API porting
guide here:
http://search.cpan.org/~mschout/Apache-AuthCookie/README.apache-2.4.pod
Any assistance or experience with AuthCookieDBI on Apache 2.4 would be
welcome.

Thanks,
Ed





Re: HTTP and MPM support

2019-02-06 Thread Adam Prime
I can tell you that at least some of the PMC members are on this list. 
But I can also tell you that there is essentially no development going 
on right now. The PMC is essentially idle, and there aren't any plans to 
do anything with regards to improving support for newer MPM's. That 
said, the project is open source, and if there are people or companies 
out there with the skills and desire to work on those features, things 
can get merged, and people can get added to the PMC, or as project 
commiters to enable that.


Adam


On 1/28/19 1:30 PM, Russell Lundberg wrote:
As a long-time fan and user of mod_perl, I like so much the way this 
conversation is turning.


I also wonder if there is a formal process, perhaps an ASF process, 
for coordinating the objectives voiced in this thread with the 
resources required to achieve them?


For example, I believe Steve Hay has led mod_perl2 development lately, 
versions 2.0.9 and 2.0.10, anyway. Should he be engaged, or if the 
leadership of the project has been handed off, whoever has taken 
over?  Do the project steward(s) follow this mailing list?


I don't mean to get in the way of positive and well-intended progress. 
I love mod_perl and only want the best for its future development.


But there might be other development plans in progress with which 
coordination would be helpful.


--
Read my Latest Blog Post for Telecom Pros: _Excel Telecom Tricks - 
Sequential Numbering 
_

Russell Lundberg
Bangkok, Thailand +66 91 546 4539
https://bangkokbeachtelecom.com/
LinkedIn Profile 


On Mon, Jan 28, 2019 at 8:04 AM John Dunlap > wrote:


I will second what Sive is saying. My organization does not have
in-house experience writing C code(our internal skill sets are web
application and database development) but we are potentially
interested in sponsoring some development on mod_perl with the
goal of adding support for mpm_worker and or mpm_event because we
are interested in taking advantage of mod_http2. In addition to
our sponsorship, we could also assist in testing changes and
provided segfaults and debugging/environmental information from
out development and testing environments. Is anyone who is able to
do this kind of development interested in having a conversation
with Sive and myself with respect to sponsoring some development?

On Mon, Jan 28, 2019 at 1:11 AM Sive Lindmark mailto:s...@capestream.se>> wrote:

Hi William!

Count on us, my firm can sponsor work as I stated before, and
also contribute setting up test cases and perhaps also do some
coding if we have the knowledge to do whats needed.
My coders are not used to be part of any open source project,
so we can not take any leading roll though.

How could a sponsor model work?

I have followed crypto world for some time now, and they
sometimes set up price for someone thats achieve a goal.
Something we can do here?

/Sive



-- 
John Dunlap

/CTO | Lariat/
/
/
/*Direct:*/
/j...@lariat.co /
/
*Customer Service:*/
877.268.6667
supp...@lariat.co 



Re: Upgrading a mod_perl application from Apache 2.2 to Apache 2.4

2018-11-30 Thread Adam Prime
Here's Everything stuff I ran into, not all of which have anything to do 
with mod_perl:


I had to change all my 'Order' directives into the new 'Require' style

Related to that, I had to stop using 'require' as described here in my 
auth stuff.

https://perl.apache.org/docs/2.0/api/Apache2/Access.html#C_requires_

httpd rejected the configuration, as far as i can remember. I switched 
to using PerlSetVar to pass in the values that I used to pass in via 
'require'.


I stopped using my custom XForwardedFor InitHandler, because there is 
native support for this now.

https://httpd.apache.org/docs/2.4/mod/mod_remoteip.html

Adam








On 2018-11-30 8:13 a.m., Adam Prime wrote:
There isn’t currently any good documentation for this migration. I went 
through it myself a few months ago, and I ended up using the https 
changes doc to help me when I got strange errors.


https://httpd.apache.org/docs/2.4/upgrading.html

I was able to get everything working after some fooling around.

I’ll go through my hit history and post something more detailed later.

Adam

On Nov 30, 2018, at 8:02 AM, John D Groenveld <mailto:groenv...@acm.org>> wrote:


In message <mailto:c13c1bf5-e345-4e11-963d-eb8c1cdc3...@article7.co.uk>>, Andrew 
Green

writes:
The time has finally come for me to update my mod_perl CMS from 
Apache 2.2 to
Apache 2.4, but I'm struggling to find documentation on the changes 
required


You must configure httpd-2.4 --with-mpm=prefork.

John
groenv...@acm.org <mailto:groenv...@acm.org>




Re: Upgrading a mod_perl application from Apache 2.2 to Apache 2.4

2018-11-30 Thread Adam Prime
There isn’t currently any good documentation for this migration. I went through 
it myself a few months ago, and I ended up using the https changes doc to help 
me when I got strange errors. 

https://httpd.apache.org/docs/2.4/upgrading.html

I was able to get everything working after some fooling around. 

I’ll go through my hit history and post something more detailed later. 

Adam

> On Nov 30, 2018, at 8:02 AM, John D Groenveld  wrote:
> 
> In message , Andrew 
> Green 
> writes:
>> The time has finally come for me to update my mod_perl CMS from Apache 2.2 
>> to 
>> Apache 2.4, but I'm struggling to find documentation on the changes required
> 
> You must configure httpd-2.4 --with-mpm=prefork.
> 
> John
> groenv...@acm.org


Re: Future MPM Support?

2018-08-04 Thread Adam Prime
You should really throw a light weight server that can handle http 2 between 
your clients and your mod_perl machines. It’s not ideal in terms of maximizing 
what http 2 can do, but it can have a very significant impact. 

Adam

> On Aug 4, 2018, at 9:08 PM, Michael A. Capone  
> wrote:
> 
> Yes, http/2 is our primary concern right now.  At the moment, we've made the 
> business decision to stay on mod_perl rather than migrate to another platform 
> and gain http/2 benefits, but for how long can we maintain that decision?  
> I'm honestly not sure.
> 
> Now, we significantly under-utilize mod_perl, mostly doing CGI registry / 
> code caching.  Hey, if it was good 15 years ago, it's   good today! :)  
> But that does mean that there are potentially other options for us to 
> explore, as we're not married to all the bells and whistles that mod_perl 
> provides.
> 
>> On 8/4/2018 5:47 AM, Paul Silevitch   wrote:
>> Also issues with http/2 since it is not supported by prefork mpm anymore.
>> 
>> On Wed, Aug 1, 2018 at 12:44 PM, John Dunlap  wrote:
>>> The biggest deficiency of mod_perl, at the moment, is that it cannot 
>>> provide web sockets. In today's world, that's a huge problem.
>>> 
>>> On Wed, Aug 1, 2018 at 11:30 AM, Robert Smith  
>>> wrote:
 Who in the world would want to abandon mod_perl?
 
 What is this world coming to?
 
 -Robert
 
 > On Jul 30, 2018, at 5:44 PM, André Warnier (tomcat)  
 > wrote:
 > 
 > On 30.07.2018 03:51, Paul B. Henson wrote:
 >> On Sun, Jul 29, 2018 at 04:18:54PM -0400, Paul Silevitch wrote:
 >>> Like Dr. James Smith, I'm hooking into multiple handlers and using 
 >>> filters.
 >> 
 >> Yep, me too; Plack is really not a feature equivilent replacement for
 >> mod_perl :(.
 >> 
 > +1.
 > Plack and other frameworks (TT2, Moose, Catalyst, etc.) cover the web 
 > application side, at different levels and in different ways.
 > But there is (to my knowledge) no equivalent for mod_perl's ability to 
 > interact deeply with the Apache internal Request processing logic.
 > In that respect, comparing mod_perl to Plack etc is like comparing 
 > apples to pears : not very relevant.
 > Considering that, for better or worse, Perl as a programming language 
 > does not seem to be really attractive to the current generation of 
 > software developers anymore, I would not really mind if some tool 
 > equivalent to mod_perl was developed using whichever other scripting 
 > language is currently more in fashion (javascript ? python ? ..), but it 
 > really seems a pity to "slowly abandon" mod_perl without providing some 
 > tool of equivalent power in terms of deep interaction
 >with Apache httpd.
 > 
 > 
 > 
 
>>> 
>>> 
>>> 
>>> -- 
>>> John Dunlap
>>> CTO | Lariat 
>>> 
>>> Direct:
>>> j...@lariat.co
>>> 
>>> Customer Service:
>>> 877.268.6667
>>> supp...@lariat.co
>>> <100x60.png>
>> 
> 


Re: simple question. Not using 2.xxx10. query params

2018-01-09 Thread Adam Prime
libapreq2 (Apache2::Request) does this kind of stuff, or you can use a 
framework that sits on top of mod_perl that handles it for you.  If you 
want to write raw handlers, the libapreq2 is probably the way to go.


https://httpd.apache.org/apreq/docs/libapreq2/

Adam

On 18-01-09 10:18 PM, Chris Bennett wrote:

I am using the 2xxx09 version on OpenBSD.
The manual pages are still unfinished on this version,
so I can't find a way to probe for any particular parameter
such as URL?lang=es=yes=no

$r->args(); just produces a string.

Do I really have to parse strings myself or is there a method
that was undocumented in version 2.09?
The manual page right where this would be explained says it needs
to be finished, which leaves me clueless on how to proceed.




Re: Shared var between processes

2017-10-20 Thread Adam Prime

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, when asking the 
server to set up an environment ($ENV) for sub-processes, than via the 
PerlSetVar mechanism.


You don't need to use $ENV. If you're using handlers you could use 
$r->server()->server_hostname.


You could certainly create a big hash at startup and grab stuff out of 
it that way, where the top level key is the hostname. If the data that 
you want to store is just strings though, this might be overkill. If, 
however, you want to create deeper datastructures from a somewhere, then 
this would be a perfectly acceptable way to do that. PerlSetVar is great 
with just strings, but not for anything any more complicated than that. 
It does have to be static configuration.


All the other limitations that André mentioned are completely accurate 
though.


Adam


Re: Shared var between processes

2017-10-19 Thread Adam Prime
If it doesn't need to change then you should be able to set it in 
PerlPostConfigRequire code, and it will then be available to all 
children in copy on write memory (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 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 first Apache process 
(the parent) level.


Other solution is IPC::Shareable (one more module to load :-/)

Any other solution ?
I would have been happy with an Apache-only way to do this (like I tried 
above).


I need the var to be set only one time to a constant random value, then 
to be read by the different processes.
I then also thought about an environment variable set when Apache 
starts, and then given to Perl using "PerlSetVar var ${VAR}".
But 1. var value would be disclosed into Apache env which I want to 
avoid, 2. PerlSetVar at every request is perhaps not really perfect in 
terms of performance.


Thank you very much for your help !

Ben





Re: access control

2017-10-19 Thread Adam Prime

With a PerlAccessHandler, see:

https://perl.apache.org/docs/2.0/user/handlers/http.html#PerlAccessHandler

Adam

On 17-10-19 06:48 AM, Ken Peng wrote:

Hi,

for a common object on server, for example, http://a.com/b.jpg, when it 
can be accessed by client, I want to apply some access control on it, 
for example, the IP based AC rules. How will mod_perl handler deal with 
this? thanks.



    Regards,
   Ken Peng




Re: use lib error

2016-12-08 Thread Adam Prime

I don't think Modperl::Registry sets the current working directory of of
the process when it runs your script, so that might be why it's having
problems. You can try RegistryPrefork instead, if you're running under
the prefork MPM.  If not, then your script will need to be updated to
assumed that the current working directory is /

I could of course be wrong, but this is something to try at least.

Adam

On 12/08/2016 05:17 PM, mehryar wrote:
> Hi folks,
>
> A noobie question here:
>
> I have a plain simple cgi script in a directory configured for
> Modperl::Registry:
>
> 
> #!/usr/local/bin/perl
> use strict;
> use warnings
>
> use lib '../lib';
> use MyApp;
>
> print "Content-type: text/html\n\n";
> print "hello\n";
> -
>
> This script runs correctly under mod_cgi (without mod_perl), implying
> that perl is able to locate MyApp.pm through use lib '../lib';
>
> Now under mod_perl with PerlSwitches -I/Users/mehryar/Sites/lib
> the script runs correctly as well - but only if I comment out the
> 'use lib...' line. Implying again that mod_perl was able to locate
> MyApp.pm through the -I/Users/mehryar/Sites/lib.
>
> But what I don't understand is why it fails if the use lib '../lib'; line
> is present in the script?
> I get the following error:
> Can't locate MyApp.pm:   Permission denied at
> /Users/mehryar/Sites/cgi/test.cgi
> (This is on my Mac mod_perl2.0.10/Apache2.4.23)
>
> Reading the docs on how @INC is modified is getting me nowhere.
>
> cheers,
> -Mehryar




Re: supporting differing versions of same perl module

2016-11-24 Thread Adam Prime


On 16-11-24 07:22 AM, mod_p...@trodman.com wrote:

Assume two endpoint URLs, one using the current and one using an old
version of a perl module foo.pm for our application. This 2008 article
shows how to prevent conflicts (old app using new foo.pm or vv)
for this situation under modperl:


http://www.slideshare.net/shixilun/module-versioning-with-apache-1x-and-modperl-1x
( 2008. HTML:Mason involved )

What is the new best practice?



This is one of the things PerlOptions +Clone is supposed to be able to 
help with, but i personally have no experience with using or setting it up.


This blog post might be helpful in getting it setup and working:

https://larig.wordpress.com/2010/06/13/apache-configurations-for-perl/

Adam






Re: Modperl as backend for mobile apps

2016-10-31 Thread Adam Prime

On 16-10-31 10:34 AM, John Dunlap wrote:

We do this by processing all requests in an eval block and putting
Apache into assbackwards mode so that we can send a 500 response with a
JSON response body


You can also do it with $r->custom_response[1] from within your mod_perl 
code itself.


https://perl.apache.org/docs/2.0/api/Apache2/Response.html#C_custom_response_

Adam


Re: [RELEASE CANDIDATE] mod_perl-2.0.10 RC1

2016-09-30 Thread Adam Prime

+1 on solaris 10 w/ apache 2.2.31 prefork and perl 5.24.0

all tests pass


Re: [RELEASE CANDIDATE] mod_perl-2.0.10 RC1

2016-09-30 Thread Adam Prime

+1 on ubuntu w/ apache 2.2.31 prefork & perl 5.24.0






Re: [RELEASE CANDIDATE] Apache-Test-1.40 RC1

2016-08-31 Thread Adam Prime

+1 on solaris 10

On 16-08-24 01:02 PM, Steve Hay wrote:

Please download, test, and report back on this Apache-Test 1.40
release candidate.

https://dist.apache.org/repos/dist/dev/perl/Apache-Test-1.40-rc1.tar.gz

MD5  = ecabfbf3a782601aa1511ae3c89601b0
SHA1 = a046f0ccd3a696ecbcaa207dbe92a83c92e5f4c4

=item 1.40-rc1

Specify licence (Apache 2.0) in META.yml. [Steve Hay, CPAN RT#111359]

Fix broken POD. [Steve Hay]

Switch argument order in "openssl gendsa". [rjung]

Add (limited) checks for *_SAN_*_n and *_DN_Email variables. [kbrand]

Update key sizes and message digest to what is common in 2015. [kbrand]

-
To unsubscribe, e-mail: dev-unsubscr...@perl.apache.org
For additional commands, e-mail: dev-h...@perl.apache.org





Re: [mp2] Test failures in mod_perl 2.0.9 (Apache 2.2.31, perl 5.24.0)

2016-07-21 Thread Adam Prime
there are changes in SVN to support perls >= 5.22, but the work hasn't
been released and may not be complete yet.  This is the bug:

https://rt.cpan.org/Public/Bug/Display.html?id=101962

If you can downgrade your perl to 5.20 then you should be able to get
things running.

Adam


On 07/21/2016 05:16 PM, William Ward wrote:
> -8<-- Start Bug Report 8<--
> 1. Problem Description:
>
> Until recently we have been using Perl 5.8.8, Apache 2.2.29, and
> mod_perl 2.0.8. Due to migration to a new platform, it is necessary to
> rebuild our tech stack, so I am taking this opportunity to upgrade
> (Perl 5.8.8 doesn't want to build on the new platform anyway).
>
> Everything compiles fine, and Apache and Perl have no issues but
> mod_perl has failures running "make test":
>
> Test Summary Report
> ---
> t/api/uri.t   (Wstat: 0 Tests: 12 Failed: 0)
>   Parse errors: Bad plan.  You planned 24 tests but ran 12.
> t/apr-ext/uri.t   (Wstat: 65280 Tests: 12 Failed: 0)
>   Non-zero exit status: 255
>   Parse errors: Bad plan.  You planned 36 tests but ran 12.
> t/apr/uri.t   (Wstat: 0 Tests: 12 Failed: 0)
>   Parse errors: Bad plan.  You planned 36 tests but ran 12.
> t/directive/perlloadmodule3.t (Wstat: 0 Tests: 3 Failed: 3)
>   Failed tests:  1-3
> t/filter/both_str_native_remove.t (Wstat: 0 Tests: 8 Failed: 4)
>   Failed tests:  1, 6-8
> t/modperl/print.t (Wstat: 0 Tests: 5 Failed: 0)
>   Parse errors: Bad plan.  You planned 6 tests but ran 5.
> t/modperl/printf.t(Wstat: 65280 Tests: 0 Failed: 0)
>   Non-zero exit status: 255
>   Parse errors: No plan found in TAP output
> Files=245, Tests=2223, 136 wallclock secs ( 1.16 usr 2.63 sys + 80.27
> cusr 35.91 csys = 119.97 CPU)
> Result: FAIL
> Failed 7/245 test programs. 7/2223 subtests failed.
>
> I re-ran the tests mentioned above using -verbose mode, and the
> results are below.
>
> % t/TEST -verbose api/uri apr-ext/uri apr/uri
> directive/perlloadmodule3 filter/both_str_native_remove modperl/print
> modperl/printf
> [warning] setting ulimit to allow core files
> ulimit -c unlimited; /arudev/tech-stack/16.09.16.06/linux/bin/perl
> /scratch/wward/build/tech-stack/build/16.09.16.06/linux/cpan/build/mod_perl-2.0.9/t/TEST
> -verbose 'api/uri' 'apr-ext/uri' 'apr/uri' 'directive/perlloadmodule3'
> 'filter/both_str_native_remove' 'modperl/print' 'modperl/printf'
> /arudev/tech-stack/16.09.16.06/linux/bin/httpd  -d
> /scratch/wward/build/tech-stack/build/16.09.16.06/linux/cpan/build/mod_perl-2.0.9/t
> -f
> /scratch/wward/build/tech-stack/build/16.09.16.06/linux/cpan/build/mod_perl-2.0.9/t/conf/httpd.conf
> -D APACHE2
> using Apache/2.2.31 (prefork MPM)
>
> waiting 120 seconds for server to start: .[Thu Jul 21 14:01:34 2016]
> [info] 6 Apache2:: modules loaded
> [Thu Jul 21 14:01:34 2016] [info] 0 APR:: modules loaded
> [Thu Jul 21 14:01:34 2016] [info] base server + 29 vhosts ready to run
> tests
> ..
> waiting 120 seconds for server to start: ok (waited 2 secs)
> server localhost.localdomain:8529 started
> server localhost.localdomain:8530 listening (perlsections)
> server localhost.localdomain:8531 listening (inherit)
> server localhost.localdomain:8532 listening (filter_out_apache)
> server localhost.localdomain:8533 listening (TestVhost::log)
> server localhost.localdomain:8534 listening (TestVhost::config)
> server localhost.localdomain:8535 listening (TestModperl::setupenv)
> server localhost.localdomain:8536 listening (TestModperl::perl_options2)
> server localhost.localdomain:8537 listening (TestModperl::perl_options)
> server localhost.localdomain:8538 listening (TestModperl::merge)
> server localhost.localdomain:8539 listening
> (TestDirective::perlcleanuphandler)
> server localhost.localdomain:8540 listening (TestModules::proxy)
> server localhost.localdomain:8541 listening (TestUser::rewrite)
> server localhost.localdomain:8542 listening (TestProtocol::echo_bbs)
> server localhost.localdomain:8543 listening (TestProtocol::echo_timeout)
> server localhost.localdomain:8544 listening (TestProtocol::echo_block)
> server localhost.localdomain:8545 listening (TestProtocol::pseudo_http)
> server localhost.localdomain:8546 listening (TestProtocol::echo_filter)
> server localhost.localdomain:8547 listening (TestProtocol::echo_bbs2)
> server localhost.localdomain:8548 listening (TestProtocol::echo_nonblock)
> server localhost.localdomain:8549 listening (TestPreConnection::note)
> server localhost.localdomain:8550 listening (TestHooks::init)
> server localhost.localdomain:8551 listening (TestHooks::startup)
> server localhost.localdomain:8552 listening (TestHooks::hookrun)
> server localhost.localdomain:8553 listening
> (TestHooks::stacked_handlers2)
> server localhost.localdomain:8554 listening (TestHooks::trans)
> server localhost.localdomain:8555 listening
> (TestFilter::both_str_con_add)
> server 

Re: which framework is best suitable for modperl?

2016-07-20 Thread Adam Prime

On 16-07-19 11:55 PM, yhp...@orange.fr wrote:

Though I have written several handlers using mp2, but for further web
development under modperl, what framework do you suggest to go with?

(I have few experience on Dancer, which I don't think work together with
MP).

thanks.


Anything built on top of plack (including Dancer) can be run under 
mod_perl using Plack::Handler::Apache2, so it's really up to whatever 
your personal preference is.


docs on how to run Dancer under mod_perl can be found here:
http://search.cpan.org/dist/Dancer/lib/Dancer/Deployment.pod#Running_from_Apache_with_Plack

That said, any framework you use isn't *really* going to leverage 
mod_perl, as they are all design to just run during the response phase 
of the apache request processing cycle. It's through leveraging that the 
mod_perl's power really shines. You can read more about what I'm talking 
about here:


https://perl.apache.org/docs/2.0/user/handlers/http.html

Adam


Re: [RELEASE CANDIDATE] Apache-Reload 0.13 RC2

2015-04-23 Thread Adam Prime

+1

apache 2.2.24 on solaris

t/TEST  -bugreport -verbose=0
[warning] Skipping 'set unlimited ulimit for coredumps', since we are 
running as a non-root user on Solaris
/oanda/system/bin/httpd  -d /tmp/Apache-Reload-0.13-rc2/t -f 
/tmp/Apache-Reload-0.13-rc2/t/conf/httpd.conf -D APACHE2

using Apache/2.2.24 (prefork MPM)

waiting 60 seconds for server to start: .[Thu Apr 23 11:32:45 2015] 
[warn] module apreq_module is already loaded, skipping

.
waiting 60 seconds for server to start: ok (waited 1 secs)
server localhost:8529 started
[warning] Using random number seed: 1368693243 (autogenerated)
t/reload.t .. ok
All tests successful.
Files=1, Tests=3,  0 wallclock secs ( 0.01 usr  0.01 sys +  0.24 cusr 
0.04 csys =  0.30 CPU)

Result: PASS

apache 2.0.54 on linux

t/TEST  -bugreport -verbose=0
[warning] setting ulimit to allow core files
ulimit -c unlimited; /usr/bin/perl5.8.6 
/tmp/Apache-Reload-0.13-rc2/t/TEST -bugreport -verbose=0
/usr/local/prefork/bin/httpd  -d /tmp/Apache-Reload-0.13-rc2/t -f 
/tmp/Apache-Reload-0.13-rc2/t/conf/httpd.conf -D APACHE2

using Apache/2.0.54 (prefork MPM)

waiting 60 seconds for server to start: ..
waiting 60 seconds for server to start: ok (waited 1 secs)
server localhost:8529 started
t/reloadok 


All tests successful.
Files=1, Tests=3,  2 wallclock secs ( 1.25 cusr +  0.11 csys =  1.36 CPU)
[warning] server localhost:8529 shutdown

Adam




On 15-04-23 08:21 AM, Steve Hay wrote:

Please download, test, and report back on this Apache-Reload 0.13
release candidate.

http://people.apache.org/~stevehay/Apache-Reload-0.13-rc2.tar.gz

MD5 =70720b76ca7b7ab8798c37922c882648
SHA1 = 3836123e4fee33174eb98c06f211f8c60550f46d

[Note: I bumped the version to RC2 to avoid confusion because I made a
couple of internal changes relating to the creation of the
distribution tarball after committing the RC1 version bump.]

=item 0.13-rc2

Fix reload.t. Reported in CPAN RT#96656.
[Steve Hay]





Re: [RELEASE CANDIDATE] Apache-Test-1.39 RC1

2015-04-16 Thread Adam Prime

+1

server localhost:8529 started
[   info] adding source lib /tmp/Apache-Test-1.39-rc1/lib to @INC
t/alltest/allskipped
all skipped: testing all.t
t/alltest2/all...skipped
all skipped: testing more than one all.t
t/bad_coding.ok 

t/cookiesok 

t/import.ok 

t/log_watch..ok 


t/more/all...skipped
all skipped: cannot find module 'mod_perl.c'
t/next_available_portok 

t/ping...ok 

t/redirect...ok 

t/requestok 

t/sokok 


All tests successful, 3 tests skipped.
Files=12, Tests=88, 15 wallclock secs (13.79 cusr +  1.08 csys = 14.87 CPU)
[warning] server localhost:8529 shutdown




On 15-04-08 09:24 AM, Steve Hay wrote:

Please download, test, and report back on this Apache-Test 1.39
release candidate.

http://people.apache.org/~stevehay/Apache-Test-1.39-rc1.tar.gz

MD5  = ee927033dd36bb6befb34443b7353f4f
SHA1 = ab048a92d70b55a44668db240e9c9e3a969ef4a2

=item 1.39-rc1

Test scripts can now test if perl has a fork() implementation
available by using the Apache::Test::need_fork() function. [Steve Hay]

CPAN RT#87620: Add -D APACHE2_4 to identify httpd-2.4. [Michael Schout]

-
To unsubscribe, e-mail: dev-unsubscr...@perl.apache.org
For additional commands, e-mail: dev-h...@perl.apache.org





Re: beginning and testing

2014-10-07 Thread Adam Prime

I'd start by reading this:

http://perl.apache.org/docs/general/testing/testing.html

I'd then suggest taking a look at some of the popular mod_perl modules, 
and check out how their test suites work. Most of the stuff you're going 
to find there will be very unit test specific.


If you want to do functional application testing you'll need to use one 
of the various headless browser emulators out there (htmlunit, selenium, 
phantomjs) to do that, but many of them can be driven through the perl 
test harness one way or the other.


Adam


On 14-10-07 09:23 AM, Patton, Billy wrote:

I’m rewriting/moving an app that hasn’t been touched in over 5 years.  The 
original developers have since left the company.
It’s all written in CGI/OOPerl.
It seems as though the original developers applied the OOW-AHH , look at what I 
can do, instead of KISS.
Simply put they needed a skateboard but built a space shuttle.

So I’m task with taking this Hydra/Medusa cross and converting it to KISS(Keep 
It Simple Stupid)
So I’m going to us mod_perl.  I will be able to use some of their logic and 
code.

At my previous job we had a mantra “design for test”

So from the very first file I create I want to be able to test each step as I 
proceed.
I’ve used, very simply, the .t files for test my library and my apps that run 
from the command line but never some thing from the web.

In the past I’ve used an Oracle product that does web testing, but that’s 
rather expensive.
So have no doubts that Apache and mod_perl have an enormous testing suite 
available for testing my perl and the web site it creates.
IE : Apache:TestRun, Apache::TestRunPerl
When I do
apropos Apache | grep -i test
I get 14 Apache::Test* modules and one Bundle::ApacheTest module.

So I’m looking for a start point.
There is a lot of information, too much for me to digest.
My web app will consist of forms with h-links to another page and some drop 
downs.
A few “enter text” widgets.

I’m beginning to believe that testing in Apache is a completely difference 
world than testing from the command line, as it should be.

I’m just not sure where to start.
Any recommendations would help.





Re: Custom response problem

2014-03-18 Thread Adam Prime
I'm pretty sure you should be using Apache2::Const::SERVER_ERROR, not 
the HTTP_* constants. This could probably be documented better. You 
should likely be returning that constant instead of the HTTP_* ones as well.


Adam

On 14-03-18 11:59 AM, John Dunlap wrote:

I recently upgraded my workstation from Debian 6 to Debian 7 and I'm now
encountering a problem that I haven't seen before. My apache version
is 2.2.22-13+deb7u1. My mod_perl version is 2.0.7-3. I'm guessing that I
have an installation problem of some kind but I'm not sure where to look
for problems. My application works correctly until I attempt to define a
custom response, as follows,

sub handler {
my $apache = shift;
$apache-custom_response(Apache2::Const::HTTP_INTERNAL_SERVER_ERROR, 'hi
mom');
return Apache2::Const::HTTP_INTERNAL_SERVER_ERROR;
}

I see a 500 error, which is what I want, when I access the page. However
the error page is the default apache 500 error response page and I want
to override it. When I look in the logs, I see this:

[Tue Mar 18 15:41:32 2014] [error] [client 127.0.0.1] Can't locate
object method custom_response via package Apache2::RequestRec at
/usr/local/lariat-trunk/qa-trunk/lib/Lariat/V4/WS/RS/BootstrapHandler.pm
line 41.

This would imply, at least to me, that this method is not compiled into
mod_perl or perhaps into apache itself but I cannot be sure. Any
suggestions?

Cheers!
John





Re: Custom response problem

2014-03-18 Thread Adam Prime

I rarely use anything outside of Apache2::Const qw/:common/

:common
Apache2::Const::AUTH_REQUIRED
Apache2::Const::DECLINED
Apache2::Const::DONE
Apache2::Const::FORBIDDEN
Apache2::Const::NOT_FOUND
Apache2::Const::OK
Apache2::Const::REDIRECT
Apache2::Const::SERVER_ERROR

from http://perl.apache.org/docs/2.0/api/Apache2/Const.html

The main exception to that for me is using HTTP_MOVED_PERMANENTLY for 301's.

These constants are all imported from httpd, which is why they might 
differ from the actual HTTP status code from the HTTP spec.


Adam




On 14-03-18 12:42 PM, John Dunlap wrote:

This is something that could definitely be better documented. I've
already been thrown for a loop by them on several occasions. Sadly, you
can't just return the numeric status codes(which are clearly documented
in the HTTP specifications) because the values of the constants do not
match their corresponding HTTP status codes. Things get even more
confusing when you realize that there are also multiple constants for
many of the HTTP status codes. I actually have a hash in my application
that maps numeric HTTP status codes to the correct constants(I hard
coded the constant in my example because I wanted to test the error with
the simplest possible scenario). Because of this, I actually have a hash
in my application that maps numeric HTTP status codes to the correct
constants. That way I can just use the numeric codes(which ARE clearly
document) while also returning the correct constants, assuming that I've
correctly mapped the numeric codes to the correct constants.

With that said, how can I be sure that I'm using the correct constants?
My existing mappings are as follows:
use constant STATUS_MAP = {
'100' = HTTP_CONTINUE,
'101' = HTTP_SWITCHING_PROTOCOLS,
'200' = OK,
'201' = HTTP_CREATED,
'202' = HTTP_ACCEPTED,
'203' = HTTP_NON_AUTHORITATIVE,
'204' = HTTP_NO_CONTENT,
'205' = HTTP_RESET_CONTENT,
'206' = HTTP_PARTIAL_CONTENT,
'300' = HTTP_MULTIPLE_CHOICES,
'301' = HTTP_MOVED_PERMANENTLY,
'302' = HTTP_MOVED_TEMPORARILY,
'303' = HTTP_SEE_OTHER,
'304' = HTTP_NOT_MODIFIED,
'305' = HTTP_USE_PROXY,
'307' = HTTP_TEMPORARY_REDIRECT,
'400' = HTTP_BAD_REQUEST,
'401' = HTTP_UNAUTHORIZED,
'402' = HTTP_PAYMENT_REQUIRED,
'403' = HTTP_FORBIDDEN,
'404' = HTTP_NOT_FOUND,
'405' = HTTP_METHOD_NOT_ALLOWED,
'406' = HTTP_NOT_ACCEPTABLE,
'407' = HTTP_PROXY_AUTHENTICATION_REQUIRED,
'408' = 408,
'409' = HTTP_CONFLICT,
'410' = HTTP_GONE,
'411' = HTTP_LENGTH_REQUIRED,
'412' = HTTP_PRECONDITION_FAILED,
'413' = HTTP_REQUEST_ENTITY_TOO_LARGE,
'414' = HTTP_REQUEST_URI_TOO_LARGE,
'415' = HTTP_UNSUPPORTED_MEDIA_TYPE,
'416' = HTTP_RANGE_NOT_SATISFIABLE,
'417' = HTTP_EXPECTATION_FAILED,
'500' = HTTP_INTERNAL_SERVER_ERROR,
'501' = HTTP_NOT_IMPLEMENTED,
'502' = HTTP_BAD_GATEWAY,
'503' = HTTP_SERVICE_UNAVAILABLE,
'504' = HTTP_GATEWAY_TIME_OUT,
'505' = 505
};





On Tue, Mar 18, 2014 at 12:33 PM, Adam Prime adam.pr...@utoronto.ca
mailto:adam.pr...@utoronto.ca wrote:

I'm pretty sure you should be using Apache2::Const::SERVER_ERROR,
not the HTTP_* constants. This could probably be documented better.
You should likely be returning that constant instead of the HTTP_*
ones as well.

Adam


On 14-03-18 11:59 AM, John Dunlap wrote:

I recently upgraded my workstation from Debian 6 to Debian 7 and
I'm now
encountering a problem that I haven't seen before. My apache version
is 2.2.22-13+deb7u1. My mod_perl version is 2.0.7-3. I'm
guessing that I
have an installation problem of some kind but I'm not sure where
to look
for problems. My application works correctly until I attempt to
define a
custom response, as follows,

sub handler {
my $apache = shift;
$apache-custom_response(__Apache2::Const::HTTP_INTERNAL___SERVER_ERROR,
'hi
mom');
return Apache2::Const::HTTP_INTERNAL___SERVER_ERROR;
}

I see a 500 error, which is what I want, when I access the page.
However
the error page is the default apache 500 error response page and
I want
to override it. When I look in the logs, I see this:

[Tue Mar 18 15:41:32 2014] [error] [client 127.0.0.1] Can't locate
object method custom_response via package Apache2::RequestRec at

/usr/local/lariat-trunk/qa-__trunk/lib/Lariat/V4/WS/RS/__BootstrapHandler.pm
line 41.

This would imply, at least to me, that this method is not
compiled into
mod_perl or perhaps into apache itself but I cannot be sure. Any
suggestions?

Cheers!
John







Re: Dead link in the mod_perl Users mailing list page

2013-12-10 Thread Adam Prime

Should link to here instead:

http://marc.info/?l=apache-modperlr=1w=2

Adam

On 13-12-10 04:47 PM, Vincent Veyron wrote:

Hi,

I noticed that in this page :

http://perl.apache.org/maillist/modperl.html

marc.theaimsgroup.com has been unavailable for a while now

http://marc.theaimsgroup.com/?l=apache-modperlr=1w=2#apache-modperl


It might be best to delete the link?





Re: Apache::DBI connect

2013-11-07 Thread Adam Prime

perl -e if ('0E0') { print qq[hi\n] }
hi

OE0 as a string evaluates to true.  If you use it as a bareword / 
numeric then it's false, which is what your eval example below is doing.


Adam


On 13-11-07 11:29 AM, Xinhuan Zheng wrote:

one correct - In both cases, the return value is evaluated to false.

How do you distinguish?

- xinhuan

From: Xinhuan Zheng xzh...@christianbook.com
mailto:xzh...@christianbook.com
Date: Thursday, November 7, 2013 11:12 AM
To: Perrin Harkins phark...@gmail.com mailto:phark...@gmail.com
Cc: mod_perl list modperl@perl.apache.org mailto:modperl@perl.apache.org
Subject: Re: Apache::DBI connect


I don't actually understand why you did that.  What was wrong with the normal 
ping?


With Oracle DRCP, even though ping succeeds, the connection to the
server process is actually terminated. Or ora_ping() may return 0E0
zero but true and undef. I don't know. ora_ping() is foreign to me. I
made the change based on what Apache::DBI the document said.


In any case, there's no need to change the Apache::DBI code, even with your select 
1 from dual test.   It returns a true value (0E0) if it succeeds and a false value 
(undef) if it fails.


In both cases, the return value is evaluated to true:

200: if ($Connected{$Idx} and (!$needping or eval{$Connected{$Idx}-ping}))

eval{0E0} and eval{undef} both return true. I did test that. How do you
distinguish?


Did your script succeed in reconnecting after it lost the connection?


Yes.


Yes, I haven't forgotten about that, but I haven't had time to work on it yet.  
You can try fixing it yourself by looking at the code in Apache::DBI that 
checks if the server is starting under apache 1.x.  Otherwise, I will 
eventually get to it.


I don't understand that piece of code. I can't do the change. Hope you
can help.

- xinhuan

From: Perrin Harkins phark...@gmail.com mailto:phark...@gmail.com
Date: Thursday, November 7, 2013 11:00 AM
To: Xinhuan Zheng xzh...@christianbook.com
mailto:xzh...@christianbook.com
Cc: mod_perl list modperl@perl.apache.org mailto:modperl@perl.apache.org
Subject: Re: Apache::DBI connect

On Thu, Nov 7, 2013 at 9:46 AM, Xinhuan Zheng xzh...@christianbook.com
mailto:xzh...@christianbook.com wrote:

The $ok is undef. In the case if the test does succeed (like the first select), 
$ok returns 0E0.


That all sounds good.  0E0 is a true value in Perl.  It means zero but
true.  And undef is a false value.  You don't need to test for undef.


Since I changed DBD::Oracle subroutine ping to use 'select 1 from dual',


I don't actually understand why you did that.  What was wrong with the
normal ping?

In any case, there's no need to change the Apache::DBI code, even with
your select 1 from dual test.  It returns a true value (0E0) if it
succeeds and a false value (undef) if it fails.

Did your script succeed in reconnecting after it lost the connection?


I have another request. The Apache::DBI cached a dead database handle for apache 
version 1.3.42 if  startup.pl http://startup.pl create a database handle. The 
apache

child processes inherits this dead handle. It doesn't cause application
error but it does take memory space. If there is many apache processes,
that's not good. Can you please identify and change the code for this
problem?

Yes, I haven't forgotten about that, but I haven't had time to work on
it yet.  You can try fixing it yourself by looking at the code in
Apache::DBI that checks if the server is starting under apache 1.x.
  Otherwise, I will eventually get to it.

- Perrin





Re: Download then display page

2013-04-30 Thread Adam Prime
I think people still generally rely on meta redirects or javascript to 
accomplish this type of behaviour, though I'm curious to know if what 
you describe here actually works across browsers.


Adam


On 13-04-30 02:27 PM, Jim Schueler wrote:

Yes, that's what I have in mind.  I only occassionally write headers.
But I envision something similar to what you've got below:

   $redirect = ... ;## URL to the spreadsheet

   $r-content_type('text/html') ;
   $r-headers_out-set( Location = $redirect ) ;
   $r-send_http_header ;

   $r-print( $content-output ) ;
   return Apache2::Const::REDIRECT ;

Originally, I wondered about using a multipart/mixed response type.
I've never heard that any browser supports such a thing.  Although that
seems like a more elegant solution.

  -Jim

On Tue, 30 Apr 2013, Chris Faust wrote:


But the response should be a redirect to a URL that returns the

spreadsheet instead of a 200 OK.  I believe that the body of the original
response will be displayed until the redirect succeeds.

I'm not sure what I follow you, something like this?

$r-content_type('text/html');
print $content-output;
$r-headers_out-set(Location = $redirect);
return Apache2::Const::REDIRECT;

And the $redirect URL would then do the sending of the file itself?

Thanks!


-Original Message-
From: Jim Schueler [mailto:jschue...@eloquency.com]
Sent: Tuesday, April 30, 2013 1:53 PM
To: Chris Faust
Cc: modperl@perl.apache.org
Subject: Re: Download then display page

I believe the following will work  (never tried it though):

The request should return a 'text/html' type document that displays the
instructions.  But the response should be a redirect to a URL that
returns
the spreadsheet instead of a 200 OK.  I believe that the body of the
original response will be displayed until the redirect succeeds.

In the old days, we performed this trick by using meta tag equivalents of
the response headers.  And I expect browsers will respond to actual HTTP
headers the same way.  I say the old days because for last 18 years,
I've
relied on javascript.  But there may be reasons for not wanting a
different
type solution.

 -Jim




On Tue, 30 Apr 2013, Chris Faust wrote:



Hi,



I'm trying to have a form submission package up the results in a xls
file and then start the download for the user as well as present a
page where they can click on the file if the download has not already
automatically started.



I can do each separately but not both together, I have something like

this:




... Make up our xls file download and put it in $output



$r-content_type('application/xls');

$r-err_headers_out-add('Content-Disposition' = 'attachment;
filename='

.

$download_name . '');

$r-print($output);

$content-param('set some html template vars');

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

print $content-output;



When I due the above, then I get prompted for the download but that is
it, I never get the page. Even if I reverse the order and try to do
the page
first:



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

print $content-output;

$r-content_type('application/xls');

$r-err_headers_out-add('Content-Disposition' = 'attachment;
filename='

.

$download_name . '');

$r-print($output);

$content-param('set some html template vars');



That still doesn't work. Probably not a mod_perl specific question but
I'm hoping someone can shed some light



TIA!

-Chris















Re: About config file

2013-03-07 Thread Adam Prime
On 03/06/2013 11:21 PM, Jon wrote:

 Is there any reason he can't use Config::Any?
 http://search.cpan.org/~bricas/Config-Any-0.23/lib/Config/Any.pm
 http://search.cpan.org/%7Ebricas/Config-Any-0.23/lib/Config/Any.pm



There's no reason why he can't use any Config package, or roll his own
using json, or yaml, or whatever format he prefers.

It could be as simple as this:

package MyConfig;

use Sub::Exporter -setup = { exports = [ qw(get_config) ] };

use YAML::Syck;

my $config;

sub get_config {
if (defined($config)) {
return $config
}
$config = LoadFile('/www/etc/lolol.com/site.yaml');
return $config
}

1;

This particular version will only load the file once, so if you change
the config you need to kick the webserver, but you can tailor this, or
any solution to suit whatever your needs are.

Adam


Re: Apache::DBI

2011-08-03 Thread Adam Prime

On 8/3/2011 2:49 AM, Feng He wrote:

Hi,

Thank you all for the info.

I have finished writting the handler this morning, and have enabled
Apache::DBI in httpd.conf.
My handler is for this url:
http://bizstatus.game.yy.com/upload/

It accept client's uploaded data and write the data to database.
The strange stuff is, when I run more than one process for test, the
items number in database in not correct.

for example:

ab -n 100 -c 1 http://bizstatus.game.yy.com/upload/?arguments

This insert 100 items into database, the select result is correct.

But this one:

ab -n 100 -c 2 http://bizstatus.game.yy.com/upload/?arguments

or:

ab -n 100 -c 3 http://bizstatus.game.yy.com/upload/?arguments


When the client number is larger than one, the items number in
database is not correct.
it's always larger than 100, for example, 101, 102, 103 etc.

So, what's wrong with my program?

Thank you!


The first thing i'd suggest is looking at the access and error logs, and 
seeing if there are anything in there that will tell you what's wrong 
with it.


Nothing looks wrong at first glance to me, though you should check for 
errors on the prepare call.


Adam


Re: Authentication logic [was: Changing browser URL based on condition]

2011-07-17 Thread Adam Prime

On 7/17/2011 1:16 AM, Phil Van wrote:

Back to Vincent's original request about session id and login: how
secure is your session id? Have you signed it? If not, someone can try
to sending random IDs and break your authentication.

Well, if you sign it and sign it properly, you basically end up with the
same idea in those Authen + Ticket + Gate CPAN modules. Besides a time
stamp, you should also sign with user's IP.  If the cookie is stolen,
the origin of IP may protect as the last hope.


Tying a session to an IP can be bad if you use a CDN, or you have 
clients that are behind big multihomed transparent proxies.  AOL users 
in particular used to come from various IP's during a single session.


Adam


Re: No $r = no mod_perl?

2011-07-10 Thread Adam Prime

On 7/10/2011 6:08 AM, Tosh Cooey wrote:

So I'm following your advice and going the easy route of apt-get
everything.

My original server had this config:
Apache/2.2.11 (Ubuntu) mod_perl/2.0.4 Perl/v5.10.0 Server

And two years later we're at:
Apache/2.2.14 (Ubuntu) mod_perl/2.0.4 Perl/v5.10.1 Server

Is that really the state of two years of progress in apt-get packages,
or did I choose the wrong repository?

And so after copying over configs and startups I'm getting this error:

Can't call method auth_name on an undefined value at
/usr/local/share/perl/5.10.1/Apache2/AuthCookieDBI.pm line 284.

Which is: my $auth_name = $r-auth_name;

So the fact that $r is undefined tells me that whatever is running is
NOT running under mod_perl, is this a valid assessment?

Because right now I will have to get into a fight with my sys-admin who
will say it's not working because I didn't configure something
correctly, but my position is if he apt-gets everything and then copies
over the config/startup from the old (working) install then everything
*should* work so he's probably left out something.


This does sounds like something in the config didn't get copied over.  I 
believe your stuff runs as registry/perlrun scripts, so that would be 
the configuration that's missing.


Adam




Re: Measuring response time Apache request

2011-05-24 Thread Adam Prime

On 11-05-24 11:30 AM, marco wrote:

Hi all,
I want to get the response time that Apache spends to serve a request
(from post-read-request phase to the response phase).
Any idea?

Thanks


I'm pretty sure there are messages buried in the archives (from torsten) 
showing how to do this with $r-push_handlers and Time::HiRes (or 
something along those lines).  It's not really that complicated though, 
you basically just have a PostReadRequestHandler that uses push_handlers 
to push a handler into every phase that just logs the current time, or 
whatever it is you want to log.


Adam




Re: Apache2::Filter Intermittently Missing Injected String

2011-03-31 Thread Adam Prime
I wrote a module based on a talk Geoff Young gave a bazillion years ago 
to abstract this problem away (sort of).  You can check it out here:


http://search.cpan.org/~aprime/Apache2-Filter-TagAware-0.02/lib/Apache2/Filter/TagAware.pm

Adam

On 3/31/2011 12:30 AM, Chris Datfung wrote:

On Wed, Mar 30, 2011 at 12:36 PM, Hendrik Schumacher h...@activeframe.de
mailto:h...@activeframe.de wrote:

Am Mi, 30.03.2011, 12:17 schrieb Chris Datfung:

I had a similar problem with a http proxy that injected a string
into the
HTML body. If the response is passed to the filter in multiple parts
there
is a certain probability that the response is split on the string
position
you are looking for (for example part 2 ends with /bo and part 3
starts
with dy). I had to buffer the last bytes of each response part
and take
them into account


Hi Hendrik,

That is exactly the problem. How did you buffer the last bytes of each
response. Don't you just set the BUFF_LEN and thats the number of
characters you get?

Chris





Re: [mp2] php response handler clears authenticated user in mod_perl

2011-01-04 Thread Adam Prime

This is a bug in mod_php not mod_perl isn't it?

Adam


Re: patch for Apache2::SizeLimit under solaris 10

2010-12-06 Thread Adam Prime
What version of SizeLimit were you using?  This was fixed in svn in 
r882407, which was released in 0.93 in October


Adam

On 12/6/2010 4:11 AM, Brett @Google wrote:

Hello,

Here is a patch for  Apache2::SizeLimit under solaris 10, apache 2.2,
unthreaded prefork model :

diff -c ./mod_perl-2.0.4/blib/lib/Apache2/SizeLimit.pm ./SizeLimit.pm
*** ./mod_perl-2.0.4/blib/lib/Apache2/SizeLimit.pm  Mon Dec  6
15:59:43 2010
--- ./SizeLimit.pm  Mon Dec  6 18:41:04 2010
***
*** 52,58 
   if Apache2::MPM-is_threaded();

   # decide at compile time how to check for a process' memory size.
! if (SOLARIS  $Config{'osvers'} = 2.6) {

   $HOW_BIG_IS_IT = \solaris_2_6_size_check;

--- 52,58 
   if Apache2::MPM-is_threaded();

   # decide at compile time how to check for a process' memory size.
! if (SOLARIS  $Config{'osvers'} = 2.6 || $Config{'osvers'} ==
2.10) {

   $HOW_BIG_IS_IT = \solaris_2_6_size_check;

***
*** 133,139 

   sub solaris_2_6_size_check {
   my $file = /proc/self/as;
! my $size = -s $file
   or error_log(Fatal Error: $file doesn't exist or is empty);
   $size = int($size / 1024); # in Kb
   return ($size, 0);
--- 133,141 

   sub solaris_2_6_size_check {
   my $file = /proc/self/as;
! my $file2 = /proc/$$/as;
! my $size = undef;
! $size = -s $file or $size = -s $file2
   or error_log(Fatal Error: $file doesn't exist or is empty);
   $size = int($size / 1024); # in Kb
   return ($size, 0);

Solaris 10 seems to no longer support /proc/self/as (or perhaps just not
in a non-global zone / container)

It does support /proc/pid/as though, pretty much in the same manner
as 2.8. So the thought is just to try both.

The osver conditional breaks after solaris 9, as for Solaris 10 the
version is set to 2.10, which is  2.6 (floating point).

Cheers
Brett





Re: Apache CMS running latest apreq candidate

2010-11-29 Thread Adam Prime

On 11/29/2010 2:27 PM, Joe Schaefer wrote:

A new CMS service was put into place by the ASF
sysadmins over the past few months, and it makes
very good use of subversion, modperl2 and libapreq2.
To see it in action you need to be an Apache committer
and visit https://cms.apache.org/, but the code
is publicly available at

https://svn.apache.org/repos/infra/websites/cms

Would love feedback on the design and implementation
details, especially as it's based on Subversion and
I had a bit of trouble with some of the existing perl
glue for SVN (e.g, couldn't make heads or tails out of
what the glue for `svn status` produces so i used the shell,
and tainted variables don't play well with the glue either).


At $work we built a CMS on top of git, but in python and with a heavy 
helping of ExtJS for tree views and drag and drop support that other 
fancy gui elements.  Having the version control system underneath the 
CMS is incredibly powerful.  We've been using it for our production 
sites for maybe a year and a half now.


I haven't looked at the code, but after a quick walk around the admin 
interface it looks pretty nice.  Quite different from what we did, 
mostly because we wanted non-technical people, and people that had no 
idea what version control was to be able to make the updates, but in 
it's way it's more powerful.  It wouldn't suit our needs quite as well 
as what we've got, but it's definitely a great start.


We've talked about opening ours up, but there's probably a lot of 
non-fun work that would have to happen to be able to do that, so it 
hasn't been pursued very actively.


Adam


Re: [RELEASE CANDIDATE] Apache-SizeLimit 0.92 RC1

2010-08-05 Thread Adam Prime

On 10-08-04 11:14 PM, Philip M. Gollucci wrote:

On 8/4/2010 9:19 PM, Adam Prime wrote:

builds and tests fine on linux w/ 5.8.8 mp2, i'll do solaris x86/sparc
at work tomorrow. This is actually a pretty significant change set, so
it would probably be a good idea to get as much feedback as possible.


Yep, I even vaguely remember writing it :) I rather see run-time tests
in dev/qa/prod then reports that the tests work. They aren't very
extensive.

THX!



I would too, but i don't actually use A::SL at all, so i can't be much 
help in that regard.


Adam


Re: [RELEASE CANDIDATE] Apache-SizeLimit 0.92 RC1

2010-08-05 Thread Adam Prime

builds and tests fine on:

SunOS www01-dtest 5.10 Generic_142901-05 i86pc i386 i86pc Solaris w/ mp2

and

SunOS ii3-dev 5.10 Generic_13-03 sun4v sparc SUNW,Sun-Blade-T6320 
Solaris w/ mp1


+1

Adam


On 10-08-04 09:19 PM, Adam Prime wrote:

builds and tests fine on linux w/ 5.8.8 mp2, i'll do solaris x86/sparc
at work tomorrow. This is actually a pretty significant change set, so
it would probably be a good idea to get as much feedback as possible.

Adam

Philip M. Gollucci wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

http://people.apache.org/~pgollucci/Apache-SizeLimit-0.92-rc1.tar.gz
http://people.apache.org/~pgollucci/Apache-SizeLimit-0.92-rc1.tar.gz.md5
http://people.apache.org/~pgollucci/Apache-SizeLimit-0.92-rc1.tar.gz.sha256

http://people.apache.org/~pgollucci/Apache-SizeLimit-0.92-rc1.tar.gz.asc


item 0.92-rc1

Export USE_SMAPS, VERSION, and REQUEST_COUNT to Apache::SizeLimit
from Apache::SizeLimit::Core.
Call _platform_check_size as a class method to prevent error when
USE_SMAPS=0, RT #33303
Reported by: jgoodri...@alum.dartmouth.edu
[Fred Moyer f...@redhotpenguin.com]

*** HEADS UP - SHARED CODE BASE - HEADS UP ***
Apache-SizeLimit has been hybridized.
It has been split into 3 packages.
1) Apache::SizeLimit - User API for httpd 1.3.x / mod_perl 1.x
2) Apache2::SizeLimit - User API for httpd 2.x / mod_perl 2.x

3) Apache::SizeLimit::Core - Interal Shared Functionality
_NEVER_ use this module directly.
[Philip M. Gollucci pgollu...@p6m7g8.com]

Skip tests on OS X (darwin) due to broken getrusage(3)
[Fred Moyer f...@redhotpenguin.com,
Philip M. Gollucci pgollu...@p6m7g8.com]

Added a SUPPORT section to the docs.
[Dave Rolsky auta...@urth.org]



- -- -

1024D/DB9B8C1C B90B FBC3 A3A1 C71A 8E70 3F8C 75B8 8FFB DB9B 8C1C
Philip M. Gollucci (pgollu...@p6m7g8.com) c: 703.336.9354
VP Apache Infrastructure; Member, Apache Software Foundation
Committer, FreeBSD Foundation
Consultant, P6M7G8 Inc.
Sr. System Admin, Ridecharge Inc.

Work like you don't need the money,
love like you'll never get hurt,
and dance like nobody's watching.
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.14 (FreeBSD)

iD8DBQFMWYZsdbiP+9ubjBwRAtE4AKCD/ttal+pkK3iI8oh9rC7FvSCnggCcC5qo
WHQKFEoMjwxi96qS1SxXMrA=
=JkqO
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: dev-unsubscr...@perl.apache.org
For additional commands, e-mail: dev-h...@perl.apache.org







Re: [RELEASE CANDIDATE] Apache-SizeLimit 0.92 RC1

2010-08-04 Thread Adam Prime
builds and tests fine on linux w/ 5.8.8 mp2, i'll do solaris x86/sparc 
at work tomorrow.  This is actually a pretty significant change set, so 
it would probably be a good idea to get as much feedback as possible.


Adam

Philip M. Gollucci wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

http://people.apache.org/~pgollucci/Apache-SizeLimit-0.92-rc1.tar.gz
http://people.apache.org/~pgollucci/Apache-SizeLimit-0.92-rc1.tar.gz.md5
http://people.apache.org/~pgollucci/Apache-SizeLimit-0.92-rc1.tar.gz.sha256
http://people.apache.org/~pgollucci/Apache-SizeLimit-0.92-rc1.tar.gz.asc


item 0.92-rc1

Export USE_SMAPS, VERSION, and REQUEST_COUNT to Apache::SizeLimit
from Apache::SizeLimit::Core.
Call _platform_check_size as a class method to prevent error when
USE_SMAPS=0, RT #33303
Reported by: jgoodri...@alum.dartmouth.edu
[Fred Moyer f...@redhotpenguin.com]

  *** HEADS UP - SHARED CODE BASE - HEADS UP  ***
  Apache-SizeLimit has been hybridized.
  It has been split into 3 packages.
1) Apache::SizeLimit  - User API for httpd 1.3.x / mod_perl 1.x
2) Apache2::SizeLimit - User API for httpd 2.x / mod_perl 2.x

3) Apache::SizeLimit::Core - Interal Shared Functionality
 _NEVER_ use this module directly.
[Philip M. Gollucci pgollu...@p6m7g8.com]

Skip tests on OS X (darwin) due to broken getrusage(3)
[Fred Moyer f...@redhotpenguin.com,
 Philip M. Gollucci pgollu...@p6m7g8.com]

Added a SUPPORT section to the docs.
[Dave Rolsky auta...@urth.org]



- -- 
- 

1024D/DB9B8C1C B90B FBC3 A3A1 C71A 8E70  3F8C 75B8 8FFB DB9B 8C1C
Philip M. Gollucci (pgollu...@p6m7g8.com) c: 703.336.9354
VP Apache Infrastructure; Member, Apache Software Foundation
Committer,FreeBSD Foundation
Consultant,   P6M7G8 Inc.
Sr. System Admin, Ridecharge Inc.

Work like you don't need the money,
love like you'll never get hurt,
and dance like nobody's watching.
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.14 (FreeBSD)

iD8DBQFMWYZsdbiP+9ubjBwRAtE4AKCD/ttal+pkK3iI8oh9rC7FvSCnggCcC5qo
WHQKFEoMjwxi96qS1SxXMrA=
=JkqO
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: dev-unsubscr...@perl.apache.org
For additional commands, e-mail: dev-h...@perl.apache.org





Re: Sinister variable caching problem with rand()

2010-05-15 Thread Adam Prime

Perrin Harkins wrote:

On Sat, May 15, 2010 at 4:03 PM, Anthony Esposito
tony.m.espos...@gmail.com wrote:

In one of my programs I started to receive database errors for not having a
unique id. I generate unique ids for each of the mysql lines that I add to
the database. I realized that the perl variable $idNum was keeping the same
random string for multiple executions.


You need to call srand() in s a child init handler:
http://marc.info/?l=apache-modperlm=123904225030744w=1

However, I have to ask, why are you generating id numbers randomly?
Why not just let mysql  do it with auto_increment?

- Perrin


I think, in theory you shouldn't have to explicitly srand yourself in 
your startup.pl if you're using mod_perl 1.29 or greater, and perl 5.8.1 
or greater.


see:

http://marc.info/?l=apache-modperl-devm=106606815110220w=2

Adam



Re: Apache2::AuthCookie

2010-05-10 Thread Adam Prime

Michel Jansen wrote:

Hi,

Since i understand that http-authentication is not used much and because
it is impossible to logout from an authenticated session without closing
the browser i am looking at Apache2::AuthCookie to replace
http-authentication. I installed the module but i need some more
examples to get things going. Can anyone help me out? Currently i get
the error configuration error:  couldn't check user.  No user file? in
the apache log but i cannot find the place where i should store the
passwd file?

Is it possible to connect AuthCookie to AuthDBI?


You might want to take a look at:

http://search.cpan.org/dist/Apache2-AuthCookieDBI/

Adam


Re: Getting NYTProf to work with vhosts that use PerlOptions +Parent

2010-04-28 Thread Adam Prime
Maybe you could try doing the push_handler for the ChildExitHandler when 
the ChildInitHandler executes?  Just a shot in the dark.


Adam

Tim Bunce wrote:

This is proving to be tricky.

If I load Devel::NYTProf::Apache[1] in the main part of httpd.conf then
I get a profile that includes all the activity *except* for any activity
in vhosts that use +Parent.

If I load it inside the VirtualHost section then I get a profile of
activity within that vhost. Great. Except there's a problem...

For a profile to be useful it must be terminated properly. Devel::NYTProf
does that using an END block. Devel::NYTProf::Apache does that using

sub child_exit { DB::_finish() }

my $s = Apache2::ServerUtil-server;
$s-push_handlers(PerlChildExitHandler = \child_exit);

That works fine normally, but doesn't work with PerlOptions +Parent.
I get an error:
[error] lookup of 'Devel::NYTProf::Apache::child_exit' failed

I presume that's because the $s doesn't refer to the vhost I'm in.
I can use $s-next (after require Apache2::ServerRec) to iterate over
the vhosts but I can't see a way to find my vhost.

Is there one?

What I'm looking for is some way for *a specific vhost perl interpreter*
to run code at PerlChildExitHandler *in that interpreter*.

Any ideas?

Tim.

p.s. Simply adding END { DB::_finish() } to Devel::NYTProf::Apache gives
me a profile that ends during server initialization because the vhost
perl interpreter is initialized using perl_run() and PL_exit_flags |=
PERL_EXIT_DESTRUCT_END has not been set.  So I've now set PL_exit_flags
via NYTProf and that's giving me a usable profile for my limited case.
I've not yet looked-into how to generalise that into code that's work in
normal (non +Parent) case.

[1] 
http://cpansearch.perl.org/src/TIMB/Devel-NYTProf-3.11/lib/Devel/NYTProf/Apache.pm




Re: accessing environment variables set by other modules

2010-04-15 Thread Adam Prime
You need to use $f-r-subprocess_env in the filter.  subprocess_env is 
a RequestRec method, not a Filter method.


Adam

Chris Datfung wrote:
On Thu, Apr 15, 2010 at 12:23 AM, Perrin Harkins phark...@gmail.com 
mailto:phark...@gmail.com wrote:


The subprocess_env info that Adam sent you should have worked.  Can
you show us what you tried?  Can you try it in a response handler to
make sure it's not an odd bug with filters?


Hi Perrin,

Thanks, subprocess_env works when just using a response handler. When 
used with a filter I get the following error message:


==
[Thu Apr 15 11:47:34 2010] [error] [client 127.0.0.1] Can't locate 
object method subprocess_env via package Apache2::Filter at 
/opt/modperl//TE/ST.pm line 40.\n
[Thu Apr 15 11:47:34 2010] [debug] core.c(3765): [client 127.0.0.1] 
(500)Unknown error 500: default_handler: ap_pass_brigade returned 500
[Thu Apr 15 11:47:34 2010] [error] [client 127.0.0.1] Can't locate 
object method subprocess_env via package Apache2::Filter at 
/opt/modperl//TE/ST.pm line 40.\n

==

Can I test the script to use Apache2:RequestRec for the subprocess_env?

The source of the package is as follows:
==
package TE::ST;

use strict;
use warnings;
use Apache2::Filter ();
use Apache2::RequestRec ();
use Apache2::RequestIO ();
use APR::Table ();

BEGIN { push @INC, /opt/modperl/; }

use Apache2::Const -compile = qw(OK);
use constant BUFF_LEN = 1024;

sub handler 
{

my $f = shift;
$f-subprocess_env;
my $envar = $ENV{TE};


unless ($f-ctx)
{   
while ($f-read(my $buffer, BUFF_LEN))

{
$buffer =~ s/It/Chris/g;
$buffer .= [ . $envar . ];
$f-print($buffer);
}
return Apache2::Const::OK;
}
}
1;
==

Finally, the TE Apache environment variable is set in the virtual host 
config via:


SetEnv TE TEST
 
Thanks,

- Chris





Re: accessing environment variables set by other modules

2010-04-12 Thread Adam Prime

you might want to take a look at subprocess_env

http://perl.apache.org/docs/2.0/api/Apache2/RequestRec.html#C_subprocess_env_

I don't think i've every tried to use %ENV in a Filter, perhaps it's not 
getting populated.  %ENV can be a little strange in mp2, have a look at:


http://perl.apache.org/docs/2.0/user/troubleshooting/troubleshooting.html#C_Libraries_Don_t_See_C__ENV__Entries_Set_by_Perl_Code

though that would seem to be unrelated to your issue.

Adam


Chris Datfung wrote:
I want to use mod-perl to edit server responses under certain 
conditions. My plan was to use various modules, like mod-setenvif and 
mod-security to set an environment variable and then have mod-perl edit 
the response body only run when the environment variable is set. I tried 
the following test which was supposed to append 'TEST' to my index.html 
page:


in the virtual host config I have:

SetEnvIf Request_URI \.html$ TE=TEST
PerlRequire /opt/modperl/TE/ST.pm
PerlOutputFilterHandler TE::ST

the contents of /opt/modperl/TE/ST.pm is:
==
package TE::ST;

use strict;
use warnings;

use Apache2::Filter ();
use Apache2::RequestRec ();
use APR::Table ();

BEGIN { push @INC, /opt/modperl/; }

use Apache2::Const -compile = qw(OK);
use constant BUFF_LEN = 1024;

sub handler
{
my $f = shift;

unless ($f-ctx)
{
while ($f-read(my $buffer, BUFF_LEN))
{
$buffer =~ s/It/Chris/g;
$buffer .= $ENV{TE};
$f-print($buffer);
}
return Apache2::Const::OK;
}
}
1;


The script correctly changes the 'It' in the index.html file to 'Chris' 
but I don't see the value of the 'TE' variable in the response body. Can 
someone point me to an example of how modperl can 
access environment variables set by other apache modules?


Thanks,

- Chris




Re: Usefulness of $r-notes and $r-pnotes (or $c)

2010-03-23 Thread Adam Prime

Michael Peters wrote:

On 03/23/2010 05:28 PM, Michael Ludwig wrote:


What could be done at the connection level?


Anything that might involve keep alive connections: where the same 
connection serves multiple requests. Probably not that useful for HTTP, 
but might be for other protocols.




Fred did something fancy (connection rate limiting) with $c-pnotes 
recently.  see his post about it here:


http://marc.info/?l=apache-modperlm=124217947427395w=2




Re: Upgrading chained response handlers to mod_perl2

2010-03-13 Thread Adam Prime

Iain Kennedy wrote:

Hi,

Is there a data structure that gets passed to each response handler in
the chain that the processed file can be stored in (like $f-ctx)?

Can the old mod_perl1 -filter_input behaviour be done by manipulating
the input_filter or output_filter stacks?

Is what I'm trying to do vaguely sane, even? With the following directive:

PerlResponseHandler +Module::Test1 +Module::Test2


I'm not sure, but i don't think you can really do that in mp2, i think 
you need to read about how filters work in mp2, then do something like


PerlResponseHandler Module::Test1
PerlOutputFilter Module::Test2

where Module::Test2 has been rewritten using the filter API.  Geoff 
Young gave a talk about filters at an apachecon many moons ago that i 
found particularly helpful, you can still find the slides here:


http://www.modperlcookbook.org/~geoff/slides/ApacheCon/2006/mp2_filters-printable.pdf.gz



Having both Test1 and Test2 process the HTML response body in turn with
mod_perl1 was pretty straightforward. I reckon I must be missing
something pretty obvious, surely?

Iain


HTH,

Adam


Re: [RELEASE CANDIDATE] Apache-Test-1.31 RC1

2010-02-09 Thread Adam Prime

I get the following when trying to run make test:

waiting 60 seconds for server to start: .Syntax error on line 73 of 
/local/aprime/Apache-Test-1.31-rc1/t/conf/httpd.conf:
Invalid command 'IfVersion', perhaps misspelled or defined by a module 
not included in the server configuration

[  error]
server has died with status 255 (t/logs/error_log wasn't created, start 
the server in the debug mode)
sh: line 1: 32276 Terminated  /usr/bin/perl 
/local/aprime/Apache-Test-1.31-rc1/t/TEST -bugreport -verbose=0

make: *** [run_tests] Error 143

Presumably because apache is compiled without mod_version (which is the 
default)


Adam



Fred Moyer wrote:

Greetings,

Please, download, test, and report back on success or failure for this
Apache::Test release candidate.

Development from 1.30 has been ongoing for about two years, so this is
as good a time as ever to make a release.

http://people.apache.org/~phred/Apache-Test-1.31-rc1.tar.gz

-
To unsubscribe, e-mail: dev-unsubscr...@perl.apache.org
For additional commands, e-mail: dev-h...@perl.apache.org





Apache 1.3 end of life

2010-02-03 Thread Adam Prime

FYI

The Apache Software Foundation and the Apache HTTP Server Project are 
pleased to announce the release of version 1.3.42 of the Apache HTTP 
Server (Apache). This release is intended as the final release of 
version 1.3 of the Apache HTTP Server, which has reached end of life status.


There will be no more full releases of Apache HTTP Server 1.3. However, 
critical security updates may be made available from the following website:


http://www.apache.org/dist/httpd/patches/

see:

http://www.apache.org/dist/httpd/Announcement1.3.html


Re: Redirect WTF

2010-01-27 Thread Adam Prime

David E. Wheeler wrote:

Fellow mod_perlers,

snip

Note that the hosthame is benedict.local. Now I often just use localhost when 
using Bricolage, and most of the time that works fine. But there is one 
JavaScript-triggered redirect button that looks like this:

window.location.href = '/admin/profile/dest?id=1024'

And when I click it, The request goes to mod_perl and I see it come through the 
access handler and the fixup handler as a request to localhost. But then the 
PerlReponseHandler never fires! Instead, I see another request come in for the 
same URL path, but this time for the host name benedict.local. It's almost as 
if something in Apache or mod_perl is seeing that the request is for a 
different domain name and helpfully trying to redirect. But it's not helpful (I 
get a new login screen), and I don't understand why the same thing doesn't 
happen for other requests.

Is there something like that in mod_perl2 and I'm just missing it? Or is it 
more likely that there's some other mysterious bit of code in Bricolage that's 
doing it and I just haven't found it yet? If the latter, what comes between the 
PerlFixupHandler and PerlResponseHandler? Because in that first request, the 
fixup handler fires but the response handler never does.



This smells like a UseCanonicalName On + mod_dir redirect to me.  If the 
directory /admin/profile/dest exists in the document root, there's a 
good chance it is.


HTH,

Adam


Re: Redirect WTF

2010-01-27 Thread Adam Prime

David E. Wheeler wrote:

On Jan 27, 2010, at 7:23 AM, Adam Prime wrote:


This smells like a UseCanonicalName On + mod_dir redirect to me.  If the 
directory /admin/profile/dest exists in the document root, there's a good 
chance it is.


Ooh, thanks! I can see that I have mod_dir as a DSO, but I'm not loading it. 
The only modules loaded are:

LoadModule   perl_module /usr/local/apache2/modules/mod_perl.so
LoadModule   expires_module modules/mod_expires.so
LoadModule   apreq_module modules/mod_apreq2.so

Might the core be loading it somehow?


It appears that mod_dir is compiled and loaded by default unless you 
take steps to exclude it:


http://httpd.apache.org/docs/2.2/mod/mod_dir.html

http://httpd.apache.org/docs/2.2/mod/module-dict.html#Status

Adam


Re: Getting DBI working during the server life cycle

2010-01-23 Thread Adam Prime

Boysenberry Payne wrote:

Hello,

I'm trying to connect to my postgresql database using the DBI - Apache::CBI - 
DBD::Pg combination of modules.
I'm having trouble understanding Apache::DBI usage as it pertains to https pre 
request server life cycle, in particular during the OpenLogs stage.
My trouble comes from an error I'm getting from DBI:

Global $r object is not available. Set:
PerlOptions +GlobalRequest
in httpd.conf at /usr/local/lib/perl5/site_perl/5.10.1/Apache/DBI.pm line 144.

So, obviously, the Apache::RequestRec object hasn't been globalized because 
it's before the request stage (the child processes haven't even been forked 
yet.)
If I use DBI in my startup.pl file first, no problems, but Apache::DBI says to 
have it load before DBI to use the persistent connections it offers, thus my 
dilemma.

So, what do I do?


Don't use Apache::DBI 1.07 and try to do this, because as you've 
discovered, it's broken.


see: http://rt.cpan.org/Public/Bug/Display.html?id=36346

Adam




Re: SetHandler perl-script not working

2010-01-12 Thread Adam Prime
Can you post the error message(s)?  Theres nothing obviously wrong with
what you've got there.

Adam

Kevin Thorpe wrote:
 Hi all,
   I have a serious problem with sethandler perl-script not working. 
 For testing I have enabled perl-status:
 
 Location /perl-status
 SetHandler perl-script
 PerlResponseHandler Apache2::Status
 Order deny,allow
 Allow from all
 /Location
 
 ...but I'm still getting 404 for the URL. I'm definitely reading the 
 file as adding a syntax error in the above causes httpd -t to fail. It 
 is quite a complex install though with Drupal and Scalix (which uses 
 tomcat and ajp proxy). Can anyone suggest how to go about fixing this?
 
 Thanks
 
 Don't worry about the allow from all, it's a private box and I'll remove 
 it again. 



Re: content_length

2009-11-24 Thread Adam Prime

Ryan Perry wrote:

How do I get the content length of the request body? or the equivalent  of 
$ENV{'CONTENT_LENGTH'} ?

my $current_read = $r-read($current_buffer, $current_length - 
$current_remaining, $current_remaining);

Thanks!



Content-Length is just a header, so you get it through headers_in.

mp2:

http://perl.apache.org/docs/2.0/api/Apache2/RequestRec.html#C_headers_in_

mp1:

http://perl.apache.org/docs/1.0/api/Apache.html#_r_E_gt_headers_in

Adam


Re: Dynamically setting PerlVars in Apache per-request

2009-11-23 Thread Adam Prime


My suggestion would be to subclass AuthDBI to make the constructor 
fiddle with the dir_config entries that AuthDBI uses.


See the docs for dir_config (the perl interface to PerlSetVar variables:

http://perl.apache.org/docs/2.0/api/Apache2/ServerUtil.html#C_dir_config_

I have no idea how subclass friendly AuthDBI is or isn't.

Adam



Tosh Cooey wrote:

WAS: A better way to handle multiple client authentication?

Yeah I use something similar in another application, but in this 
application I actually need to change the Auth_DBI_data_source variable 
since the FROM pwd_table would actually need to be FROM 
clientA.pwd_table and I can't see how to set this on the fly.  I could 
probably also set the: Auth_DBI_pwd_table variable as well, but again 
the per-request setting is what's throwing me off.


PerlSetVar Auth_DBI_data_source   DBI:mysql:clientA
or
PerlSetVar Auth_DBI_pwd_table clientA.pwd_table

Which is why I thought:

RewriteRule ^/(.+)/$ PerlSetVar Auth_DBI_data_source DBI:mysql:$1

I was hoping a SetEnvIf or IfDefine would work but after reading more 
about Apache configuration I see it won't.


Anyway, this is straying too far into Apache territory so I guess I will 
just set those variables within a modified Apache::AuthDBI


I guess if anyone already knows an auth module that does that above that 
would be awesome, or if anyone knows how to easily change PerlVars on 
the fly within the Apache config/htaccess space that's be great, 
otherwise it's a small change to the above module.


Thanks again!

Tosh


William T wrote:

The documentation alludes to the variable 'pwd_whereclause'.  If this
variable is set it will be used in the passwd query.  I would try and
set it per client so that the query gets an additional where clause:

   SELECT pwd_field FROM pwd_table WHERE uid_field = user AND client = 
clientA


  

I havn't actually tried this so I don't know if there are any caveats,
but from the docs at least it seems possible.  The only trick is
making sure you can reset the pwd_whereclause with each different
client url, and make client an additional column in your pwd_table.

--
-wjt







Re: code in perl sections executed twice in same process?

2009-11-17 Thread Adam Prime

E R wrote:

The perl sections don't seem to be executed in the children.


use a PerlChildInitHandler if you want to run code in the children.


Is there a way to determine which pass you are in?

For large mod_perl apps, is there a way to avoid loading your code in twice?

Note I am using mod_perl 1.3.41.


In mp1, use $Apache::Server::Starting, and $Apache::Server::ReStarting. 
 see here:


http://perl.apache.org/docs/1.0/guide/config.html#Apache_Restarts_Twice_On_Start

Adam



new book with mod_perl content

2009-11-12 Thread Adam Prime

Developing Web Applications with Apache, MySQL, memcached, and Perl
Patrick Galbraith

http://ca.wiley.com/WileyCDA/WileyTitle/productCd-0470414642,descCd-tableOfContents.html

I saw this mentioned in a blog post, and had a look at the table of 
contents, and there are a couple of chapters about mod_perl.  Does

anyone have or know anything about this book?

Adam


Re: FreeBSD 7.2, mod_perl2 Apache2::Cookie (libapreq2)

2009-10-29 Thread Adam Prime

You guys might want to take a look at this thread on apreq-dev

http://marc.info/?t=12420765987r=1w=2

Specifically the last couple of posts from pgollucci (who is a freebsd, 
and mod_perl committer).  If you can't get apreq2.12 to work, try 2.08.


Adam




Joe Niederberger wrote:

How do I find out what *all* the special options needed are?

Thanks,
Joe N.

- Original Message - 
From: gl...@gallien.net

To: mod_perl list modperl@perl.apache.org
Sent: Thursday, October 29, 2009 12:14 PM
Subject: Re: FreeBSD 7.2, mod_perl2  Apache2::Cookie (libapreq2)


I've been using apache2/mod_perl2 on FreeBSD for years. Currently using 
6.3 and 7.2. Installing from ports should work fine, but I prefer to 
install separate versions of apache2 and mod_perl2 from source. Haven't 
had a problem installing either of those in sometime. Installing 
libapreq2 on FreeBSD requires some special options, like passing 
--with-expat=/usr/local to configure and using gmake.


-Glenn






Re: Apache2::Request-param fails with POST

2009-10-22 Thread Adam Prime
It seems like your libapreq install is broken or something.  Did it pass 
all the tests when you built it?


Adam

nmittal wrote:

I have tried that but it still doesnt work. I even tried to POST an empty
form (with no GET or POST params) with same results


Michael Peters wrote:

On 10/21/2009 06:12 PM, nmittal wrote:

Hi I am using Apache2.2 and mod_perl. I have a login page that POSTs to
an
authentication script.
form method=POST
action=/authenticate?sid=06eff4cdc3231db0236cdbe2c51e6618
Try not mixing GET and POST parameters. Put that sid as a hidden input 
in the form instead of a GET parameter on the query string? Technically 
you're not supposed to mix the 2, but most systems allow it anyways. But 
maybe it's tickling a bug here.


--
Michael Peters
Plus Three, LP








Re: Apache2::Request-param fails with POST

2009-10-21 Thread Adam Prime

nmittal wrote:

Hi I am using Apache2.2 and mod_perl. I have a login page that POSTs to an
authentication script.
form method=POST
action=/authenticate?sid=06eff4cdc3231db0236cdbe2c51e6618 
table 
tr 
	td align=rightUser(or email): /td 
	tdinput type=text name=email value=/td/tr 
tr 
	td align=rightPassword: /td 
	tdinput type=password name=password/td/tr/table 
input type=submit value=LoginBR 
/form 


on the server side.. I have the following code...

use Apache2::Request;
use Apache2::SubRequest;
use Apache2::RequestRec ();
use Apache2::Upload;
use Apache2::URI;

my $r = shift;
my $req = Apache2::Request-new($r);

#Get the Query String and POST data
log(PROCESS, MESSAGE, Inside);
my @keys = $req-param;
log(PROCESS, PARAMS, Dumper($req-param));

when I post the form, the logs show till Inside and the browser keeps
loading the page, the CPU consumption on the server is 100% by httpd.

however, if I change the form so it uses GET instead of POST, everything
works fine. 


Obviously that shouldn't happen.  Is there anything in the error log? 
What version of apreq are you using?


Adam


Re: Custom INC per-directory

2009-10-20 Thread Adam Prime

Alan Young wrote:

Wouldn't using the Parent option (
http://perl.apache.org/docs/2.0/user/config/config.html#C_Parent_ )
work better for what you're trying to do?


Parents requires vhosts, which he said he doesn't want to use.

Adam


Re: Plack

2009-10-15 Thread Adam Prime

Jonathan Vanasco wrote:


Has anyone here played with Plack yet ? ( http://plackperl.org/ )

It's about a week old or so publicly, but I'm sure a few of you folks 
here were privvy to a preview...




I haven't played with it, but i have read a bunch of Miyagawa's blog 
posts about it.  I do know that Jeff Horwitz is planning to support WSGI 
in mod_parrot / mod_perl 6, but i don't know exactly what that means ;)


Adam


Re: Configuring virtual hosts on the fly

2009-10-12 Thread Adam Prime
Scott Gifford wrote:
 Hello,
 
 I'm working on an Apache configuration for a cluster of machines
 serving a variety of virtual hosts.
 
 New virtual hosts are provisioned by a Web application, and all
 information needed to set up the virtual hosts is in a database table.
 I would like my Apache to set up the virtual hosts on the fly based on
 information in the tables.
 
 I have seen examples for generating the virtual hosts configuration
 from a database when Apache starts.  That leaves me with the problem
 of how the unprivileged Web application doing the provisioning can
 reliably trigger a reload across an entire cluster, and also what to
 do if something goes wrong so I don't end up with a whole cluster of
 dead Web servers.
 
 It seems much cleaner to me to let Apache look up the information for
 a virtual host as it is needed.  Conceptually, when each request comes
 in, I would like Apache to look at the Host: header, build a temporary
 virtual host entry from that, and use it to service the request.  I
 will use caching to make it reasonably fast.  Then the provisioning
 script just writes to the database table and is done, and I can handle
 any errors on a per-request basis without Apache failing to start.
 
 I see some hooks in PerlTransHandler and PerlMapToStorageHandler that
 seem like they can almost do what I want, but I don't see how to set
 other virtual host parameters, like ServerAdmin, UseCanonicalName,
 etc.
 
 I'm just starting to work on this, and I thought I would see if
 anybody had tried anything similar before and had some suggestions for
 what to do, or what not to do.
 
 Thanks!

I did some cursory investigation into something sort of like this, at
least the idea that the application would be able to create new virtual
hosts, and that those vhosts should start 'working' (for some definition
of working) immediately.

The approach that I had intended to take with regards to getting the
name based vhosts to work immediately (without a restart) was to have a
default virtual host that would detect requests that were coming in for
vhosts that we should be able to handle, and then setting up the handler
stack for that request using push_handlers in an init handler.  There
are some problems with this approach (segmenting logs for one), but the
idea for me was to get the thing to work right away, and if it took
until the next restart to get the vhost actually configured as a vhost
properly, that wasn't a huge deal.

Not sure if that's any help or not, but...

Adam


Re: huge httpd processes

2009-09-30 Thread Adam Prime

Justin Wyllie wrote:

Hi clint

Yes. Linux and this script looks good. We've think that part of the problem
is in the modules Apache is loading so this will be useful.

I also have another couple of questions:

I have found the errant code where our process jumps by 13 Mbs. One part
does something like this:

$file_handle-read($s, $length); #$s is  about 1/2 Mb
@data = unpack($format , $s);
##at this point memory usage jumps by 8 Mbs (measured using GTop-size() )


As Clinton said, perl doesn't free the memory back to the OS when you 
slurp this file into ram.  If you really want to free up the resources 
(which will get reused by subsequent requests, they just aren't 
available to the OS) you can use $r-child_terminate to make that child 
die after handling that request, which will free the resources (and 
likely spawn another child in it's place.


Adam


Re: Why people not using mod_perl

2009-09-17 Thread Adam Prime

Jeff Horwitz is working on mod_parrot and mod_perl6

mod_parrot info:
http://www.parrot.org/mod_parrot

Jeffs blog:
http://www.smashing.org/jeff/

It's coming along, but currently it's tough to actually do much that's 
useful without things like DBI, or Apache::Request.  at least that's 
where it was at YAPC.


Adam


Boysenberry Payne wrote:

I wonder if this will still be the case with Parrot and Perl 6?
I've read up on it a bit and with being able to compile multiple 
languages exposing their libraries to each other it would seem more 
programmers might be tempted into using Perl because of it's massive 
library base.

What are the plans for mod_perl with perl 6?

Thanks,
Boysenberry Payne

On Sep 16, 2009, at 9:31 PM, Jeff Peng wrote:

from what you all stated, does it mean mod_perl is really outmoded 
comparing to Java?

Here Java programmer is cheaper than mod_perl developer.
But if mp can get better performance, we may consider it as first choice.

Regards,
Jeff.






Re: Why people not using mod_perl

2009-09-17 Thread Adam Prime

Torsten Foertsch wrote:

On Thu 17 Sep 2009, Kiran Kumar wrote:

I have seen padre first time at the this year German perl workshop in 
February and tried it out a bit. What I miss is syntax highlighting and 
indentation for C, XS and Perl in one tool. Can padre handle this? Last 
time I looked it could not but that was half a year ago.


I am using Emacs for almost 20 years now but it lacks good XS support.


Padre has been advancing rapidly over the last 6 months or so.  I 
haven't actually used it, but the syntax highlighting for perl is 
supposed to be the best there is in any editor (since it uses PPI)


I don't know about XS or C support, but padre is pluggable, and they are 
always looking for more help.  #padre on irc.perl.org


Adam


Re: Ways to scale a mod_perl site

2009-09-16 Thread Adam Prime

Igor Chudov wrote:



On Wed, Sep 16, 2009 at 11:05 AM, Michael Peters mpet...@plusthree.com 
mailto:mpet...@plusthree.com wrote:


On 09/16/2009 11:49 AM, Igor Chudov wrote:

1) Use a load balancer like perlbal (I am already doing that)


A load balancer is good but so are proxies. If you can separate your
application server from the server that servers static content then
you'll get a boost even if they are on the same machine.


I have very little static content. Even images are generated. My site 
generates images of math formulae such as (x-1)/(x+1) on the fly.,


I can understand generating them on the fly for flexibility reasons, but 
I'd cache them, and serve them statically after that, rather than 
regenerate the images on every single request.  You can accomplish that 
in the app itself, or just by throwing a caching proxy in front of it 
(maybe you're already doing this with perlbal)


Adam


Re: FW: Apache::DBI Failed due to +GlobalRequest

2009-09-12 Thread Adam Prime
Kulasekaran, Raja wrote:
 Hi,
 
 Great. I guess this might solve the problem.
 
 I had found in one of the forum stating that  we can write a handler
 which generates the “$r” global object  before initiate the Apache::DBI
  connection .  Is that possible ? .
 
 Otherwise, Shall I  install Apache::DBI 1.06 instead of Apache::DBI 1.07 ?

I would recommend running 1.06 until a new version is pushed with this
issue fixed.

Adam


Re: PerlSwitches -I

2009-09-04 Thread Adam Prime

Artem Kuchin wrote:

I have run into a problem. I want to have my packages
precompiled in apache process with

PerlModule X:Y

X:Y is my own package with is located in the site directory.
The site is a virtual host.

However, this apache also has many other virtual hosts with ALMOST the same
software with a package named X:Y, but a little bit modified.

So, in those virtual hosts i also need PerlModule X:Y

The problem is that mod_perl cannot find X:Y until i specify
PerlSwitches -I/host1/dir

But this works globally and cannot be specified per virtual host. I am 
stuck here,

but i need this personalizaed for each virtual host.

Any workaround?


PerlOptions +Parent
http://perl.apache.org/docs/2.0/user/config/config.html#C_Parent_

I personally don't have any experience with this, but there are a number 
of threads in the archives about it, some of which actually do have 
confirmation that people managed to get it working right (IIRC)


Adam


Re: RFC: Apache2::CloseKeepAlive

2009-08-28 Thread Adam Prime

Michael Ludwig wrote:

Sprites are useful for collections of related of the same size and
purpose.


You don't have to restrict them to images of the same size.  You can use 
a sprited image to replace any fixed size image, and any background 
image that repeats in one direction or the other (but not both).  One 
caveat about that though is that background images don't print in most 
(maybe all) current browsers.


In experiments with sprites and changes to some JS, we've managed to 
reduce render times on our websites by nearly half, and reduced the 
number of elements retrieved from the page to about a quarter of what 
they used to be in some cases.


Adam




Re: Rotate log in mod_perl

2009-08-28 Thread Adam Prime

Shibi NS wrote:

My httpd.conf has following

Perl
$ErrorLog   =  |bin/rotatelogs 
$config-{log_file}.%Y-%m-%d-%H_%M_%S 5M;
#$TransferLog=  |bin/rotatelogs 
$config-{log_accessfile}.%Y-%m-%d-%H_%M_%S 5M;

/Perl

But server start fails

 $parms-add_config() has failed: ErrorLog takes one argument, The 
filename of the error log at  
/src/linux/lib/perl5/site_perl/5.8.8/i686-linux-64int/Apache2/PerlSections.pm 
line 215.\n




I'm pretty sure you just need to embed some quotes in that string.

$ErrorLog =
   qq[|bin/rotatelogs $config-{log_file}.%Y-%m-%d-%H_%M_%S 5M];

or something along those lines anyway.

Adam


Re: PerlRun Subroutine redefine warnings

2009-08-27 Thread Adam Prime

Kiran Kumar wrote:

Hi Mike,
Thanks for your reply,  If you check my script there is no other
subroutine with the same name and I do not import any modules , I
renamed the subroutine to foo and I still get the same warnings.



There's an old thread from someone else reporting this, though it 
doesn't have any sort of resolution.


http://marc.info/?t=9378302201r=1w=2

Theoretically, while running under PerlRun that shouldn't happen.

Adam


Re: RFC: Apache2::CloseKeepAlive

2009-08-26 Thread Adam Prime

cr...@animalhead.com wrote:

I'm working toward contributing a module with this working title
to CPAN, and would like your comments and advice.


A non-code comment, but there seems to be some consternation about the 
same terms as perl itself license.  See the link below:


http://perlbuzz.com/2009/07/help-end-licensing-under-same-terms-as-perl-itself.html

Adam


Re: A lot of segmentation fault, Ubuntu Hardy, apache with mod_perl

2009-08-10 Thread Adam Prime
Igor Chudov wrote:
 
 
 On Sun, Aug 9, 2009 at 7:08 AM, Nick Wellnhofer wellnho...@aevum.de
 mailto:wellnho...@aevum.de wrote:
 
 Igor Chudov wrote:
  In the logs, I see a lot of error messages saying: segmentation fault
 Are you using the worker MPM? If yes, try the prefork MPM instead.
 
 
 Nick, thank you, per your advice, I did try using prefork MPM.
 
 Unfortunately, the end result was still the same, a lot of segmentation
 faults after a while.
 
 The symptom is always the same, it runs great for a while (like maybe
 half an hour) and then begins to give segmentation faults.
 However, no matter what pages of my site I visit at this time, they all
 display correctly.
 
 I also ran apache2 with -X flag under GDB. I disabled SIGPIPE handling.
 
 Again, it ran for an hour and crashed. However, when I tried to say
 where in GDB, GDB told me that the process no longer exists.
 

Have you read this section of the docmentation on perl.apache.org?

http://perl.apache.org/docs/2.0/devel/debug/c.html

particularly the stuff about generating core dumps and analyzing them

Adam


Re: How to write a handler

2009-07-31 Thread Adam Prime

Sudheer Puppala wrote:

Hi

  I am java/flex programmer since 1yrs and a little bit of perl. I have 
a requirement of write a

handler at apache http server side using perl.

Scenario:


  1. My flex application request for a particular file to the apache
  server.
  2. The server upon receiving a request look for the mime type of the

  file. If that file mime type is video/flv or .flv I should write a handler
  for that.

  3. The handler should be in a position to call a java class. where I will

  decrypt the fille and send it back to the flex application.


Here my request is how can I write my own handler? where can I write it? and
as I am not a perl programmer, I am not getting the solution for that. So
could any one help me with an example.


I'd start here:

http://perl.apache.org/docs/2.0/user/handlers/intro.html

to get the headers (including the content-type) from the incoming request:

http://perl.apache.org/docs/2.0/api/Apache2/RequestRec.html#C_headers_in_

to run Java code you can look at:

http://search.cpan.org/~patl/Inline-Java-0.52/Java.pod

Hopefully that should point you in the right direction.

Adam


Re: rewriterule, location, and perlhandler

2009-07-21 Thread Adam Prime
Eric Lease Morgan wrote:
 
 On Jul 21, 2009, at 9:45 PM, Nick Wellnhofer wrote:
 
 What am I doing wrong? Does an actual file need to exist in order for
 mod_perl to find it?

 No.
 
 
 I didn't think so, but what sort of configuration do I need to do so my
 mod_perl packages get executed without the existence of a file?
 

You need to use Handlers.  See this link for a really simple example of
a ResponseHandler, and how to configure it.

http://perl.apache.org/docs/2.0/user/intro/start_fast.html#Handler_Modules

Adam


Re: [PATCH] Apache::DBI - Disconnect on child exit

2009-07-20 Thread Adam Prime
Seems like a reasonable addition to me.  Apache::DBI 1.07 is kind of 
broken right now (see bugs in RT), it'd be nice to get a new release 
with this fixed and some of those bugs closed.


Adam


Nick Wellnhofer wrote:

Currently, Apache::DBI never disconnects from the database. This leads
to the following warnings in my Postgres logs every time an Apache child
exits:

LOG:  unexpected EOF on client connection

Depending on MaxRequestsPerChild this can really spam your Postgres logs.

Attached is a patch against Apache::DBI that adds a PerlChildExitHandler
in order to disconnect all existing database connections.

Comments are welcome.

Nick







Re: Apache::Bootstrap 0.07-rc1 available for testing

2009-07-10 Thread Adam Prime

Fred Moyer wrote:
I'd love it if you could take this rc for a spin and report back.  
Passing all tests on OS X 10.5, 5.8.8, 2.2.6

and Centos 5.2, 5.8.9, 2.2.8.

I resolved some issues while implementing this version for Apache::Dispatch.

Changes since 0.06

- fix syntax error in params validation in new (mp2 param unchecked)
- warn instead of dying in new if a module is not present, and then
  decide if any modules are present to create a new bootstrap object


http://people.apache.org/~phred/Apache-Bootstrap-0.07-rc1.tar.gz


make and make test ok on...



Summary of my perl5 (revision 5 version 8 subversion 6) configuration:
  Platform:
osname=linux, osvers=2.4.26-gentoo-r9, archname=i686-linux

PERL_DL_NONLAZY=1 /usr/bin/perl5.8.6 -MExtUtils::Command::MM -e 
test_harness(0, 'blib/lib', 'blib/arch') t/*.t

t/00-load.# bootstrapping mp1 only
mod_perl not present, cannot bootstrap mp1 at 
/home/adam/Apache-Bootstrap-0.07-rc1/blib/lib/Apache/Bootstrap.pm line 96.

# bootstrapping mp2 only
t/00-load.ok 3/11# Testing Apache::Bootstrap 0.07-rc1, Perl 
5.008006, /usr/bin/perl5.8.6
t/00-load.ok 6/11Apache::Test version is 1.27, minimum version 
required is 1.28, tests will be skipped

t/00-load.ok
6/11 skipped: various reasons
t/pod-coverageskipped
all skipped: Test::Pod::Coverage 1.08 required for testing POD 
coverage

t/pod.skipped
all skipped: Test::Pod 1.22 required for testing POD
All tests successful, 2 tests and 6 subtests skipped.
Files=3, Tests=11,  2 wallclock secs ( 1.38 cusr +  0.07 csys =  1.45 CPU)


Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
  Platform:
osname=linux, osvers=2.6.24-gentoo-r8, archname=i686-linux

PERL_DL_NONLAZY=1 /usr/bin/perl5.8.8 -MExtUtils::Command::MM -e 
test_harness(0, 'blib/lib', 'blib/arch') t/*.t

t/00-load...1/11 # bootstrapping mp1 only
mod_perl not present, cannot bootstrap mp1 at 
/home/adam/Apache-Bootstrap-0.07-rc1/blib/lib/Apache/Bootstrap.pm line 96.

# bootstrapping mp2 only
# Testing Apache::Bootstrap 0.07-rc1, Perl 5.008008, /usr/bin/perl5.8.8
Apache::Test version is 1.31, minimum version required is 1.32, tests 
will be skipped

t/00-load...ok
t/pod-coverage..skipped: Test::Pod::Coverage 1.08 required for 
testing POD coverage

t/pod...ok
All tests successful.
Files=3, Tests=12,  1 wallclock secs ( 0.02 usr  0.00 sys +  0.67 cusr 
0.10 csys =  0.79 CPU)

Result: PASS




Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
  Platform:
osname=solaris, osvers=2.10, archname=i86pc-solaris

PERL_DL_NONLAZY=1 /oanda/system/bin/perl -MExtUtils::Command::MM -e 
test_harness(0, 'blib/lib', 'blib/arch') t/*.t

t/00-load.t ... 1/11 # bootstrapping mp1 only
mod_perl not present, cannot bootstrap mp1 at 
/home/aprime/Apache-Bootstrap-0.07-rc1/blib/lib/Apache/Bootstrap.pm line 96.

# bootstrapping mp2 only
# Testing Apache::Bootstrap 0.07-rc1, Perl 5.008008, /oanda/system/bin/perl
Apache::Test version is 1.31, minimum version required is 1.32, tests 
will be skipped

t/00-load.t ... ok
t/pod-coverage.t .. skipped: Test::Pod::Coverage 1.08 required for 
testing POD coverage

t/pod.t ... ok
All tests successful.
Files=3, Tests=12,  2 wallclock secs ( 0.04 usr  0.02 sys +  0.50 cusr 
0.12 csys =  0.68 CPU)

Result: PASS



Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
  Platform:
osname=solaris, osvers=2.10, archname=i86pc-solaris

PERL_DL_NONLAZY=1 /oanda/system/bin/perl -MExtUtils::Command::MM -e 
test_harness(0, 'blib/lib', 'blib/arch') t/*.t

t/00-load.t ... 1/11 # bootstrapping mp1 only
# bootstrapping mp2 only
mod_perl2 not present, cannot bootstrap mp2 at 
/home/aprime/Apache-Bootstrap-0.07-rc1/blib/lib/Apache/Bootstrap.pm line 
121.

# Testing Apache::Bootstrap 0.07-rc1, Perl 5.008008, /oanda/system/bin/perl
Subroutine boot redefined at 
/oanda/system/lib/site_perl/i86pc-solaris/mod_perl.pm line 10.
Subroutine hook redefined at 
/oanda/system/lib/site_perl/i86pc-solaris/mod_perl.pm line 22.
Subroutine import redefined at 
/oanda/system/lib/site_perl/i86pc-solaris/mod_perl.pm line 31.

t/00-load.t ... ok
t/pod-coverage.t .. skipped: Test::Pod::Coverage 1.08 required for 
testing POD coverage

t/pod.t ... ok
All tests successful.
Files=3, Tests=12,  0 wallclock secs ( 0.04 usr  0.02 sys +  0.24 cusr 
0.05 csys =  0.35 CPU)

Result: PASS



Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
  Platform:
osname=linux, osvers=2.6.24-19-server, 
archname=i486-linux-gnu-thread-multi


PERL_DL_NONLAZY=1 /usr/bin/perl -MExtUtils::Command::MM -e 
test_harness(0, 'blib/lib', 'blib/arch') t/*.t

t/00-load.1/11 # bootstrapping mp1 only
mod_perl not present, cannot bootstrap mp1 at 
/local/aprime/Apache-Bootstrap-0.07-rc1/blib/lib/Apache/Bootstrap.pm 
line 96.

# bootstrapping mp2 only
# Testing Apache::Bootstrap 

Re: mod_perl 2.0.4 make test fails on red hat EL4 with apache 2.2.11 after glibc update

2009-06-10 Thread Adam Prime

Sean Thorne wrote:

Hi,
 I don't know whats wrong, but my hosting environment recently pushed an 
update of glibc and pthread to all of my servers.  This caused them all 
my apache instances to go into an unstable state.  I isolated the 
problem to mod_perl and thought if I rebuilt apache httpd and mod_perl 
it would fix the problem, but now I can't build mod_perl without errors. 
 I've tried apache worker and prefork.  Any help would be appreciated. 
 I've included the make test output and the gdb output.


Thanks,
Sean


snip

I'm not sure if this will really be any help to you or not, but the vast 
majority of the failing tests seem to be due to problems loading 
apr/apr-util.  I've had problems with tests failing due to dynaloader 
being unable to load libraries from build directories that I was able to 
get around by fooling around with ldconfig and ld_library_path.


Adam


Re: Problem with libapreq2-2.12

2009-05-21 Thread Adam Prime


There is a thread in apreq-dev about this issue:

http://marc.info/?l=apreq-devm=124276135127808w=2

Apparently it has something to do with the machine that the tarball was 
built on.


Adam


mod_perl User wrote:

Hi,
 
While trying to install libapreq2-2.12 with mod_perl2/Apache2 in 
Solaris10, please help.
 
# make

Making all in .
Making all in include
make  all-am
Making all in library
make  all-am
Making all in module
Making all in apache2
make: Fatal error: Don't know how to make target `all-local'
Current working directory /export/home/webadm/libapreq2-2.12/module/apache2
*** Error code 1
The following command caused the error:
set fnord $MAKEFLAGS; amf=$2; \
dot_seen=no; \
target=`echo all-recursive | sed s/-recursive//`; \
list='apache2'; for subdir in $list; do \
  echo Making $target in $subdir; \
  if test $subdir = .; then \
dot_seen=yes; \
local_target=$target-am; \
  else \
local_target=$target; \
  fi; \
  (cd $subdir  make  $local_target) \
   || case $amf in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done; \
if test $dot_seen = no; then \
  make  $target-am || exit 1; \
fi; test -z $fail
make: Fatal error: Command failed for target `all-recursive'
Current working directory /export/home/webadm/libapreq2-2.12/module
*** Error code 1
The following command caused the error:
set fnord $MAKEFLAGS; amf=$2; \
dot_seen=no; \
target=`echo all-recursive | sed s/-recursive//`; \
list='. include library module glue'; for subdir in $list; do \
  echo Making $target in $subdir; \
  if test $subdir = .; then \
dot_seen=yes; \
local_target=$target-am; \
  else \
local_target=$target; \
  fi; \
  (cd $subdir  make  $local_target) \
   || case $amf in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done; \
if test $dot_seen = no; then \
  make  $target-am || exit 1; \
fi; test -z $fail
make: Fatal error: Command failed for target `all-recursive'



MSN Quiz Test your skill and wits on this revered battleground of 
knowledge IMing with Windows Live Messenger just got better. 
http://news.in.msn.com/National/indiaelections2009/quiz/default.aspx




Re: Pass value from filter to anothe filter

2009-05-13 Thread Adam Prime

Idel Fuschini wrote:

Hi,

I have this configuration on server:
 
PerlModule ::

PerlTransHandler +::module1
Location /xxx/*
SetHandler modperl
PerlInputFilterHandler ::module2
/Location

and I want to pass variable from module1 to module2 is it possible ?


I think it should be, i would expect you would be able to user 
$r-pnotes.  It looks like the filters happen after translation based on 
this:


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

Adam




Re: [RELEASE CANDIDATE] mod_perl-1.31 RC8

2009-05-11 Thread Adam Prime

Builds and tests find on

Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
  Platform:
osname=linux, osvers=2.6.23-gentoo-r3, archname=x86_64-linux
uname='linux data 2.6.23-gentoo-r3 #1 smp sun dec 30 14:44:14 est 
2007 x86_64 amd athlon(tm) x2 dual core processor be-2350 authenticamd 
gnulinux '


Adam


Re: [RELEASE CANDIDATE] mod_perl-1.31 RC8

2009-05-11 Thread Adam Prime

Also builds fine and all tests pass on:

Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
  Platform:
osname=solaris, osvers=2.10, archname=i86pc-solaris
uname='sunos fxbuild-i386 5.10 generic_127112-11 i86pc i386 i86pc 
solaris '


and

Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
  Platform:
osname=linux, osvers=2.6.24-19-server, 
archname=i486-linux-gnu-thread-multi
uname='linux palmer 2.6.24-19-server #1 smp sat jul 12 00:40:01 utc 
2008 i686 gnulinux '


I have on more system to test on at home.

Adam



  1   2   3   >