Commit 99d294d7 authored by Yadd's avatar Yadd
Browse files

Replace read_body by Plack::Request::content() (#595)

parent 41d47e8a
......@@ -9,7 +9,6 @@ lib/Lemonldap/NG/Common/Apache/Session/SOAP.pm
lib/Lemonldap/NG/Common/Apache/Session/Store.pm
lib/Lemonldap/NG/Common/Captcha.pm
lib/Lemonldap/NG/Common/CGI.pm
lib/Lemonldap/NG/Common/CGI/SOAPServer.pm
lib/Lemonldap/NG/Common/CGI/SOAPService.pm
lib/Lemonldap/NG/Common/Cli.pm
lib/Lemonldap/NG/Common/Conf.pm
......@@ -38,6 +37,7 @@ lib/Lemonldap/NG/Common/PSGI/Cli/Lib.pm
lib/Lemonldap/NG/Common/PSGI/Constants.pm
lib/Lemonldap/NG/Common/PSGI/Request.pm
lib/Lemonldap/NG/Common/PSGI/Router.pm
lib/Lemonldap/NG/Common/PSGI/SOAPServer.pm
lib/Lemonldap/NG/Common/Regexp.pm
lib/Lemonldap/NG/Common/Safe.pm
lib/Lemonldap/NG/Common/Safelib.pm
......
......@@ -61,29 +61,6 @@ sub error {
return $self->{error};
}
sub read_body {
my $self = shift;
if ( $self->method eq 'GET' ) { return undef; }
elsif ( $self->method =~ /^(?:POST|PUT)$/ ) {
my $body = '';
if ( $self->env->{'_psgix.buffered'} ) {
my $length = $self->content_length;
while ( $length > 0 ) {
my $buffer;
$self->body->read( $buffer,
( $length < 8192 ) ? $length : 8192 );
$length -= length($buffer);
$body .= $buffer;
}
}
else {
$self->body->read( $body, $self->content_length, 0 );
}
utf8::upgrade($body);
return $body;
}
}
*params = \&Plack::Request::param;
sub set_param {
......@@ -112,7 +89,7 @@ sub jsonBodyToObj {
$self->error('No data');
return undef;
}
my $j = eval { from_json( $self->read_body ) };
my $j = eval { from_json( $self->content ) };
if ($@) {
$self->error("$@$!");
return undef;
......
# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl Lemonldap-NG-Manager.t'
#########################
# change 'tests => 1' to 'tests => last_test_to_print';
use Test::More tests => 4;
# SOAP::Lite is not required, so Lemonldap::NG::Common::Conf::SOAP may
# not run.
SKIP: {
eval { require SOAP::Lite };
skip
"SOAP::Lite is not installed, so SOAP configuration access will not work",
4
if ($@);
use_ok('Lemonldap::NG::Common::Conf');
my $h;
ok(
$h = new Lemonldap::NG::Common::Conf(
{
type => 'SOAP',
proxy => 'http://localhost',
}
)
);
ok( $h->can('_connect') );
ok( $h->can('_soapCall') );
}
#########################
# Insert your test code below, the Test::More module is use()ed here so read
# its man page ( perldoc Test::More ) for help writing this test script.
......@@ -774,7 +774,7 @@ sub extractFormInfo {
'debug' );
# Artifact request are sent with SOAP trough POST
my $art_request = $req->read_body;
my $art_request = $req->content;
my $art_response;
# Create Login object
......
......@@ -1125,7 +1125,7 @@ sub registration {
}
# Get client metadata
my $client_metadata_json = $req->read_body;
my $client_metadata_json = $req->content;
unless ($client_metadata_json) {
return $self->p->sendError( $req, 'Missing POST datas', 400 );
}
......
......@@ -981,7 +981,7 @@ sub artifactServer {
'debug' );
# Artifact request are sent with SOAP trough POST
my $art_request = $req->read_body;
my $art_request = $req->content;
my $art_response;
# Create Login object
......@@ -1616,7 +1616,7 @@ sub attributeServer {
$self->lmLog( "URL $url detected as an attribute service URL", 'debug' );
# Attribute request are sent with SOAP trough POST
my $att_request = $req->read_body;
my $att_request = $req->content;
my $att_response;
# Process request
......
......@@ -461,7 +461,7 @@ sub checkMessage {
$self->lmLog( "SAML method: HTTP-SOAP", 'debug' );
# SOAP is always a request
$request = $req->read_body;
$request = $req->content;
$self->lmLog( "HTTP-SOAP: SAML Request $request", 'debug' );
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment