CROMBEZ Emmanuel | 2 Nov 2009 11:37
Favicon
Gravatar

note_basic_auth_failed failed

Hello, I try to use PerlAuthzHandler but the return HTTP_UNAUTHORIZED
doesn't work.

My Apache2 (2.0.8) config work fine without Handler

Alias /davb /var/www/www.mydomain.com/dav/

<Location /davb/≥
      AuthType Basic
      AuthName WebDavBasic
      require valid-user
      PerlAuthzHandler Lantra::WebDavAuthz
</Location>

So, my Location work fine, the web browser ask login/passwd, analyse it
and serve the ressource.
But I want authorize only some ressources, I had the PerlAuthzHandler
for this, but the return Apache2::Const::HTTP_UNAUTHORIZED does'nt work.

My handler is :

use Apache2::Access ();

package Lantra::WebDavAuthz;

sub handler {
        my $r = shift;
        my $user = $r->user;

        $r->server->log_error("Lantra::WebDavAuthz ! analyse USER=$user");
(Continue reading)

André Warnier | 2 Nov 2009 14:02

Re: note_basic_auth_failed failed

CROMBEZ Emmanuel wrote:
> Hello, I try to use PerlAuthzHandler but the return HTTP_UNAUTHORIZED
> doesn't work.
> 
What do you mean by "it doesn't work" ?
Can you give us a clue ?

CROMBEZ Emmanuel | 2 Nov 2009 17:08
Favicon
Gravatar

Re: note_basic_auth_failed failed

André Warnier a écrit :
> CROMBEZ Emmanuel wrote:
>> Hello, I try to use PerlAuthzHandler but the return HTTP_UNAUTHORIZED
>> doesn't work.
>>
> What do you mean by "it doesn't work" ?
> Can you give us a clue ?
> 
> 
In the documentation I read :

	$r->note_basic_auth_failed;
	return Apache2::Const::HTTP_UNAUTHORIZED;

This code (in PerlAuthenHandler and PerlAuthzHandler) must return an 401
HTTP error code, but I have a 200 !
First, I thought "the handler is not called", I added some log, and the
handler is called.

Fred Moyer | 3 Nov 2009 04:45
Gravatar

[meetup] ApacheCon 2009 OAK mod_perl and SF.pm Social

Greetings SF Bay Area mod_perl users,

Just a quick reminder, this meetup is tomorrow evening at 7pm  <at> Luka's
in Oakland CA.

http://www.meetup.com/San-Francisco-Perl-Mongers/calendar/11676532/

Tomáš Bažant | 3 Nov 2009 09:20
Picon

apache 2 reloads needed?

Greetings from cloudy Prague!

I am developing web application with mod_perl/apache/mysql. I am using
several own perl modules (*.pm), and after changing the contents of a
particular module, i usually have to reload/restart apache for these
changes to take effect. it is quite annoying. Is there any way how to
bypass this process and make apache aware of the changes automatically?

thanks

--

-- 
Tomáš Bažant <tbazant <at> suse.cz>
Novell, SUSE Linux s.r.o.

Jie Gao | 3 Nov 2009 09:53
Picon
Picon

Re: apache 2 reloads needed?

* Tom??? Ba??ant <tbazant <at> suse.cz> wrote:

> Greetings from cloudy Prague!
> 
> 
> I am developing web application with mod_perl/apache/mysql. I am using
> several own perl modules (*.pm), and after changing the contents of a
> particular module, i usually have to reload/restart apache for these
> changes to take effect. it is quite annoying. Is there any way how to
> bypass this process and make apache aware of the changes automatically?

Install Apache::Reload from CPAN.

Regards,

Jie

André Warnier | 3 Nov 2009 10:27

Re: apache 2 reloads needed?

Jie Gao wrote:
> * Tom??? Ba??ant <tbazant <at> suse.cz> wrote:
> 
>> Greetings from cloudy Prague!
>>
>>
>> I am developing web application with mod_perl/apache/mysql. I am using
>> several own perl modules (*.pm), and after changing the contents of a
>> particular module, i usually have to reload/restart apache for these
>> changes to take effect. it is quite annoying. Is there any way how to
>> bypass this process and make apache aware of the changes automatically?
>  
> Install Apache::Reload from CPAN.
> 
Greetings from sunny (right now anyway) Southern Germany.

I see that you mention mysql.  This probably means DBI.
I think you need to be a bit careful with DBI and Apache::Reload.  I 
seem to recall that there are some particularities there
(Probably in relation to permanent cached database connections).

In any case, I believe Apache::Reload is OK for a development server, 
but on a production server this is probably not very efficient.
There is no free lunch : if you ask the server to monitor certain things 
and do something in case of change, then that has a cost.

Michiel Beijen | 3 Nov 2009 11:06
Gravatar

Re: apache 2 reloads needed?

On Tue, 2009-11-03 at 10:27 +0100, André Warnier wrote:
Greetings from sunny (right now anyway) Southern Germany.
Greetings from the cloudy Netherlands... BTW my colleagues from Straubing (Bavaria, Germany) were complaining that it's raining cats and dogs today there.
I see that you mention mysql. This probably means DBI. I think you need to be a bit careful with DBI and Apache::Reload. I seem to recall that there are some particularities there (Probably in relation to permanent cached database connections).
The project I work on uses mod_perl, Apache::Reload, and Apache::DBI. AFAIK Apache::Reload does not influence the database connection at all, it just would monitor the modules on disk and if they change, they are reloaded in memory. We use Apache::DBI to cache the database connection, which basically means that the Apache child does not need to set up a new connection any time it tries to open one. This has a performance benefit.
In any case, I believe Apache::Reload is OK for a development server, but on a production server this is probably not very efficient. There is no free lunch : if you ask the server to monitor certain things and do something in case of change, then that has a cost.
We use it (and even recommend it) on a production server! We have measured a performance degradation of about 7% when running with Apache::Reload. In most setups, this would not be an issue and it is better than having to restart apache.... but of course in a high-load environment it will be something to consider.
--
Michiel
Jonathan Vanasco | 3 Nov 2009 21:54

Re: apache 2 reloads needed?


On Nov 3, 2009, at 4:27 AM, André Warnier wrote:

I see that you mention mysql.  This probably means DBI.
I think you need to be a bit careful with DBI and Apache::Reload.  I seem to recall that there are some particularities there
(Probably in relation to permanent cached database connections).

In any case, I believe Apache::Reload is OK for a development server, but on a production server this is probably not very efficient.
There is no free lunch : if you ask the server to monitor certain things and do something in case of change, then that has a cost.

re: databases-- you should be fine as long as you use Apache::DBI.  if you're not, then I don't recall.  

Apache::Reload and Apache::DBI for mod_perl handler applications work perfect during development.  I've never made a registry app, so can't comment on that.

Apache::Reload shouldn't be used on production; however its indispensable during development.

Dave Morgan | 4 Nov 2009 23:58

Apache::Registry executing scripts multiple times

Hi All,
	Please forgive me if the answer is in the docs, I looked without success.
I have a very simple index_test.pl script which appears to get called by Apache::Registry
multiple times. I have tested in single server mode (httpd -X) and still get the same
results. The output is correct but the error_log shows multiple calls from the
Apache::Registry module. While this simple program appears to get called 5 times
our big one was only getting called twice, however, that did have a very noticeable
effect on response time.

We have also removed the Apache::Reload module without effect.

Any ideas, pointers or help appreciated

Dave
###############################################################
Environment:
	Apache 1.3.37
	mod-perl 1.30
	perl 5.8.8
################################################################
Relevent httpd.conf section:

ScriptAlias /metapoint/ "/home/tomcat/metapoint/trunk/"
<Directory "/home/tomcat/metapoint/trunk">
                AllowOverride None
                SetHandler perl-script
		PerlInitHandler Apache::Reload
                PerlHandler Apache::Registry
                Options ExecCGI
                Order allow,deny
                Allow from all
</Directory>

################################################################
index_test.pl:

our $i;
print "pre hello $i <br />";
$i++;
my ($package, $filename, $line) = caller();
print STDERR "$package, $filename, $line, $i\n\n";
print "hello $i";
##################################################################
output:
pre hello 84
hello 85
###################################################################
error_log output:
Apache::Registry, /opt/lib/perl5/site_perl/5.8.8/i686-linux/Apache/Registry.pm, 149, 1

Apache::Registry, /opt/lib/perl5/site_perl/5.8.8/i686-linux/Apache/Registry.pm, 149, 1

Apache::Registry, /opt/lib/perl5/site_perl/5.8.8/i686-linux/Apache/Registry.pm, 149, 2

Apache::Registry, /opt/lib/perl5/site_perl/5.8.8/i686-linux/Apache/Registry.pm, 149, 2

Apache::Registry, /opt/lib/perl5/site_perl/5.8.8/i686-linux/Apache/Registry.pm, 149, 3

######################################################################
--

-- 
Dave Morgan
1001111 Alberta Limited
dave.morgan <at> 1001111.com
403 399 2442


Gmane