Commit 2d2edb61 authored by Xavier Guimard's avatar Xavier Guimard

Merge experimental branch (#960)

Also update version to 2.0
parent b7e249b4
......@@ -133,7 +133,7 @@
.\" ========================================================================
.\"
.IX Title "llng-fastcgi-server 1"
.TH llng-fastcgi-server 1 "2016-02-20" "perl v5.22.1" "User Contributed Perl Documentation"
.TH llng-fastcgi-server 1 "2016-03-08" "perl v5.22.1" "User Contributed Perl Documentation"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
......
......@@ -5,7 +5,6 @@ use strict;
use warnings;
use POSIX;
use Getopt::Std;
use Lemonldap::NG::Handler::SharedConf;
our %opts;
my %_apps;
......@@ -75,9 +74,8 @@ my $app = sub {
};
# Hook for customFunctions initialization
use Lemonldap::NG::Handler::API::PSGI::Server;
$Lemonldap::NG::Handler::API::mode = 'PSGI::Server';
Lemonldap::NG::Handler::SharedConf->init();
use Lemonldap::NG::Handler::PSGI::API;
Lemonldap::NG::Handler::PSGI::API->init();
my $server = Plack::Runner->new();
$server->parse_options(
......
......@@ -10,7 +10,7 @@ build_requires:
configure_requires:
ExtUtils::MakeMaker: '0'
dynamic_config: 1
generated_by: 'ExtUtils::MakeMaker version 6.98, CPAN::Meta::Converter version 2.150005'
generated_by: 'ExtUtils::MakeMaker version 7.0401, CPAN::Meta::Converter version 2.150005'
license: open_source
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
......@@ -44,5 +44,5 @@ requires:
Net::CIDR::Lite: '0'
SOAP::Lite: '0'
Storable: '0'
version: v1.9.1
version: v2.0.0
x_serialization_backend: 'CPAN::Meta::YAML version 0.012'
package Lemonldap::NG::Common;
our $VERSION = '1.9.1';
our $VERSION = '2.0.0';
use strict;
......
......@@ -15,7 +15,7 @@ use Lemonldap::NG::Common::Apache::Session::Serialize::JSON;
use Lemonldap::NG::Common::Apache::Session::Store;
use Lemonldap::NG::Common::Apache::Session::Lock;
our $VERSION = '1.9.1';
our $VERSION = '2.0.0';
sub _load {
my ( $backend, $func ) = @_;
......
......@@ -11,7 +11,7 @@ package Lemonldap::NG::Common::Apache::Session::Generate::SHA256;
use strict;
use Digest::SHA qw(sha256 sha256_hex sha256_base64);
our $VERSION = '1.9.1';
our $VERSION = '2.0.0';
sub generate {
my $session = shift;
......
......@@ -8,7 +8,7 @@ package Lemonldap::NG::Common::Apache::Session::SOAP;
use strict;
use SOAP::Lite;
our $VERSION = '1.9.1';
our $VERSION = '2.0.0';
#parameter proxy Url of SOAP service
#parameter proxyOptions SOAP::Lite options
......
......@@ -3,7 +3,7 @@ package Lemonldap::NG::Common::Apache::Session::Serialize::JSON;
use strict;
use JSON;
our $VERSION = '1.9.1';
our $VERSION = '2.0.0';
sub serialize {
my $session = shift;
......
package Lemonldap::NG::Common::Apache::Session::Store;
our $VERSION = '1.9.1';
our $VERSION = '2.0.0';
sub new {
my $class = shift;
......
......@@ -17,7 +17,7 @@ use Net::CIDR::Lite;
#parameter syslog Indicates syslog facility for logging user actions
our $VERSION = '1.9.1';
our $VERSION = '2.0.0';
our $_SUPER;
our @ISA;
......
......@@ -11,7 +11,7 @@ use SOAP::Transport::HTTP;
use base qw(SOAP::Transport::HTTP::Server);
use bytes;
our $VERSION = '1.9.1';
our $VERSION = '2.0.0';
## @method protected void DESTROY()
# Call SOAP::Trace::objects().
......
......@@ -7,7 +7,7 @@ package Lemonldap::NG::Common::CGI::SOAPService;
require SOAP::Lite;
our $VERSION = '1.9.1';
our $VERSION = '2.0.0';
## @cmethod Lemonldap::NG::Common::CGI::SOAPService new(object obj,string @func)
# Constructor
......
......@@ -6,7 +6,7 @@
package Lemonldap::NG::Common::Captcha;
our $VERSION = '1.9.1';
our $VERSION = '2.0.0';
use strict;
use Lemonldap::NG::Common::Session;
......
......@@ -23,7 +23,7 @@ use Config::IniFiles;
#inherits Lemonldap::NG::Common::Conf::SOAP
#inherits Lemonldap::NG::Common::Conf::LDAP
our $VERSION = '1.9.1';
our $VERSION = '2.0.0';
our $msg = '';
our $iniObj;
......
......@@ -5,7 +5,7 @@ use utf8;
use JSON;
use Lemonldap::NG::Common::Conf::_DBI;
our $VERSION = '1.9.1';
our $VERSION = '2.0.0';
our @ISA = qw(Lemonldap::NG::Common::Conf::_DBI);
sub store {
......
......@@ -5,7 +5,7 @@ use strict;
use Exporter 'import';
use base qw(Exporter);
our $VERSION = '1.9.1';
our $VERSION = '2.0.0';
# CONSTANTS
......
......@@ -5,7 +5,7 @@ use utf8;
use Lemonldap::NG::Common::Conf::Serializer;
use Lemonldap::NG::Common::Conf::_DBI;
our $VERSION = '1.9.1';
our $VERSION = '2.0.0';
our @ISA = qw(Lemonldap::NG::Common::Conf::_DBI);
sub store {
......
# This file is generated by Lemonldap::NG::Manager::Build. Don't modify it by hand
package Lemonldap::NG::Common::Conf::DefaultValues;
our $VERSION = '1.9.1';
our $VERSION = '2.0.0';
sub defaultValues {
return {
......
......@@ -5,7 +5,7 @@ use Lemonldap::NG::Common::Conf::Constants; #inherits
use JSON;
use Encode;
our $VERSION = '1.9.1';
our $VERSION = '2.0.0';
our $initDone;
sub Lemonldap::NG::Common::Conf::_lock {
......
......@@ -12,7 +12,7 @@ use Lemonldap::NG::Common::Conf::Constants; #inherits
use Lemonldap::NG::Common::Conf::Serializer;
use Encode;
our $VERSION = '1.9.1';
our $VERSION = '2.0.0';
BEGIN {
*Lemonldap::NG::Common::Conf::ldap = \&ldap;
......
......@@ -5,7 +5,7 @@ use utf8;
use strict;
use Lemonldap::NG::Common::Conf::Serializer;
our $VERSION = '1.9.1';
our $VERSION = '2.0.0';
our $initDone;
sub prereq {
......
......@@ -5,7 +5,7 @@ use utf8;
use Lemonldap::NG::Common::Conf::Serializer;
use Lemonldap::NG::Common::Conf::_DBI;
our $VERSION = '1.9.1';
our $VERSION = '2.0.0';
our @ISA = qw(Lemonldap::NG::Common::Conf::_DBI);
sub store {
......
......@@ -17,7 +17,7 @@ use XML::Simple;
use Safe;
use Encode;
our $VERSION = '1.9.1';
our $VERSION = '2.0.0';
## @cmethod Lemonldap::NG::Common::Conf::SAML::Metadata new(hashRef args)
# Class constructor.
......
......@@ -4,7 +4,7 @@ use strict;
use utf8;
use SOAP::Lite;
our $VERSION = '1.9.1';
our $VERSION = '2.0.0';
#parameter proxy Url of SOAP service
#parameter proxyOptions SOAP::Lite parameters
......
......@@ -6,7 +6,7 @@ use Encode;
use JSON;
use Lemonldap::NG::Common::Conf::Constants;
our $VERSION = '1.9.1';
our $VERSION = '2.0.0';
BEGIN {
*Lemonldap::NG::Common::Conf::normalize = \&normalize;
......
......@@ -5,7 +5,7 @@ use utf8;
use DBI;
use Lemonldap::NG::Common::Conf::Constants; #inherits
our $VERSION = '1.9.1';
our $VERSION = '2.0.0';
our @ISA = qw(Lemonldap::NG::Common::Conf::Constants);
our ( @EXPORT, %EXPORT_TAGS );
......
......@@ -14,7 +14,7 @@ use MIME::Base64;
use Digest::MD5 qw(md5);
use bytes;
our $VERSION = '1.9.1';
our $VERSION = '2.0.0';
our $msg;
......
......@@ -15,7 +15,7 @@ use Scalar::Util 'weaken';
#inherits Lemonldap::NG::Common::Notification::DBI
#inherits Lemonldap::NG::Common::Notification::File
our $VERSION = '1.9.1';
our $VERSION = '2.0.0';
our ( $msg, $parser );
## @cmethod Lemonldap::NG::Common::Notification new(hashref storage)
......
......@@ -10,7 +10,7 @@ use Time::Local;
use DBI;
use utf8;
our $VERSION = '1.9.1';
our $VERSION = '2.0.0';
## @method boolean prereq()
# Check if DBI parameters are set.
......
......@@ -8,7 +8,7 @@ package Lemonldap::NG::Common::Notification::File;
use strict;
use MIME::Base64;
our $VERSION = '1.9.1';
our $VERSION = '2.0.0';
## @method boolean prereq()
# Check if parameters are set and if storage directory exists.
......
......@@ -12,7 +12,7 @@ use MIME::Base64;
use Net::LDAP;
use utf8;
our $VERSION = '1.9.1';
our $VERSION = '2.0.0';
## @method boolean prereq()
# Check if LDAP parameters are set.
......
......@@ -6,7 +6,7 @@ use JSON;
use Lemonldap::NG::Common::PSGI::Constants;
use Lemonldap::NG::Common::PSGI::Request;
our $VERSION = '1.9.1';
our $VERSION = '2.0.0';
our $_json = JSON->new->allow_nonref;
......
......@@ -4,7 +4,7 @@ use strict;
use Exporter 'import';
use base qw(Exporter);
our $VERSION = '1.9.1';
our $VERSION = '2.0.0';
# CONSTANTS
......
......@@ -5,7 +5,7 @@ use Mouse;
use JSON;
use URI::Escape;
our $VERSION = '1.9.1';
our $VERSION = '2.0.0';
# http :// server / path ? query # fragment
# m|(?:([^:/?#]+):)?(?://([^/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?|;
......
......@@ -4,7 +4,7 @@ use Mouse;
use Lemonldap::NG::Common::PSGI;
use Lemonldap::NG::Common::PSGI::Constants;
our $VERSION = '1.9.1';
our $VERSION = '2.0.0';
extends 'Lemonldap::NG::Common::PSGI';
......
......@@ -10,7 +10,7 @@ use base qw(Safe);
use constant SAFEWRAP => ( Safe->can("wrap_code_ref") ? 1 : 0 );
use Scalar::Util 'weaken';
our $VERSION = '1.9.1';
our $VERSION = '2.0.0';
our $self; # Safe cannot share a variable declared with my
......
......@@ -11,7 +11,7 @@ use MIME::Base64;
#use AutoLoader qw(AUTOLOAD);
our $VERSION = '1.9.1';
our $VERSION = '2.0.0';
# Set here all the names of functions that must be available in Safe objects.
# Not that only functions, not methods, can be written here
......
......@@ -6,7 +6,7 @@
package Lemonldap::NG::Common::Session;
our $VERSION = '1.9.1';
our $VERSION = '2.0.0';
use Mouse;
use Lemonldap::NG::Common::Apache::Session;
......
......@@ -5,35 +5,34 @@ example/MyHandlerLog4Perl.pm
example/scripts/purgeLocalCache
example/scripts/purgeLocalCache.cron.d
lib/Lemonldap/NG/Handler.pm
lib/Lemonldap/NG/Handler/API.pm
lib/Lemonldap/NG/Handler/API/ApacheMP1.pm
lib/Lemonldap/NG/Handler/API/ApacheMP2.pm
lib/Lemonldap/NG/Handler/ApacheMP2.pm
lib/Lemonldap/NG/Handler/API/CGI.pm
lib/Lemonldap/NG/Handler/API/ExperimentalNginx.pm
lib/Lemonldap/NG/Handler/API/PSGI.pm
lib/Lemonldap/NG/Handler/API/PSGI/Server.pm
lib/Lemonldap/NG/Handler/AuthBasic.pm
lib/Lemonldap/NG/Handler/CGI.pm
lib/Lemonldap/NG/Handler/Main.pm
lib/Lemonldap/NG/Handler/Main/Init.pm
lib/Lemonldap/NG/Handler/Main/Jail.pm
lib/Lemonldap/NG/Handler/Main/Logger.pm
lib/Lemonldap/NG/Handler/Main/Reload.pm
lib/Lemonldap/NG/Handler/Main/Run.pm
lib/Lemonldap/NG/Handler/Main/SharedVariables.pm
lib/Lemonldap/NG/Handler/Menu.pm
lib/Lemonldap/NG/Handler/Nginx.pm
lib/Lemonldap/NG/Handler/PSGI.pm
lib/Lemonldap/NG/Handler/PSGI/API.pm
lib/Lemonldap/NG/Handler/PSGI/API/Server.pm
lib/Lemonldap/NG/Handler/PSGI/Base.pm
lib/Lemonldap/NG/Handler/PSGI/Router.pm
lib/Lemonldap/NG/Handler/PSGI/Server.pm
lib/Lemonldap/NG/Handler/Reload.pm
lib/Lemonldap/NG/Handler/SecureToken.pm
lib/Lemonldap/NG/Handler/SharedConf.pm
lib/Lemonldap/NG/Handler/Specific/AuthBasic.pm
lib/Lemonldap/NG/Handler/Specific/SecureToken.pm
lib/Lemonldap/NG/Handler/Specific/ZimbraPreAuth.pm
lib/Lemonldap/NG/Handler/Status.pm
lib/Lemonldap/NG/Handler/ZimbraPreAuth.pm
Makefile.PL
MANIFEST This list of files
META.yml
README
t/01-Lemonldap-NG-Handler-Main.t
t/02-Lemonldap-NG-Handler-Main-Portal.t
t/05-Lemonldap-NG-Handler-Reload.t
t/10-Lemonldap-NG-Handler-SharedConf.t
t/12-Lemonldap-NG-Handler-Jail.t
......
......@@ -14,7 +14,7 @@ build_requires:
configure_requires:
ExtUtils::MakeMaker: '0'
dynamic_config: 1
generated_by: 'ExtUtils::MakeMaker version 6.98, CPAN::Meta::Converter version 2.150005'
generated_by: 'ExtUtils::MakeMaker version 7.0401, CPAN::Meta::Converter version 2.150005'
license: open_source
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
......@@ -37,5 +37,5 @@ requires:
Lemonldap::NG::Common: v1.9.0
Mouse: '0'
URI: '0'
version: v1.9.1
version: v2.0.0
x_serialization_backend: 'CPAN::Meta::YAML version 0.012'
package Lemonldap::NG::Handler::API;
use Exporter 'import';
our $VERSION = '1.9.1';
our ( %EXPORT_TAGS, @EXPORT_OK, @EXPORT );
our $mode;
BEGIN {
%EXPORT_TAGS = (
httpCodes => [
qw( MP OK REDIRECT HTTP_UNAUTHORIZED FORBIDDEN DONE DECLINED SERVER_ERROR AUTH_REQUIRED MAINTENANCE )
],
functions => [
qw( &hostname &remote_ip &uri &uri_with_args
&unparsed_uri &args &method &header_in )
]
);
push( @EXPORT_OK, @{ $EXPORT_TAGS{$_} } ) foreach ( keys %EXPORT_TAGS );
$EXPORT_TAGS{all} = \@EXPORT_OK;
if ( exists $ENV{MOD_PERL} ) {
if ( $ENV{MOD_PERL_API_VERSION} and $ENV{MOD_PERL_API_VERSION} >= 2 ) {
eval 'use constant MP => 2;';
}
else {
eval 'use constant MP => 1;';
}
}
else {
eval 'use constant MP => 0;';
}
}
sub AUTOLOAD {
my $func = $AUTOLOAD;
$func =~ s/^.*:://;
# Launch appropriate specific API function:
# - Apache (modperl 2),
# - Apache (modperl1),
# - Nginx
if ( !$mode or $func eq 'newRequest' ) {
#print STDERR "FONCTION $func\n";
#for ( my $i = 0 ; $i < 7 ; $i++ ) {
# print STDERR " $i: " . ( caller($i) )[0] . "\n";
#}
$mode =
(
( caller(1) )[0] =~
/^Lemonldap::NG::Handler::(?:Nginx|PSGI::Server)$/
or ( caller(6)
and ( caller(6) )[0] =~
/^Lemonldap::NG::Handler::(?:Nginx|PSGI::Server)$/ )
) ? 'PSGI/Server'
: (
( caller(0) )[0] =~ /^Lemonldap::NG::Handler::PSGI/
or (
(
( caller(6) )[0]
and ( ( caller(6) )[0] =~ /^Lemonldap::NG::Handler::PSGI/ )
)
)
) ? 'PSGI'
: ( $ENV{GATEWAY_INTERFACE}
and !( ref $_[1] eq 'Apache2::RequestRec' ) ) ? 'CGI'
: ( MP == 2 ) ? 'ApacheMP2'
: ( MP == 1 ) ? 'ApacheMP1'
: $main::{'nginx::'} ? 'ExperimentalNginx'
: 'CGI';
unless ( $INC{"Lemonldap/NG/Handler/API/$mode.pm"} ) {
$mode =~ s#/#::#g;
eval
"use Lemonldap::NG::Handler::API::$mode (':httpCodes', ':functions');";
die $@ if ($@);
}
$mode =~ s#/#::#g;
}
shift;
return "Lemonldap::NG::Handler::API::${mode}"->${func}(@_);
}
1;
package Lemonldap::NG::Handler::API::ApacheMP1;
our $VERSION = '1.9.1';
# Specific modules and constants for Apache Mod_Perl 1
use Apache;
use Apache::Log;
use Apache::Constants qw(:common :response);
## @method void setServerSignature(string sign)
# modifies web server signature
# @param $sign String to add to server signature
sub setServerSignature {
my ( $class, $sign ) = @_;
#TODO
}
## @method void thread_share(string $variable)
# share or not the variable (if authorized by specific module)
# @param $variable the name of the variable to share
sub thread_share {
my ( $class, $variable ) = @_;
# nothing to do in ApacheMP1
}
## @method void lmLog(string $msg, string $level, Apache::RequestRec $r)
# logs message $msg to Apache logs with loglevel $level
# @param $msg string message to log
# @param $level string loglevel
# @param $r Apache2::RequestRec optional Current request
sub lmLog {
my ( $class, $msg, $level, $r ) = @_;
Apache->server->log->$level($msg);
}
## @method void set_user(Apache2::RequestRec request, string user)
# sets remote_user
# @param request Apache2::RequestRec current request
# @param user string username
sub set_user {
my ( $class, $r, $user ) = @_;
$r->connection->user($user);
}
## @method string header_in(Apache2::RequestRec request, string header)
# returns request header value
# @param request Apache2::RequestRec current request
# @param header string request header
# @return request header value
sub header_in {
my ( $class, $r, $header ) = @_;
return $r->header_in($header);
}
## @method void set_header_in(Apache2::RequestRec request, hash headers)
# sets or modifies request headers
# @param request Apache2::RequestRec current request
# @param headers hash containing header names => header value
sub set_header_in {
my ( $class, $r, %headers ) = @_;
while ( my ( $h, $v ) = each %headers ) {
$r->header_in( $h => $v );
}
}
## @method void unset_header_in(Apache2::RequestRec request, array headers)
# removes request headers
# @param request Apache2::RequestRec current request
# @param headers array with header names to remove
sub unset_header_in {
my ( $class, $r, @headers ) = @_;
foreach my $h (@headers) {
$r->header_in( $h => "" ) if ( $r->header_in($h) );
}
}
## @method void set_header_out(Apache2::RequestRec request, hash headers)
# sets response headers
# @param request Apache2::RequestRec current request
# @param headers hash containing header names => header value
sub set_header_out {
my ( $class, $r, %headers ) = @_;
while ( my ( $h, $v ) = each %headers ) {
$r->err_header_out( $h => $v );
}
}
## @method string hostname(Apache2::RequestRec request)
# returns host, as set by full URI or Host header
# @param request Apache2::RequestRec current request
# @return host string Host value
sub hostname {
my ( $class, $r ) = @_;
return $r->hostname;
}
## @method string remote_ip(Apache2::RequestRec request)
# returns client IP address
# @param request Apache2::RequestRec current request
# @return IP_Addr string client IP
sub remote_ip {
my ( $class, $r ) = @_;
return $r->remote_ip;
}