enhanced AccessHandler.pm for httpd 2.4

This commit is contained in:
hyung-hwan 2019-02-01 15:23:22 +00:00
parent 1ced89908e
commit 3316cf8b3f
2 changed files with 17 additions and 2 deletions

View File

@ -42,7 +42,7 @@ use URI;
use DBI; use DBI;
use Digest::SHA1 qw (sha1_hex); use Digest::SHA1 qw (sha1_hex);
use Apache2::Const -compile => qw(OK DECLINED FORBIDDEN HTTP_UNAUTHORIZED HTTP_INTERNAL_SERVER_ERROR PROXYREQ_PROXY); use Apache2::Const -compile => qw(OK DECLINED FORBIDDEN HTTP_UNAUTHORIZED HTTP_INTERNAL_SERVER_ERROR PROXYREQ_PROXY AUTH_REQUIRED);
sub get_config sub get_config
{ {
@ -366,6 +366,13 @@ sub __handler
if (lc($cfg->{svn_read_access}) eq 'anonymous') if (lc($cfg->{svn_read_access}) eq 'anonymous')
{ {
# grant an anonymous user the read access. # grant an anonymous user the read access.
if (!defined($userid) || $userid eq '')
{
# httpd 2.4 emits the following message if the user is not set
# AH00027: No authentication done but request not allowed
# without authentication for /xxx/xxx. Authentication not configured?
$r->user('<codepot-anonymous-user>');
}
return Apache2::Const::OK; return Apache2::Const::OK;
} }
} }
@ -455,4 +462,5 @@ sub handler: method
close_database ($dbh); close_database ($dbh);
return $res; return $res;
} }
1; 1;

View File

@ -3,10 +3,17 @@ package Codepot::AuthenHandler;
use strict; use strict;
use warnings; use warnings;
use Apache2::Const -compile => qw(OK DECLINED FORBIDDEN HTTP_UNAUTHORIZED HTTP_INTERNAL_SERVER_ERROR); use Apache2::Access ();
use Apache2::RequestUtil ();
use Apache2::RequestRec ();
use Apache2::Log;
use Apache2::Const -compile => qw(OK DECLINED FORBIDDEN HTTP_UNAUTHORIZED HTTP_INTERNAL_SERVER_ERROR AUTH_REQUIRED);
use Data::Dumper;
sub handler: method sub handler: method
{ {
my ($class, $r) = @_;
return Apache2::Const::OK; return Apache2::Const::OK;
} }
1; 1;