Run status request as PerlResponseHandler, to make it simpler
and remove dependencies to Apache mod_perl 2 (#630)
This commit is contained in:
parent
7fbd4301ef
commit
c1c68209c7
|
@ -31,7 +31,11 @@ ErrorDocument 503 http://auth.__DNSDOMAIN__/?lmError=503
|
|||
# Order deny,allow
|
||||
# Deny from all
|
||||
# Allow from 127.0.0.0/8
|
||||
# PerlHeaderParserHandler Lemonldap::NG::Handler->status
|
||||
# SetHandler perl-script
|
||||
# PerlHandler Lemonldap::NG::Handler->status
|
||||
# # You may have to uncomment the next directive to skip
|
||||
# # an upper PerlHeaderParserHandler directive
|
||||
# #PerlHeaderParserHandler Apache::Constants::DECLINED
|
||||
#</Location>
|
||||
|
||||
</VirtualHost>
|
||||
|
|
|
@ -28,7 +28,11 @@ ErrorDocument 503 http://auth.__DNSDOMAIN__/?lmError=503
|
|||
# Uncomment this to activate status module
|
||||
#<Location /status>
|
||||
# Require ip 127
|
||||
# PerlHeaderParserHandler Lemonldap::NG::Handler->status
|
||||
# SetHandler perl-script
|
||||
# PerlResponseHandler Lemonldap::NG::Handler->status
|
||||
# # You may have to uncomment the next directive to skip
|
||||
# # an upper PerlHeaderParserHandler directive
|
||||
# #PerlHeaderParserHandler Apache2::Const::DECLINED
|
||||
#</Location>
|
||||
|
||||
</VirtualHost>
|
||||
|
|
|
@ -32,7 +32,11 @@ ErrorDocument 503 http://auth.__DNSDOMAIN__/?lmError=503
|
|||
# Order deny,allow
|
||||
# Deny from all
|
||||
# Allow from 127.0.0.0/8
|
||||
# PerlHeaderParserHandler Lemonldap::NG::Handler->status
|
||||
# SetHandler perl-script
|
||||
# PerlResponseHandler Lemonldap::NG::Handler->status
|
||||
# # You may have to uncomment the next directive to skip
|
||||
# # an upper PerlHeaderParserHandler directive
|
||||
# #PerlHeaderParserHandler Apache2::Const::DECLINED
|
||||
#</Location>
|
||||
|
||||
</VirtualHost>
|
||||
|
|
|
@ -188,8 +188,13 @@ sub get_server_port {
|
|||
return $r->get_server_port;
|
||||
}
|
||||
|
||||
sub push_handlers {
|
||||
my ($class, $r) = @_;
|
||||
## @method void print(string data, Apache2::RequestRec request)
|
||||
# write data in HTTP response body
|
||||
# @param data Text to add in response body
|
||||
# @param request Apache2::RequestRec Current request
|
||||
sub print {
|
||||
my ($class, $data, $r) = @_;
|
||||
$r->print($data);
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
@ -213,4 +213,13 @@ sub get_server_port {
|
|||
return $r->get_server_port;
|
||||
}
|
||||
|
||||
## @method void print(string data, Apache2::RequestRec request)
|
||||
# write data in HTTP response body
|
||||
# @param data Text to add in response body
|
||||
# @param request Apache2::RequestRec Current request
|
||||
sub print {
|
||||
my ($class, $data, $r) = @_;
|
||||
$r->print($data);
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
@ -209,8 +209,13 @@ sub get_server_port {
|
|||
return $ENV{SERVER_PORT};
|
||||
}
|
||||
|
||||
sub push_handlers {
|
||||
my ($class, $r) = @_;
|
||||
## @method void print(string data, Apache2::RequestRec request)
|
||||
# write data in HTTP response body
|
||||
# @param data Text to add in response body
|
||||
# @param request Apache2::RequestRec Current request
|
||||
sub print {
|
||||
my ($class, $data, $r) = @_;
|
||||
#TODO
|
||||
}
|
||||
|
||||
sub cgiName {
|
||||
|
|
|
@ -682,27 +682,9 @@ sub status($$) {
|
|||
last if (/^END$/);
|
||||
$buf .= $_;
|
||||
}
|
||||
if ( MP() == 2 ) {
|
||||
$r->push_handlers(
|
||||
'PerlResponseHandler' => sub {
|
||||
my $r = shift;
|
||||
$r->content_type('text/html; charset=UTF-8');
|
||||
$r->print($buf);
|
||||
OK;
|
||||
}
|
||||
);
|
||||
}
|
||||
else {
|
||||
$r->push_handlers(
|
||||
'PerlHandler' => sub {
|
||||
my $r = shift;
|
||||
$r->content_type('text/html; charset=UTF-8');
|
||||
$r->send_http_header;
|
||||
$r->print($buf);
|
||||
OK;
|
||||
}
|
||||
);
|
||||
}
|
||||
Lemonldap::NG::Handler::API->set_header_out($r,
|
||||
( "Content-Type" => "text/html; charset=UTF-8" ) );
|
||||
Lemonldap::NG::Handler::API->print($buf, $r);
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user