view release on metacpan or search on metacpan
- Removed deprecated build_tx, config, handler and log methods from Mojo.
- Added promisify method to Mojo::UserAgent::Transactor.
- Improved Mojolicious::Command to die on template errors.
7.84 2018-06-05
- Fixed a bug where test servers would be started when reusing a Mojo::UserAgent object after fork.
7.83 2018-06-02
- Replaced MOJO_DAEMON_DEBUG and MOJO_USERAGENT_DEBUG environment variables with MOJO_SERVER_DEBUG and
MOJO_CLIENT_DEBUG. (anparker)
- Updated IO::Socket::SSL requirement to 2.009 for ALPN support.
- Added modules Mojo::IOLoop::Stream::HTTPClient, Mojo::IOLoop::Stream::HTTPServer,
Mojo::IOLoop::Stream::WebSocketClient and Mojo::IOLoop::Stream::WebSocketServer. (anparker)
- Added transition method to Mojo::IOLoop. (anparker)
- Added close_connections method to Mojo::Server::Daemon. (anparker)
- Added stream_class and tls_protocols arguments to client and server methods in Mojo::IOLoop. (anparker, kraih)
- Fixed a small render_maybe argument localization bug.
7.82 2018-05-27
- Removed experimental status from new_tag and selector methods in Mojo::DOM.
- Improved Mojo::Server::PSGI with support for the before_server_start hook.
- Updated jQuery to version 3.2.1.
7.48 2017-10-19
- Reverted previous Mojo::File change since there were too many unintended side effects.
7.47 2017-10-05
- Added multipart content generator to Mojo::UserAgent::Transactor.
- Fixed a bug in Mojo::File where parts of a path could get accidentally upgraded from bytes to characters.
7.46 2017-09-12
- Fixed support for versions of IO::Socket::SSL older than 1.965 again.
7.45 2017-09-06
- Fixed support for versions of IO::Socket::SSL older than 1.965. (mudler, foursixnine, genio, kraih)
7.44 2017-09-02
- Reverted a previous change to Mojo::Loader that allowed for load_class to be called on the same class multiple
times, since it had very bad side effects.
- Improved Mojo::IOLoop::TLS to use a little less memory.
- Fixed a bug where Mojolicious controllers like "MyApp::Controller::Foo::Bar" would disappear if loading the
controller "MyApp::Controller::Foo" was attempted but failed.
7.43 2017-08-18
- Improved Mojo::Base role support with the ability to rebless objects.
7.24 2017-02-05
- Added open method to Mojo::File.
- Added tempfile function to Mojo::File.
- Fixed bug in Mojo::Asset::File where the slurp method would not work correctly for very large files.
7.23 2017-01-29
- Added max_request_size attribute to Mojolicious.
- Added max_response_size attribute to Mojo::UserAgent.
- Added to_unsafe_string method to Mojo::URL.
- Added -S option to get command.
- Fixed a data corruption problem in Mojo::IOLoop::Stream, caused by a dependency of IO::Socket::SSL on the internal
representation of strings, which differs from IO::Socket::IP. (coolo, kraih)
7.22 2017-01-25
- Added ports method to Mojo::Server::Daemon.
- Added remove_tree method to Mojo::File.
- Improved spurt method in Mojo::File with support for writing multiple chunks at once.
7.21 2017-01-21
- Added extract_usage function to Mojo::Util.
- Improve getopt function in Mojo::Util to use @ARGV by default.
6.60 2016-04-25
- Fixed bug in Mojo::IOLoop where stopping gracefully would sometimes result in connections getting closed too early.
(anparker, kraih)
6.59 2016-04-22
- Removed deprecated xss_escape function from Mojo::Util.
- Improved HTML Living Standard compliance of Mojo::DOM::HTML.
- Improved Mojo::Server::Daemon to log when a connection has been closed prematurely.
- Improved Mojo::Server::Prefork to log when the manager process has been stopped.
- Fixed a few tests to keep up with breaking changes in IO::Socket::SSL.
- Fixed a few timing bugs in tests.
6.58 2016-04-09
- Removed deprecated build_frame and parse_frame methods from Mojo::Transaction::WebSocket.
- Added fork policy to Mojolicious::Guides::Contributing.
- Improved Mojo::JSON to generate canonical JSON objects.
- Fixed bug in Mojo::Loader where classes with exceptions could not be loaded twice. (kiwiroy, kraih)
6.57 2016-03-23
- Fixed a few validation bugs in Mojolicious::Validator::Validation. (Mikey, kraih)
- Fixed bug where semicolons at the end of a cookie were not parsed correctly. (dmw397)
- Fixed bug in Mojo::IOLoop where connection limits were not properly enforced.
- Fixed url_for to handle paths without trailing slash correctly in embedded applications.
5.79 2015-02-13
- Fixed bug in Mojo::Reactor::Poll that caused excessive idle CPU usage.
5.78 2015-02-12
- Replaced expires method in Mojo::Cookie::Response with an attribute.
- Added split_cookie_header function to Mojo::Util.
- Updated IO::Socket::SSL requirement to 1.94.
- Relaxed RFC 822/1123 and RFC 850/1036 handling in Mojo::Date.
- Improved Mojo::Reactor::Poll performance significantly.
- Improved text method in Mojo::Message to use default_charset as well.
- Improved design of built-in templates.
- Fixed bug in Mojo::DOM that made parsing a requirement.
- Fixed warnings in Mojo::URL.
5.77 2015-02-03
- Added content_security_policy method to Mojo::Headers.
- Fixed canonicalize in Mojo::Path to not remove parts with more than three dots.
- Replaced format method in Mojo::Log with an attribute.
- Replaced check_file method in Mojo::Server::Morbo with check method.
- Added with_compression method to Mojo::Transaction::WebSocket.
- Added catch method to Mojo::EventEmitter.
- Added append method to Mojo::Log.
- Updated jQuery to version 2.1.1.
- Improved Mojo::IOLoop::Delay to automatically check if the event loop is already running.
- Improved Mojo::Parameters to consistently accept arrays.
- Improved Mojo::Collection to perform actual boolean checks. (marcus)
- Fixed Mojo::DOM::HTML to handle slashes in unquoted attribute values correctly.
- Fixed Mojo::IOLoop::Server to work correctly with newer versions of IO::Socket::SSL. (noxxi)
- Fixed rendering bug where rewritten arguments could not be localized.
- Fixed verification bug in Mojo::IOLoop::Server.
- Fixed path generation bug in Mojolicious::Routes::Match.
- Fixed warnings in Mojo::IOLoop::Delay.
4.99 2014-05-12
- Added support for performing blocking and non-blocking requests at the same time with Mojo::UserAgent.
- Added nb_url method to Mojo::UserAgent::Server.
- Improved Mojo::IOLoop::Server and Mojo::Server::Daemon to be able to listen on random ports.
4.97 2014-04-30
- Deprecated support for X-Forwarded-HTTPS in favor of X-Forwarded-Proto.
- Added multi-name support to param method in Mojo::Parameters.
4.96 2014-04-28
- Improved Mojo::IOLoop to use Mojo::IOLoop::Delay more consistently.
4.95 2014-04-27
- Improved Mojo::IOLoop::Delay with circular reference protection.
- Improved Mojo::IOLoop::Delay to allow argument splicing.
- Improved Mojo::IOLoop::Server to reuse cipher list from IO::Socket::SSL.
- Fixed memory leak in Mojo::UserAgent::Server.
4.94 2014-04-20
- Added reverse_proxy attribute to Mojo::Server::Daemon.
- Added reverse_proxy attribute to Mojo::Message::Request.
- Added prefork and upgrade_timeout attributes to Mojo::Server::Hypnotoad.
- Added configure method to Mojo::Server::Hypnotoad.
- Relaxed name handling in Mojo::Headers a little.
- Fixed small bug in online tests.
4.91 2014-03-29
- Added daemonize method to Mojo::Server.
- Added ensure_pid_file method to Mojo::Server::Prefork.
- Removed deprecated secret method from Mojolicious.
- Improved performance of Mojolicious::Plugin::EPRenderer and Mojolicious::Plugin::EPLRenderer.
- Improved Mojo::Reactor::Poll portability with POLLPRI support.
4.90 2014-03-16
- Removed deprecated to_rel method from Mojo::URL.
- Updated IO::Socket::SSL requirement to 1.84 due to breaking changes in IO::Socket::SSL.
- Improved documentation browser with more accessible links and readable inline code.
- Fixed textarea and title parsing bugs in Mojo::DOM::HTML.
4.89 2014-03-13
- Added support for template variants.
- Improved built-in templates with unobtrusive menu bar.
- Fixed bug in Mojo::DOM::HTML where non-self-closing elements were not handled correctly.
- Fixed bug in Mojo::DOM::HTML where <image> was not treated as an alias for <img>.
4.88 2014-03-09
- Relicensed all artwork to CC-SA version 4.0.
4.58 2013-11-19
- Improved IIS and WebSphere compatibility of Mojo::Message::Request.
- Improved Mojo::Collection to allow join without arguments.
- Improved Mojo::DOM::HTML performance.
- Fixed recursion bug in Mojo::Reactor::EV where timers could run more than once.
- Fixed a few "0" value bugs in Mojo::DOM::HTML.
4.57 2013-11-11
- Improved compatibility with IO::Socket::SSL 1.957.
- Fixed error event bug in Mojo::IOLoop::Delay.
4.56 2013-11-09
- Fixed backspace escaping bug in Mojo::JSON. (ig3)
4.55 2013-11-07
- Fixed Windows bug in "daemon.t".
4.54 2013-11-07
- Added parts attribute to Mojo::Home.
- Removed experimental status from validation method in Mojolicious::Controller.
- Removed experimental status from validator attribute in Mojolicious.
- Removed experimental status from validation helper in Mojolicious::Plugin::DefaultHelpers.
- Fixed parameter bug in Mojolicious::Validator::Validation.
4.48 2013-10-16
- Fixed support for Net::SSLeay 1.55.
4.47 2013-10-15
- Added dumper function to Mojo::Util.
- Improved compatibility with IO::Socket::SSL 1.955.
- Improved IIS compatibility of Mojo::Server::CGI.
4.46 2013-10-11
- Changed default name for generated applications from MyMojoliciousApp to MyApp.
- Improved performance of route matching in Mojolicious::Routes::Pattern.
- Improved HTML Living Standard compliance of Mojo::DOM::HTML.
4.45 2013-10-06
- Changed return values of validation checks in Mojolicious::Validator.
- Fixed unquoted attribute selector bug in Mojo::DOM::CSS.
- Fixed Perl 5.17.11+ compatibility.
- Fixed Mojo::JSON to encode "inf" and "nan" values as strings. (chansen)
- Fixed a few authority and rendering bugs in Mojo::URL.
- Fixed layout bugs in Mojolicious::Renderer.
- Fixed support for HEAD request method in Mojo::Server::CGI and Mojo::Server::PSGI.
- Fixed small line directive bug in Mojo::Template.
- Fixed small limit bug in Mojo::Message.
3.97 2013-04-25
- Added data attribute to Mojo::URL.
- Improved compatibility with IO::Socket::SSL 1.87.
- Improved Test::Mojo diagnostics messages.
- Fixed a few small timing bugs in WebSocket tests.
3.96 2013-04-22
- Updated jQuery to version 2.0.
- Updated prettify.js to version 4-Mar-2013.
- Improved Mojo::URL to be able to contain scheme data for unknown schemes.
- Improved form content generator for GET and HEAD requests. (jberger)
- Improved default descriptions in Test::Mojo.
- Fixed host normalization bug in Mojo::URL.
3.64 2012-12-01
- Fixed bug where Mojo::UserAgent::Transactor would escape Content-Disposition values.
3.63 2012-11-28
- Added support for smooth restarting to Morbo.
- Added acceptor method to Mojo::IOLoop.
- Added stop method to Mojo::Server::Daemon.
- Improved memory usage of chunked transfer encoding parser in Mojo::Content.
3.62 2012-11-26
- Improved compatibility with IO::Socket::SSL 1.79.
- Improved encode/decode performance in Mojo::Util by using a cache.
- Fixed clone bugs in Mojo::URL.
3.61 2012-11-25
- Added protocol method to Mojo::URL.
- Added charset attribute to Mojo::Path.
- Improved support for relative redirects in Mojo::UserAgent::Transactor.
- Fixed clone bugs in Mojo::Parameters and Mojo::URL.
- Fixed case-sensitivity bugs in Mojo::UserAgent::Transactor.
- Removed app_class attribute from Mojo::Server.
- Removed qp_decode and qp_encode methods from Mojo::ByteStream.
- Removed qp_decode and qp_encode functions from Mojo::Util.
- Removed render_to_file and render_file_to_file methods from Mojo::Template.
- Renamed Mojo::CookieJar to Mojo::UserAgent::CookieJar.
- Renamed Mojo::Command to Mojolicious::Command.
- Renamed format, reqs, symbol_start and symbols attributes in Mojolicious::Routes::Pattern to format_regex,
constraints, placeholder_start and placeholders.
- Merged get_all_data and get_data methods from Mojo::Command into data method in Mojo::Loader.
- Moved class_to_file and class_to_path methods from Mojo::Command to Mojo::Util.
- Updated IO::Socket::SSL requirement to 1.75 for IO::Socket::IP support.
- Switched back from IO::Socket::INET6 to IO::Socket::IP for IPv6 support.
- Switched from HMAC-MD5 to HMAC-SHA1 for signed cookies.
- Added slurp function to Mojo::Util.
- Added slurp method to Mojo::ByteStream.
- Added j and r functions to ojo. (sharifulin, kraih)
- Added accept_interval attribute to Mojo::IOLoop.
- Added support for new HTTP status code.
- Modernized ".perltidyrc".
- Improved Mojo::IOLoop::Server to prioritize RC4 cipher, which mitigates the BEAST attack. (Danny Thomas)
- Improved not found page to highlight custom route names.
- Fixed JSON Pointer escaping.
- Fixed small JSON Pointer bug in get command. (avkhozov)
- Fixed small application initialization bug in Mojo::Server.
2.98 2012-05-30
- Switched from IO::Socket::IP to IO::Socket::INET6 for IPv6 support.
- Improved IPv6 exception handling in Mojo::IOLoop::Client.
- Fixed array appending bug in Mojo::Parameters.
2.97 2012-05-28
- Added workaround to make IO::Socket::SSL work with IO::Socket::IP.
- Removed Bonjour support.
- Fixed bug that prevented Test::Mojo from working with normal Mojolicious applications that use
Mojolicious::Plugin::Config.
- Fixed a few small Unicode bugs in documentation.
2.96 2012-05-21
- Added merge method to Mojo::Path.
- Fixed small memory leak in Mojolicious.
- Fixed small bug that prevented already prepared IO::Socket::SSL handles to be used by Mojo::UserAgent.
- Fixed small Mojo::URL and Mojo::Path stringification bugs.
2.95 2012-05-10
- Fixed bug that caused inactivity timeouts to be logged too often.
2.94 2012-05-09
- Added support for 308 redirects to Mojo::UserAgent.
- Added support for new HTTP status codes.
- Improved exception handling of all scripts.
- Improved built-in web servers to log inactivity timeouts as debug messages instead of errors.
- Updated jQuery to version 1.6.1.
- Improved Mojo::JSON string escaping to make JSONP easier.
- Improved reloader slightly.
- Moved all bundled templates to "lib/Mojolicious/templates".
- Fixed reserved GET/POST param handling in Mojolicious::Controller.
- Fixed small XML semantics bug in Mojo::DOM.
- Fixed all blocking server bindings to default to a 404 status code.
1.32 2011-05-11
- Added EXPERIMENTAL name support for template exceptions.
- Updated IO::Socket::SSL requirement to 1.43 due to bugs in older versions. Note that the version requirement will
keep getting updated until we encounter a version that is not broken most of the time.
- Improved reloading slightly by allowing it to clean up the main namespace.
- Fixed enabling of Perl 5.10 features in Mojo::Base and Mojolicious::Lite. (garu, kraih)
- Fixed render_later to prevent delayed rendering warning.
1.31 2011-05-08
- Reverted deprecation of Perl 5.8.x support, by popular demand.
- Added FAQ entry to clarify the Perl 5.8.x situation.
- Fixed case-sensitivity of Mojo::DOM in XML mode.
- Fixed pseudo-class case handling in Mojo::DOM. (Akron)
- Fixed nested route bug.
- Fixed a small multipart parser bug.
- Fixed small any route bug.
- Fixed small empty route bug.
- Fixed URL merging in Mojo::URL.
- Fixed version detection in Mojolicious::Command::Version.
- Fixed Mojo::Client cloning.
1.01 2011-01-06
- Relicensed some of the images to make sure Mojolicious can be shipped with commercial products.
- Updated IO::Socket::SSL requirement to 1.37 due to bugs in older versions.
- Added EXPERIMENTAL TLS certificate authentication support. (tempire)
- Added EXPERIMENTAL title helper.
- Added EXPERIMENTAL render_later method to Mojolicious::Controller.
- Improved test. (Charlie Brady)
- Improved charset handling in Mojolicious slightly.
- Updated application generators with base tags.
- Fixed relative path handling in Mojo::URL.
- Fixed punycode bug. (kits)
- Fixed a bug where the static dispatcher would eat the flash.
lib/Mojo/IOLoop.pm view on Meta::CPAN
LIBEV_FLAGS=2 # poll
LIBEV_FLAGS=4 # epoll (Linux)
LIBEV_FLAGS=8 # kqueue (*BSD, OS X)
LIBEV_FLAGS=64 # Linux AIO
The event loop will be resilient to time jumps if a monotonic clock is available through L<Time::HiRes>. A TLS
certificate and key are also built right in, to make writing test servers as easy as possible. Also note that for
convenience the C<PIPE> signal will be set to C<IGNORE> when L<Mojo::IOLoop> is loaded.
For better scalability (epoll, kqueue) and to provide non-blocking name resolution, SOCKS5 as well as TLS support, the
optional modules L<EV> (4.32+), L<Net::DNS::Native> (0.15+), L<IO::Socket::Socks> (0.64+) and L<IO::Socket::SSL>
(2.009+) will be used automatically if possible. Individual features can also be disabled with the C<MOJO_NO_NNR>,
C<MOJO_NO_SOCKS> and C<MOJO_NO_TLS> environment variables.
See L<Mojolicious::Guides::Cookbook/"REAL-TIME WEB"> for more.
=head1 EVENTS
L<Mojo::IOLoop> inherits all events from L<Mojo::EventEmitter> and can emit the following new ones.
=head2 finish
lib/Mojo/IOLoop/Client.pm view on Meta::CPAN
my $bool = Mojo::IOLoop::Client->can_socks;
True if L<IO::Socket::SOCKS> 0.64+ is installed and SOCKS5 support enabled.
=head2 connect
$client->connect(address => '127.0.0.1', port => 3000);
$client->connect({address => '127.0.0.1', port => 3000});
Open a socket connection to a remote host. Note that non-blocking name resolution depends on L<Net::DNS::Native>
(0.15+), SOCKS5 support on L<IO::Socket::Socks> (0.64), and TLS support on L<IO::Socket::SSL> (2.009+).
These options are currently available:
=over 2
=item address
address => 'mojolicious.org'
Address or host name of the peer to connect to, defaults to C<127.0.0.1>.
lib/Mojo/IOLoop/Client.pm view on Meta::CPAN
=item tls_key
tls_key => '/etc/tls/client.key'
Path to the TLS key file.
=item tls_options
tls_options => {SSL_alpn_protocols => ['foo', 'bar'], SSL_verify_mode => 0x00}
Additional options for L<IO::Socket::SSL>.
=back
=head1 SEE ALSO
L<Mojolicious>, L<Mojolicious::Guides>, L<https://mojolicious.org>.
=cut
lib/Mojo/IOLoop/Server.pm view on Meta::CPAN
$handle = $class->new(%options) or croak "Can't create listen socket: $@";
$fd = fileno $handle;
$reuse = $self->{reuse} = join ':', $address, $handle->sockport, $fd;
}
$ENV{MOJO_REUSE} .= length $ENV{MOJO_REUSE} ? ",$reuse" : "$reuse";
}
$handle->blocking(0);
@$self{qw(args handle)} = ($args, $handle);
croak 'IO::Socket::SSL 2.009+ required for TLS support' if !Mojo::IOLoop::TLS->can_tls && $args->{tls};
}
sub port { shift->{handle}->sockport }
sub start {
my $self = shift;
weaken $self;
++$self->{active} and $self->reactor->io($self->{handle} => sub { $self->_accept })->watch($self->{handle}, 1, 0);
}
lib/Mojo/IOLoop/Server.pm view on Meta::CPAN
my $bool = $server->is_accepting;
Check if connections are currently being accepted.
=head2 listen
$server->listen(port => 3000);
$server->listen({port => 3000});
Create a new listen socket. Note that TLS support depends on L<IO::Socket::SSL> (2.009+).
These options are currently available:
=over 2
=item address
address => '127.0.0.1'
Local address to listen on, defaults to C<0.0.0.0>.
lib/Mojo/IOLoop/Server.pm view on Meta::CPAN
tls_key => '/etc/tls/server.key'
tls_key => {'mojolicious.org' => '/etc/tls/mojo.key'}
Path to the TLS key file, defaults to a built-in test key.
=item tls_options
tls_options => {SSL_alpn_protocols => ['foo', 'bar'], SSL_verify_mode => 0x00}
Additional options for L<IO::Socket::SSL>.
=back
=head2 port
my $port = $server->port;
Get port this server is listening on.
=head2 start
lib/Mojo/IOLoop/Stream.pm view on Meta::CPAN
$self->{timer}
= $reactor->timer($timeout => sub { $self and delete($self->{timer}) and $self->emit('timeout')->close });
}
return $self;
}
sub write {
my ($self, $chunk, $cb) = @_;
# IO::Socket::SSL will corrupt data with the wrong internal representation
utf8::downgrade $chunk;
$self->{buffer} .= $chunk;
if ($cb) { $self->once(drain => $cb) }
elsif (!length $self->{buffer}) { return $self }
$self->reactor->watch($self->{handle}, !$self->{paused}, 1) if $self->{handle};
return $self;
}
sub _again { $_[0]->reactor->again($_[0]{timer}) if $_[0]{timer} }
lib/Mojo/IOLoop/Stream.pm view on Meta::CPAN
=head2 close_gracefully
$stream->close_gracefully;
Close stream gracefully.
=head2 handle
my $handle = $stream->handle;
Get handle for stream, usually an L<IO::Socket::IP> or L<IO::Socket::SSL> object.
=head2 is_readable
my $bool = $stream->is_readable;
Quick non-blocking check if stream is readable, useful for identifying tainted sockets.
=head2 is_writing
my $bool = $stream->is_writing;
lib/Mojo/IOLoop/TLS.pm view on Meta::CPAN
package Mojo::IOLoop::TLS;
use Mojo::Base 'Mojo::EventEmitter';
use Mojo::File qw(curfile);
use Mojo::IOLoop;
use Scalar::Util qw(weaken);
# TLS support requires IO::Socket::SSL
use constant TLS => $ENV{MOJO_NO_TLS} ? 0 : !!eval { require IO::Socket::SSL; IO::Socket::SSL->VERSION('2.009'); 1 };
use constant READ => TLS ? IO::Socket::SSL::SSL_WANT_READ() : 0;
use constant WRITE => TLS ? IO::Socket::SSL::SSL_WANT_WRITE() : 0;
has reactor => sub { Mojo::IOLoop->singleton->reactor }, weak => 1;
# To regenerate the certificate run this command (28.06.2019)
# openssl req -x509 -newkey rsa:4096 -nodes -sha256 -out server.crt \
# -keyout server.key -days 7300 -subj '/CN=localhost'
my $CERT = curfile->sibling('resources', 'server.crt')->to_string;
my $KEY = curfile->sibling('resources', 'server.key')->to_string;
sub DESTROY { shift->_cleanup }
sub can_tls {TLS}
sub negotiate {
my ($self, $args) = (shift, ref $_[0] ? $_[0] : {@_});
return $self->emit(error => 'IO::Socket::SSL 2.009+ required for TLS support') unless TLS;
my $handle = $self->{handle};
return $self->emit(error => $IO::Socket::SSL::SSL_ERROR)
unless IO::Socket::SSL->start_SSL($handle, %{$self->_expand($args)});
$self->reactor->io($handle => sub { $self->_tls($handle, $args->{server}) });
}
sub new { shift->SUPER::new(handle => shift) }
sub _cleanup {
my $self = shift;
return undef unless my $reactor = $self->reactor;
$reactor->remove($self->{handle}) if $self->{handle};
return $self;
lib/Mojo/IOLoop/TLS.pm view on Meta::CPAN
$tls->{SSL_cert_file} = $args->{tls_cert} if $args->{tls_cert};
$tls->{SSL_key_file} = $args->{tls_key} if $args->{tls_key};
$tls->{SSL_server} = $args->{server} if $args->{server};
@{$tls}{keys %{$args->{tls_options}}} = values %{$args->{tls_options}} if $args->{tls_options};
if ($args->{server}) {
$tls->{SSL_cert_file} ||= $CERT;
$tls->{SSL_key_file} ||= $KEY;
}
else {
$tls->{SSL_hostname} = IO::Socket::SSL->can_client_sni ? $args->{address} : '';
$tls->{SSL_verifycn_name} = $args->{address};
}
return $tls;
}
sub _tls {
my ($self, $handle, $server) = @_;
# Switch between reading and writing
if (!($server ? $handle->accept_SSL : $handle->connect_SSL)) {
my $err = $IO::Socket::SSL::SSL_ERROR;
if ($err == READ) { $self->reactor->watch($handle, 1, 0) }
elsif ($err == WRITE) { $self->reactor->watch($handle, 1, 1) }
}
else { $self->_cleanup->emit(upgrade => delete $self->{handle}) }
}
1;
=encoding utf8
lib/Mojo/IOLoop/TLS.pm view on Meta::CPAN
this attribute is weakened.
=head1 METHODS
L<Mojo::IOLoop::TLS> inherits all methods from L<Mojo::EventEmitter> and implements the following new ones.
=head2 can_tls
my $bool = Mojo::IOLoop::TLS->can_tls;
True if L<IO::Socket::SSL> 2.009+ is installed and TLS support enabled.
=head2 negotiate
$tls->negotiate(server => 1, tls_version => 'TLSv1_2');
$tls->negotiate({server => 1, tls_version => 'TLSv1_2'});
Negotiate TLS.
These options are currently available:
lib/Mojo/IOLoop/TLS.pm view on Meta::CPAN
tls_key => '/etc/tls/server.key'
tls_key => {'mojolicious.org' => '/etc/tls/mojo.key'}
Path to the TLS key file, defaults to a built-in test key on the server-side.
=item tls_options
tls_options => {SSL_alpn_protocols => ['foo', 'bar'], SSL_verify_mode => 0x00, SSL_version => 'TLSv1_2'}
Additional options for L<IO::Socket::SSL>.
=back
=head2 new
my $tls = Mojo::IOLoop::TLS->new($handle);
Construct a new L<Mojo::IOLoop::Stream> object.
=head1 SEE ALSO
lib/Mojo/Server/Daemon.pm view on Meta::CPAN
$tx->resume;
});
$daemon->run;
=head1 DESCRIPTION
L<Mojo::Server::Daemon> is a full featured, highly portable non-blocking I/O HTTP and WebSocket server, with IPv6, TLS,
SNI, Comet (long polling), keep-alive and multiple event loop support.
For better scalability (epoll, kqueue) and to provide non-blocking name resolution, SOCKS5 as well as TLS support, the
optional modules L<EV> (4.32+), L<Net::DNS::Native> (0.15+), L<IO::Socket::Socks> (0.64+) and L<IO::Socket::SSL>
(2.009+) will be used automatically if possible. Individual features can also be disabled with the C<MOJO_NO_NNR>,
C<MOJO_NO_SOCKS> and C<MOJO_NO_TLS> environment variables.
See L<Mojolicious::Guides::Cookbook/"DEPLOYMENT"> for more.
=head1 SIGNALS
The L<Mojo::Server::Daemon> process can be controlled at runtime with the following signals.
=head2 INT, TERM
lib/Mojo/Server/Hypnotoad.pm view on Meta::CPAN
You can run the same command again for automatic hot deployment.
$ hypnotoad ./myapp.pl
Starting hot deployment for Hypnotoad server 31841.
This second invocation will load the application again, detect the process id file with it, and send a L</"USR2">
signal to the already running server.
For better scalability (epoll, kqueue) and to provide non-blocking name resolution, SOCKS5 as well as TLS support, the
optional modules L<EV> (4.32+), L<Net::DNS::Native> (0.15+), L<IO::Socket::Socks> (0.64+) and L<IO::Socket::SSL>
(2.009+) will be used automatically if possible. Individual features can also be disabled with the C<MOJO_NO_NNR>,
C<MOJO_NO_SOCKS> and C<MOJO_NO_TLS> environment variables.
See L<Mojolicious::Guides::Cookbook/"DEPLOYMENT"> for more.
=head1 MANAGER SIGNALS
The L<Mojo::Server::Hypnotoad> manager process can be controlled at runtime with the following signals.
=head2 INT, TERM
lib/Mojo/Server/Morbo.pm view on Meta::CPAN
around the very well tested and reliable L<Mojo::Server::Daemon>, with IPv6, TLS, SNI, UNIX domain socket, Comet (long
polling), keep-alive and multiple event loop support. Note that the server uses signals for process management, so you
should avoid modifying signal handlers in your applications.
To start applications with it you can use the L<morbo> script.
$ morbo ./myapp.pl
Web application available at http://127.0.0.1:3000
For better scalability (epoll, kqueue) and to provide non-blocking name resolution, SOCKS5 as well as TLS support, the
optional modules L<EV> (4.32+), L<Net::DNS::Native> (0.15+), L<IO::Socket::Socks> (0.64+) and L<IO::Socket::SSL>
(2.009+) will be used automatically if possible. Individual features can also be disabled with the C<MOJO_NO_NNR>,
C<MOJO_NO_SOCKS> and C<MOJO_NO_TLS> environment variables.
See L<Mojolicious::Guides::Cookbook/"DEPLOYMENT"> for more.
=head1 SIGNALS
The L<Mojo::Server::Morbo> process can be controlled at runtime with the following signals.
=head2 INT, TERM
lib/Mojo/Server/Prefork.pm view on Meta::CPAN
$prefork->run;
=head1 DESCRIPTION
L<Mojo::Server::Prefork> is a full featured, UNIX optimized, pre-forking non-blocking I/O HTTP and WebSocket server,
built around the very well tested and reliable L<Mojo::Server::Daemon>, with IPv6, TLS, SNI, UNIX domain socket, Comet
(long polling), keep-alive and multiple event loop support. Note that the server uses signals for process management,
so you should avoid modifying signal handlers in your applications.
For better scalability (epoll, kqueue) and to provide non-blocking name resolution, SOCKS5 as well as TLS support, the
optional modules L<EV> (4.32+), L<Net::DNS::Native> (0.15+), L<IO::Socket::Socks> (0.64+) and L<IO::Socket::SSL>
(1.84+) will be used automatically if possible. Individual features can also be disabled with the C<MOJO_NO_NNR>,
C<MOJO_NO_SOCKS> and C<MOJO_NO_TLS> environment variables.
See L<Mojolicious::Guides::Cookbook/"DEPLOYMENT"> for more.
=head1 MANAGER SIGNALS
The L<Mojo::Server::Prefork> manager process can be controlled at runtime with the following signals.
=head2 INT, TERM
lib/Mojo/UserAgent.pm view on Meta::CPAN
=head1 DESCRIPTION
L<Mojo::UserAgent> is a full featured non-blocking I/O HTTP and WebSocket user agent, with IPv6, TLS, SNI, IDNA,
HTTP/SOCKS5 proxy, UNIX domain socket, Comet (long polling), Promises/A+, keep-alive, connection pooling, timeout,
cookie, multipart, gzip compression and multiple event loop support.
All connections will be reset automatically if a new process has been forked, this allows multiple processes to share
the same L<Mojo::UserAgent> object safely.
For better scalability (epoll, kqueue) and to provide non-blocking name resolution, SOCKS5 as well as TLS support, the
optional modules L<EV> (4.32+), L<Net::DNS::Native> (0.15+), L<IO::Socket::Socks> (0.64+) and L<IO::Socket::SSL>
(2.009+) will be used automatically if possible. Individual features can also be disabled with the C<MOJO_NO_NNR>,
C<MOJO_NO_SOCKS> and C<MOJO_NO_TLS> environment variables.
See L<Mojolicious::Guides::Cookbook/"USER AGENT"> for more.
=head1 EVENTS
L<Mojo::UserAgent> inherits all events from L<Mojo::EventEmitter> and can emit the following new ones.
=head2 prepare
lib/Mojo/UserAgent.pm view on Meta::CPAN
=head2 ca
my $ca = $ua->ca;
$ua = $ua->ca('/etc/tls/ca.crt');
Path to TLS certificate authority file used to verify the peer certificate, defaults to the value of the
C<MOJO_CA_FILE> environment variable.
# Show certificate authorities for debugging
IO::Socket::SSL::set_defaults(SSL_verify_callback => sub { say "Authority: $_[2]" and return $_[0] });
=head2 cert
my $cert = $ua->cert;
$ua = $ua->cert('/etc/tls/client.crt');
Path to TLS certificate file, defaults to the value of the C<MOJO_CERT_FILE> environment variable.
=head2 connect_timeout
lib/Mojo/UserAgent.pm view on Meta::CPAN
my $cookie_jar = $ua->cookie_jar;
$ua = $ua->cookie_jar(Mojo::UserAgent::CookieJar->new);
Cookie jar to use for requests performed by this user agent, defaults to a L<Mojo::UserAgent::CookieJar> object.
# Ignore all cookies
$ua->cookie_jar->ignore(sub { 1 });
# Ignore cookies for public suffixes
my $ps = IO::Socket::SSL::PublicSuffix->default;
$ua->cookie_jar->ignore(sub ($cookie) {
return undef unless my $domain = $cookie->domain;
return ($ps->public_suffix($domain))[0] eq '';
});
# Add custom cookie to the jar
$ua->cookie_jar->add(
Mojo::Cookie::Response->new(
name => 'foo',
value => 'bar',
lib/Mojo/UserAgent.pm view on Meta::CPAN
my $options = $ua->socket_options;
$ua = $ua->socket_options({LocalAddr => '127.0.0.1'});
Additional options for L<IO::Socket::IP> when opening new connections.
=head2 tls_options
my $options = $ua->tls_options;
$ua = $ua->tls_options({SSL_cipher_list => 'DEFAULT:!DH@SECLEVEL=1'});
Additional options for L<IO::Socket::SSL> when opening new connections.
=head2 transactor
my $t = $ua->transactor;
$ua = $ua->transactor(Mojo::UserAgent::Transactor->new);
Transaction builder, defaults to a L<Mojo::UserAgent::Transactor> object.
# Change name of user agent
$ua->transactor->name('MyUA 1.0');
lib/Mojolicious/Command/version.pm view on Meta::CPAN
has description => 'Show versions of available modules';
has usage => sub { shift->extract_usage };
sub run {
my $self = shift;
my $json = Mojo::JSON->JSON_XS ? $Cpanel::JSON::XS::VERSION : 'n/a';
my $cryptx = Mojo::Util->CRYPTX ? $CryptX::VERSION : 'n/a';
my $ev = eval { require Mojo::Reactor::EV; 1 } ? $EV::VERSION : 'n/a';
my $socks = Mojo::IOLoop::Client->can_socks ? $IO::Socket::Socks::VERSION : 'n/a';
my $tls = Mojo::IOLoop::TLS->can_tls ? $IO::Socket::SSL::VERSION : 'n/a';
my $nnr = Mojo::IOLoop::Client->can_nnr ? $Net::DNS::Native::VERSION : 'n/a';
my $roles = Mojo::Base->ROLES ? $Role::Tiny::VERSION : 'n/a';
my $async = Mojo::Base->ASYNC ? $Future::AsyncAwait::VERSION : 'n/a';
print <<EOF;
CORE
Perl ($^V, $^O)
Mojolicious ($Mojolicious::VERSION, $Mojolicious::CODENAME)
OPTIONAL
Cpanel::JSON::XS 4.09+ ($json)
CryptX 0.080+ ($cryptx)
EV 4.32+ ($ev)
IO::Socket::Socks 0.64+ ($socks)
IO::Socket::SSL 2.009+ ($tls)
Net::DNS::Native 0.15+ ($nnr)
Role::Tiny 2.000001+ ($roles)
Future::AsyncAwait 0.52+ ($async)
EOF
# Check latest version on CPAN
my $latest = eval {
$self->app->ua->max_redirects(10)
->tap(sub { $_->proxy->detect })
lib/Mojolicious/Guides/FAQ.pod view on Meta::CPAN
beyond what commonly used modules like L<LWP> were designed for. Because of this, L<Mojolicious> contains a whole new
HTTP client/server stack called L<Mojo>, which was heavily inspired by the original LWPng effort and carefully designed
with these new requirements in mind. So while some of the higher abstraction layers might look similar to other web
frameworks, it is more of a web toolkit and can even be used as the foundation for more advanced web frameworks.
=head2 Why doesn't Mojolicious have any dependencies?
We are optimizing L<Mojolicious> for user-friendliness and development speed, without compromises. While there are no
rules in L<Mojolicious::Guides::Contributing> that forbid dependencies, we do currently discourage adding non-optional
ones in favor of a faster and more painless installation process. And we do in fact already use several optional CPAN
modules such as L<Cpanel::JSON::XS>, L<CryptX>, L<EV>, L<IO::Socket::Socks>, L<IO::Socket::SSL>, L<Net::DNS::Native>,
L<Plack> and L<Role::Tiny> to provide advanced functionality if possible.
=head2 Why reinvent wheels?
Because we can make them rounder. Components specifically designed for user-friendliness and development speed are not
easy to come by. We are strong believers of the Perl mantra "There is more than one way to do it", and our quest is to
develop the best possible solutions for these two criteria.
=head2 What about backwards compatibility?
lib/Mojolicious/Guides/FAQ.pod view on Meta::CPAN
is otherwise almost identical to Hypnotoad.
$ ./myapp.pl prefork -m production -l http://*:8080 -w 10
=head2 What does the error "...certificate verify failed" mean?
There are many variations of this error, but most of them mean that TLS certificate verification in L<Mojo::UserAgent>
failed. This usually happens for two reasons. The most common one is that the peer certificate is simply invalid. If
that's the case and you are certain that no MITM attack is being attempted, you can use the attribute
L<Mojo::UserAgent/"insecure"> or C<MOJO_INSECURE> environment variable to disable certificate verification. And if
that's not the case you might be missing the L<Mozilla::CA> module, which is often required by L<IO::Socket::SSL> to be
able to verify certificates.
=head2 What does the error "Maximum message size exceeded" mean?
To protect your applications from excessively large requests and responses, our HTTP parser has a cap after which it
will automatically stop accepting new data, and in most cases force the connection to be closed. The limit is 16MiB for
requests, and 2GiB for responses by default. You can use the attributes L<Mojolicious/"max_request_size"> and
L<Mojo::UserAgent/"max_response_size"> to change these values.
=head2 What does the error "Maximum start-line size exceeded" mean?
t/mojo/daemon.t view on Meta::CPAN
my $daemon = Mojo::Server::Daemon->new(app => $app, listen => ["http://127.0.0.1?fd=$fd"], silent => 1)->start;
my $port = $listen->sockport;
is $daemon->ports->[0], $port, 'same port';
my $tx = $ua->get("http://127.0.0.1:$port/port");
is $tx->res->code, 200, 'right status';
is $tx->res->body, $port, 'right content';
};
subtest 'No TLS support' => sub {
eval { Mojo::Server::Daemon->new(listen => ['https://127.0.0.1'], silent => 1)->start };
like $@, qr/IO::Socket::SSL/, 'right error';
};
subtest 'Abstract methods' => sub {
eval { Mojo::Server->run };
like $@, qr/Method "run" not implemented by subclass/, 'right error';
};
done_testing();
t/mojo/daemon_ipv6_tls.t view on Meta::CPAN
BEGIN { $ENV{MOJO_REACTOR} = 'Mojo::Reactor::Poll' }
use Test::More;
use Mojo::IOLoop::TLS;
use Mojo::File qw(curfile);
use lib curfile->sibling('lib')->to_string;
plan skip_all => 'set TEST_IPV6 to enable this test (developer only!)' unless $ENV{TEST_IPV6} || $ENV{TEST_ALL};
plan skip_all => 'set TEST_TLS to enable this test (developer only!)' unless $ENV{TEST_TLS} || $ENV{TEST_ALL};
plan skip_all => 'IO::Socket::SSL 2.009+ required for this test!' unless Mojo::IOLoop::TLS->can_tls;
# To regenerate all required certificates run these commands (07.01.2016)
# openssl genrsa -out domain.key 1024
# openssl req -new -key domain.key -out domain.csr -subj "/C=US/CN=example.com"
# openssl x509 -req -days 7300 -in domain.csr -out domain.crt -CA ca.crt \
# -CAkey ca.key -CAcreateserial
use Mojo::IOLoop;
use Mojo::Server::Daemon;
use Mojo::TestConnectProxy;
use Mojo::UserAgent;
t/mojo/daemon_ipv6_tls.t view on Meta::CPAN
# IPv6 and TLS
my $daemon = Mojo::Server::Daemon->new(app => app, listen => ['https://[::1]'], silent => 1);
my $port = $daemon->start->ports->[0];
my $ua = Mojo::UserAgent->new(ioloop => Mojo::IOLoop->singleton, insecure => 1);
my $tx = $ua->get("https://[::1]:$port/");
is $tx->res->code, 200, 'right status';
is $tx->res->body, 'works!', 'right content';
subtest 'IPv6, TLS, SNI and a proxy' => sub {
plan skip_all => 'SNI support required!' unless IO::Socket::SSL->can_client_sni && IO::Socket::SSL->can_server_sni;
$daemon = Mojo::Server::Daemon->new(app => app, silent => 1);
my $listen
= 'https://[::1]'
. '?127.0.0.1_cert=t/mojo/certs/server.crt'
. '&127.0.0.1_key=t/mojo/certs/server.key'
. '&example.com_cert=t/mojo/certs/domain.crt'
. '&example.com_key=t/mojo/certs/domain.key';
my $forward = $daemon->listen([$listen])->start->ports->[0];
my $id = Mojo::TestConnectProxy::proxy({address => '[::1]'}, {address => '[::1]', port => $forward});
my $proxy = Mojo::IOLoop->acceptor($id)->port;
t/mojo/ioloop_tls.t view on Meta::CPAN
use Mojo::Base -strict;
BEGIN { $ENV{MOJO_REACTOR} = 'Mojo::Reactor::Poll' }
use Test::More;
use Mojo::IOLoop::TLS;
plan skip_all => 'set TEST_TLS to enable this test (developer only!)' unless $ENV{TEST_TLS} || $ENV{TEST_ALL};
plan skip_all => 'IO::Socket::SSL 2.009+ required for this test!' unless Mojo::IOLoop::TLS->can_tls;
# To regenerate all required certificates run these commands (12.12.2014)
# openssl genrsa -out ca.key 1024
# openssl req -new -key ca.key -out ca.csr -subj "/C=US/CN=ca"
# openssl req -x509 -days 7300 -key ca.key -in ca.csr -out ca.crt
#
# openssl genrsa -out server.key 1024
# openssl req -new -key server.key -out server.csr -subj "/C=US/CN=127.0.0.1"
# openssl x509 -req -days 7300 -in server.csr -out server.crt -CA ca.crt \
# -CAkey ca.key -CAcreateserial
t/mojo/ioloop_tls.t view on Meta::CPAN
$client = 'connected';
$client_err = shift;
}
);
Mojo::IOLoop->start;
is $server, 'accepted', 'right result';
is $client, 'connected', 'right result';
ok !$client_err, 'no error';
subtest 'ALPN' => sub {
plan skip_all => 'ALPN support required!' unless IO::Socket::SSL->can_alpn;
my ($server_proto, $client_proto);
$id = Mojo::IOLoop->server(
address => '127.0.0.1',
tls => 1,
tls_options => {SSL_alpn_protocols => ['foo', 'bar', 'baz']},
sub {
my ($loop, $stream) = @_;
$server_proto = $stream->handle->alpn_selected;
$stream->close;
}
t/mojo/tls.t view on Meta::CPAN
use Mojo::Base -strict;
BEGIN { $ENV{MOJO_REACTOR} = 'Mojo::Reactor::Poll' }
use Test::More;
use Mojo::IOLoop::TLS;
plan skip_all => 'set TEST_TLS to enable this test (developer only!)' unless $ENV{TEST_TLS} || $ENV{TEST_ALL};
plan skip_all => 'IO::Socket::SSL 2.009+ required for this test!' unless Mojo::IOLoop::TLS->can_tls;
use Mojo::IOLoop;
use Mojo::Promise;
use Socket;
subtest 'Built-in certificate' => sub {
socketpair(my $client_sock, my $server_sock, AF_UNIX, SOCK_STREAM, PF_UNSPEC)
or die "Couldn't create socket pair: $!";
$client_sock->blocking(0);
$server_sock->blocking(0);
t/mojo/tls.t view on Meta::CPAN
$server->once(error => sub { warn pop });
$server->negotiate({server => 1});
my $client = Mojo::IOLoop::TLS->new($client_sock);
$client->once(upgrade => sub { $promise2->resolve(pop) });
$client->once(error => sub { warn pop });
$client->negotiate(tls_options => {SSL_verify_mode => 0x00});
my ($client_result, $server_result);
Mojo::Promise->all($promise, $promise2)->then(sub {
($server_result, $client_result) = map { $_->[0] } @_;
})->wait;
is ref $client_result, 'IO::Socket::SSL', 'right class';
is ref $server_result, 'IO::Socket::SSL', 'right class';
};
subtest 'Built-in certificate (custom event loop and cipher)' => sub {
my $loop = Mojo::IOLoop->new;
socketpair(my $client_sock2, my $server_sock2, AF_UNIX, SOCK_STREAM, PF_UNSPEC)
or die "Couldn't create socket pair: $!";
$client_sock2->blocking(0);
$server_sock2->blocking(0);
my $promise = Mojo::Promise->new->ioloop($loop);
my $promise2 = Mojo::Promise->new->ioloop($loop);
t/mojo/tls.t view on Meta::CPAN
$server->once(error => sub { warn pop });
$server->negotiate(server => 1, tls_options => {SSL_cipher_list => 'AES256-SHA:ALL'});
my $client = Mojo::IOLoop::TLS->new($client_sock2)->reactor($loop->reactor);
$client->once(upgrade => sub { $promise2->resolve(pop) });
$client->once(error => sub { warn pop });
$client->negotiate(tls_options => {SSL_verify_mode => 0x00});
my ($client_result, $server_result);
Mojo::Promise->all($promise, $promise2)->then(sub {
($server_result, $client_result) = map { $_->[0] } @_;
})->wait;
is ref $client_result, 'IO::Socket::SSL', 'right class';
is ref $server_result, 'IO::Socket::SSL', 'right class';
my $expect = $server_result->get_sslversion eq 'TLSv1_3' ? 'TLS_AES_256_GCM_SHA384' : 'AES256-SHA';
is $client_result->get_cipher, $expect, "$expect has been negotiatied";
is $server_result->get_cipher, $expect, "$expect has been negotiatied";
};
done_testing;
t/mojo/user_agent.t view on Meta::CPAN
$ua = Mojo::UserAgent->new;
$tx = $ua->build_tx(GET => '/');
$tx->req->proxy($ua->server->url->scheme('socks'));
$tx = $ua->start($tx);
like $tx->error->{message}, qr/IO::Socket::Socks/, 'right error';
ok !Mojo::IOLoop::Client->can_socks, 'no SOCKS5 support';
# HTTPS request without TLS support
$ua = Mojo::UserAgent->new;
$tx = $ua->get($ua->server->url->scheme('https'));
like $tx->error->{message}, qr/IO::Socket::SSL/, 'right error';
ok !Mojo::IOLoop::TLS->can_tls, 'no TLS support';
# Promises (rejected)
my $error;
$ua->get_p($ua->server->url->scheme('https'))->catch(sub { $error = shift })->wait;
like $error, qr/IO::Socket::SSL/, 'right error';
# No non-blocking name resolution
ok !Mojo::IOLoop::Client->can_nnr, 'no non-blocking name resolution support';
# Blocking
$tx = $ua->get('/');
ok !$tx->error, 'no error';
ok !$tx->kept_alive, 'kept connection not alive';
is $tx->res->version, '1.1', 'right version';
is $tx->res->code, 200, 'right status';
t/mojo/user_agent_online.t view on Meta::CPAN
BEGIN {
$ENV{MOJO_PROXY} = 0;
$ENV{MOJO_REACTOR} = 'Mojo::Reactor::Poll';
}
use Test::More;
use Mojo::IOLoop::TLS;
plan skip_all => 'set TEST_ONLINE to enable this test (developer only!)' unless $ENV{TEST_ONLINE} || $ENV{TEST_ALL};
plan skip_all => 'IO::Socket::SSL 2.009+ required for this test!' unless Mojo::IOLoop::TLS->can_tls;
plan skip_all => 'Mozilla::CA required for this test!' unless eval { require Mozilla::CA; 1 };
use IO::Socket::INET;
use Mojo::IOLoop;
use Mojo::Transaction::HTTP;
use Mojo::UserAgent;
use Mojolicious::Lite;
use ojo;
get '/remote_address' => sub {
t/mojo/user_agent_socks.t view on Meta::CPAN
use Mojo::Base -strict;
BEGIN { $ENV{MOJO_REACTOR} = 'Mojo::Reactor::Poll' }
use Test::More;
use Mojo::IOLoop::Client;
use Mojo::IOLoop::TLS;
plan skip_all => 'set TEST_SOCKS to enable this test (developer only!)' unless $ENV{TEST_SOCKS} || $ENV{TEST_ALL};
plan skip_all => 'IO::Socket::Socks 0.64+ required for this test!' unless Mojo::IOLoop::Client->can_socks;
plan skip_all => 'IO::Socket::SSL 2.009+ required for this test!' unless Mojo::IOLoop::TLS->can_tls;
use Mojo::IOLoop;
use Mojo::IOLoop::Server;
use Mojo::IOLoop::Stream;
use Mojo::UserAgent;
use Mojolicious::Lite;
use Scalar::Util qw(weaken);
# Silence
app->log->level('fatal');
t/mojo/user_agent_tls.t view on Meta::CPAN
use Mojo::Base -strict;
BEGIN { $ENV{MOJO_REACTOR} = 'Mojo::Reactor::Poll' }
use Test::More;
use Mojo::IOLoop::TLS;
plan skip_all => 'set TEST_TLS to enable this test (developer only!)' unless $ENV{TEST_TLS} || $ENV{TEST_ALL};
plan skip_all => 'IO::Socket::SSL 2.009+ required for this test!' unless Mojo::IOLoop::TLS->can_tls;
use Mojo::IOLoop;
use Mojo::Server::Daemon;
use Mojo::UserAgent;
use Mojolicious::Lite;
# Silence
app->log->level('fatal');
get '/' => {text => 'works!'};
t/mojo/websocket_proxy_tls.t view on Meta::CPAN
BEGIN { $ENV{MOJO_REACTOR} = 'Mojo::Reactor::Poll' }
use Test::More;
use Mojo::IOLoop::TLS;
use Mojo::File qw(curfile);
use lib curfile->sibling('lib')->to_string;
plan skip_all => 'set TEST_TLS to enable this test (developer only!)' unless $ENV{TEST_TLS} || $ENV{TEST_ALL};
plan skip_all => 'IO::Socket::SSL 2.009+ required for this test!' unless Mojo::IOLoop::TLS->can_tls;
use Mojo::IOLoop;
use Mojo::Server::Daemon;
use Mojo::TestConnectProxy;
use Mojo::UserAgent;
use Mojolicious::Lite;
# Silence
app->log->level('fatal');
t/mojolicious/tls_lite_app.t view on Meta::CPAN
use Mojo::Base -strict;
BEGIN { $ENV{MOJO_REACTOR} = 'Mojo::Reactor::Poll' }
use Test::More;
use Mojo::IOLoop::TLS;
plan skip_all => 'set TEST_TLS to enable this test (developer only!)' unless $ENV{TEST_TLS} || $ENV{TEST_ALL};
plan skip_all => 'IO::Socket::SSL 2.009+ required for this test!' unless Mojo::IOLoop::TLS->can_tls;
use Mojo::IOLoop;
use Mojo::UserAgent;
use Mojolicious::Lite;
use Test::Mojo;
# Silence
app->log->level('fatal');
# Secure sessions