Net-AS2-PSGI
view release on metacpan or search on metacpan
lib/Net/AS2/PSGI.pm view on Meta::CPAN
my $sent = "$parent/SENT";
_create_directories($request->logger, $message_id, $parent, $sending, $sent);
return ($sending, $sent);
}
sub _receive_directories {
my ($request, $message_id, $partnership) = @_;
my $parent = $FILE_DIR . '/' . $partnership;
my $receiving = "$parent/RECEIVING";
my $received = "$parent/RECEIVED";
_create_directories($request->logger, $message_id, $parent, $receiving, $received);
return ($receiving, $received);
}
sub _create_directories {
my ($log, $message_id, @dir) = @_;
my $status;
my $level;
my @errors;
foreach my $dir (@dir) {
next if -d $dir;
if (mkpath($dir, 0, oct(700))) {
$status = 'Created';
$level = 'debug';
}
else {
$status = 'Error creating';
$level = 'error';
push @errors, $dir;
}
$log->({ level => $level, message => "<$message_id> $status directory $dir" }) if $log;
}
croak "Error creating directories: @errors" if @errors;
return;
}
sub _error_bad_request {
my ($request, $message) = @_;
if (my $log = $request->logger) {
$log->({ level => 'error', message => $message });
}
return $request->new_response(HTTP_BAD_REQUEST);
}
1;
=head1 EXAMPLES
This module has an /examples directory. It contains an example PSGI
application, its base configuration file, a systemd service for
starman and an nginx conf file with SSL configurations. There is also
some basic configuration files to get you started with partnering up
with an instance of L<https://github.com/phax/as2-server>.
The module's /t testing directory, includes test cases that forks AS2
L<Plack::Test> applications, and then tests transferring files between
using AS2 synchronous and AS2 asynchronous transfer modes.
=head1 SEE ALSO
L<Net::AS2>, L<Net::AS2::PSGI::FileHandler>, L<Net::AS2::PSGI::StateHandler>
L<RFC 4130|https://www.ietf.org/rfc/rfc4130.txt>, L<RFC 3798|https://www.ietf.org/rfc/rfc3798.txt>,
L<RFC 822|https://www.ietf.org/rfc/rfc822.txt>, L<RFC 2822|https://www.ietf.org/rfc/rfc2822.txt>
=head1 LICENSE AND COPYRIGHT
This software is copyright (c) 2019 by Catalyst IT, <ajm@cpan.org>
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
=head1 BUGS AND LIMITATIONS
=over 4
=item Content-Transfer-Encoding: binary and LF line-endings
During testing against an Oracle B2B implementation, an issue with
Digital Signatures was found. The Oracle instance was sending data
with LF line-endings using binary Content-Transfer-Encoding.
The L<Crypt::SMIME> validation failed the signature check.
A similar scenario occurred when testing with RSSBus software. In that
case, just sending the file with CRLF line-endings was successful. It
was not possible to test whether the same workaround would work with
Oracle B2B. Another possibility is to configure sending/receiving base64
Content-Transfer-Encoding requests.
The issue may lie in the OpenSSL canonicalisation code when handling
binary Content-Transfer-Encoding data. It appears to incorrectly apply
canonicalisation of binary specified data. (OpenSSL version 1.1.0g).
=item AS2 1.1 compression
The AS2 Protocol Version 1.1 (compression) is not supported.
=item Filesystem initiated interface
Unlike other AS2 software, this module does not provide a means to
send file to partners simply by copying a file to a designated 'send'
directory. That functionality could probably be created by combining
L<AnyEvent>, L<Twiggy> and this PSGI interface.
=back
=head1 DISCLAIMER OF WARRANTY
This module is not certificated by any AS2 body. This module creates a basic AS2 server.
When using this server, you must have reviewed and be responsible for
( run in 1.304 second using v1.01-cache-2.11-cpan-e93a5daba3e )