lemonldap-ng/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Main/Headers.pm
David COUTADEUR e657a409c0 deport all module requirements and variables thread sharing in Main and
SharedConf into API specific modules.
 - creation of a thread_share function sharing or not variables (in MP2)
 - move apache module requirements to ApacheMP2
 - move variables thread sharing to ApacheMP2
 - creation of a webserverCodes tag for importing HTTP response codes
(references #630)
2014-06-13 16:12:54 +00:00

34 lines
1.1 KiB
Perl
Executable File

package Lemonldap::NG::Handler::Main::Headers;
use strict;
use Lemonldap::NG::Handler::API qw( :webserverCodes ); # for importing MP function
use Lemonldap::NG::Handler::Main::Logger;
our $VERSION = '1.4.0';
## @rmethod void sendHeaders()
# Launch function compiled by forgeHeadersInit() for the current virtual host
sub sendHeaders {
my ( $class, $apacheRequest, $forgeHeaders ) = splice @_;
my $vhost = Lemonldap::NG::Handler::API->hostname($apacheRequest);
if ( defined( $forgeHeaders->{$vhost} ) ) {
Lemonldap::NG::Handler::API->set_header_in( $apacheRequest,
&{ $forgeHeaders->{$vhost} } );
}
}
## @rmethod void cleanHeaders()
# Unset HTTP headers for the current virtual host, when sendHeaders is skipped
sub cleanHeaders {
my ( $class, $apacheRequest, $forgeHeaders, $headerList ) = splice @_;
my $vhost = Lemonldap::NG::Handler::API->hostname($apacheRequest);
if ( defined( $forgeHeaders->{$vhost} ) ) {
Lemonldap::NG::Handler::API->unset_header_in( $apacheRequest,
@{ $headerList->{$vhost} } );
}
}
1;