2014-05-23 15:35:47 +02:00
|
|
|
package Lemonldap::NG::Handler::API::CGI;
|
|
|
|
|
2014-05-23 17:21:10 +02:00
|
|
|
our $VERSION = '1.4.0';
|
|
|
|
|
2014-05-23 15:35:47 +02:00
|
|
|
sub set_user {
|
2014-05-23 17:21:10 +02:00
|
|
|
my ($class, $r, $user) = @_;
|
2014-05-23 15:35:47 +02:00
|
|
|
$ENV{REMOTE_USER} = $user;
|
|
|
|
}
|
|
|
|
|
2014-05-23 17:21:10 +02:00
|
|
|
sub header_in {
|
|
|
|
my ($class, $r, $header) = @_;
|
|
|
|
return $ENV{ cgiName($header) };
|
|
|
|
}
|
|
|
|
|
|
|
|
sub set_header_in {
|
|
|
|
my ($class, $r, %headers) = @_;
|
|
|
|
while ( my ( $h, $v ) = each %headers ) {
|
|
|
|
$ENV{ cgiName($h) } = $v;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sub unset_header_in {
|
|
|
|
my ($class, $r, @headers) = @_;
|
|
|
|
foreach my $h (@headers) {
|
|
|
|
$ENV{ cgiName($h) } = undef;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sub set_header_out {
|
|
|
|
my ($class, $r, %headers) = @_;
|
|
|
|
while ( my ( $h, $v ) = each %headers ) {
|
|
|
|
# TODO
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sub set_err_header_out {
|
|
|
|
my ($class, $r, %headers) = @_;
|
|
|
|
while ( my ( $h, $v ) = each %headers ) {
|
|
|
|
# TODO
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sub cgiName {
|
|
|
|
my $h = uc(shift);
|
|
|
|
$h =~ s/-/_/g;
|
|
|
|
return "HTTP_$h";
|
|
|
|
}
|
|
|
|
|
2014-05-23 15:35:47 +02:00
|
|
|
1;
|