Hello community, here is the log from the commit of package perl-Mojolicious for openSUSE:Factory checked in at 2018-02-09 15:46:21 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Mojolicious (Old) and /work/SRC/openSUSE:Factory/.perl-Mojolicious.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Mojolicious" Fri Feb 9 15:46:21 2018 rev:87 rq:573896 version:7.64 Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Mojolicious/perl-Mojolicious.changes 2018-01-20 11:25:39.367336355 +0100 +++ /work/SRC/openSUSE:Factory/.perl-Mojolicious.new/perl-Mojolicious.changes 2018-02-09 15:46:24.149855028 +0100 @@ -1,0 +2,19 @@ +Wed Feb 7 16:52:18 UTC 2018 - [email protected] + +- updated to 7.64 + see /usr/share/doc/packages/perl-Mojolicious/Changes + + 7.64 2018-02-07 + - Fixed a bug in Mojo::Log where short log messages spanning multiple lines + would not be formatted properly for systemd. + + 7.63 2018-02-06 + - Improved Mojo::Log to use native systemd log levels. + + 7.62 2018-02-01 + - Added -u option to get command. (jberger) + - Added dont_use_nlink option to list_tree method in Mojo::File. + - Added reverse proxy section to Mojolicious::Guides::Cookbook. (polettix) + - Fixed a promise resolution bug in Mojo::Promise. + +------------------------------------------------------------------- Old: ---- Mojolicious-7.61.tar.gz New: ---- Mojolicious-7.64.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Mojolicious.spec ++++++ --- /var/tmp/diff_new_pack.K1Cqbh/_old 2018-02-09 15:46:24.909827739 +0100 +++ /var/tmp/diff_new_pack.K1Cqbh/_new 2018-02-09 15:46:24.913827595 +0100 @@ -17,7 +17,7 @@ Name: perl-Mojolicious -Version: 7.61 +Version: 7.64 Release: 0 %define cpan_name Mojolicious Summary: Real-time web framework ++++++ Mojolicious-7.61.tar.gz -> Mojolicious-7.64.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.61/Changes new/Mojolicious-7.64/Changes --- old/Mojolicious-7.61/Changes 2018-01-08 18:26:40.000000000 +0100 +++ new/Mojolicious-7.64/Changes 2018-02-07 10:47:46.000000000 +0100 @@ -1,4 +1,17 @@ +7.64 2018-02-07 + - Fixed a bug in Mojo::Log where short log messages spanning multiple lines + would not be formatted properly for systemd. + +7.63 2018-02-06 + - Improved Mojo::Log to use native systemd log levels. + +7.62 2018-02-01 + - Added -u option to get command. (jberger) + - Added dont_use_nlink option to list_tree method in Mojo::File. + - Added reverse proxy section to Mojolicious::Guides::Cookbook. (polettix) + - Fixed a promise resolution bug in Mojo::Promise. + 7.61 2018-01-08 - Increased default upgrade_timeout from 60 to 180 seconds in Mojo::Server::Hypnotoad. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.61/META.json new/Mojolicious-7.64/META.json --- old/Mojolicious-7.61/META.json 2018-01-15 16:34:27.000000000 +0100 +++ new/Mojolicious-7.64/META.json 2018-02-07 11:16:36.000000000 +0100 @@ -58,6 +58,6 @@ }, "x_IRC" : "irc://irc.perl.org/#mojo" }, - "version" : "7.61", + "version" : "7.64", "x_serialization_backend" : "JSON::PP version 2.97001" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.61/META.yml new/Mojolicious-7.64/META.yml --- old/Mojolicious-7.61/META.yml 2018-01-15 16:34:27.000000000 +0100 +++ new/Mojolicious-7.64/META.yml 2018-02-07 11:16:36.000000000 +0100 @@ -31,5 +31,5 @@ homepage: http://mojolicious.org license: http://www.opensource.org/licenses/artistic-license-2.0 repository: https://github.com/kraih/mojo.git -version: '7.61' +version: '7.64' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.61/lib/Mojo/File.pm new/Mojolicious-7.64/lib/Mojo/File.pm --- old/Mojolicious-7.61/lib/Mojo/File.pm 2018-01-03 13:49:48.000000000 +0100 +++ new/Mojolicious-7.64/lib/Mojo/File.pm 2018-02-01 22:25:08.000000000 +0100 @@ -54,6 +54,9 @@ # This may break in the future, but is worth it for performance local $File::Find::skip_pattern = qr/^\./ unless $options->{hidden}; + # The File::Find documentation lies, this is needed for CIFS + local $File::Find::dont_use_nlink = 1 if $options->{dont_use_nlink}; + my %all; my $wanted = {wanted => sub { $all{$File::Find::name}++ }, no_chdir => 1}; $wanted->{postprocess} = sub { delete $all{$File::Find::dir} } @@ -320,6 +323,12 @@ Include directories. +=item dont_use_nlink + + dont_use_nlink => 1 + +Force L<File::Find> to always stat directories. + =item hidden hidden => 1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.61/lib/Mojo/Log.pm new/Mojolicious-7.64/lib/Mojo/Log.pm --- old/Mojolicious-7.61/lib/Mojo/Log.pm 2018-01-03 13:49:43.000000000 +0100 +++ new/Mojolicious-7.64/lib/Mojo/Log.pm 2018-02-07 10:51:20.000000000 +0100 @@ -24,6 +24,9 @@ # Supported log levels my %LEVEL = (debug => 1, info => 2, warn => 3, error => 4, fatal => 5); +# Systemd magic numbers +my %MAGIC = (debug => 7, info => 6, warn => 4, error => 3, fatal => 2); + sub append { my ($self, $msg) = @_; @@ -67,7 +70,11 @@ $self->append($self->format->(@$msg)); } -sub _short { shift; '[' . shift() . '] ' . join "\n", @_, '' } +sub _short { + my ($time, $level) = (shift, shift); + my ($magic, $short) = ("<$MAGIC{$level}>", substr($level, 0, 1)); + return "${magic}[$short] " . join("\n$magic", @_) . "\n"; +} 1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.61/lib/Mojo/Promise.pm new/Mojolicious-7.64/lib/Mojo/Promise.pm --- old/Mojolicious-7.61/lib/Mojo/Promise.pm 2018-01-03 13:49:42.000000000 +0100 +++ new/Mojolicious-7.64/lib/Mojo/Promise.pm 2018-02-03 15:24:40.000000000 +0100 @@ -15,8 +15,7 @@ and deprecated 'Use of Mojo::Promise::all as instance method is DEPRECATED' if ref $class; - my $all = $class->new; - + my $all = $class->new; my $results = []; my $remaining = scalar @promises; for my $i (0 .. $#promises) { @@ -109,7 +108,13 @@ sub _settle { my ($self, $status) = (shift, shift); + + $_[0]->then(sub { $self->resolve(@_); () }, sub { $self->reject(@_); () }) + and return $self + if blessed $_[0] && $_[0]->can('then'); + return $self if $self->{result}; + @{$self}{qw(result status)} = ([@_], $status); $self->_defer; return $self; @@ -122,11 +127,7 @@ my @res; return $new->reject($@) unless eval { @res = $cb->(@result); 1 }; - - return $new->resolve(@res) - unless @res == 1 && blessed $res[0] && $res[0]->can('then'); - - $res[0]->then(sub { $new->resolve(@_); () }, sub { $new->reject(@_); () }); + return $new->resolve(@res); } 1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.61/lib/Mojo/Server/Daemon.pm new/Mojolicious-7.64/lib/Mojo/Server/Daemon.pm --- old/Mojolicious-7.61/lib/Mojo/Server/Daemon.pm 2018-01-03 13:49:47.000000000 +0100 +++ new/Mojolicious-7.64/lib/Mojo/Server/Daemon.pm 2018-02-06 19:14:42.000000000 +0100 @@ -105,7 +105,6 @@ # Last keep-alive request or corrupted connection my $c = $self->{connections}{$id}; $tx->res->headers->connection('close') - and ++Mojo::IOLoop->stream($id)->{closed} if ($c->{requests} || 1) >= $self->max_requests || $req->error; $tx->on(resume => sub { $self->_write($id) }); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.61/lib/Mojo/Server/Hypnotoad.pm new/Mojolicious-7.64/lib/Mojo/Server/Hypnotoad.pm --- old/Mojolicious-7.61/lib/Mojo/Server/Hypnotoad.pm 2018-01-08 18:25:27.000000000 +0100 +++ new/Mojolicious-7.64/lib/Mojo/Server/Hypnotoad.pm 2018-01-16 11:12:52.000000000 +0100 @@ -383,7 +383,7 @@ $hypnotoad = $hypnotoad->upgrade_timeout(15); Maximum amount of time in seconds a zero downtime software upgrade may take -before getting canceled, defaults to C<60>. +before getting canceled, defaults to C<180>. =head1 METHODS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.61/lib/Mojolicious/Command/get.pm new/Mojolicious-7.64/lib/Mojolicious/Command/get.pm --- old/Mojolicious-7.61/lib/Mojolicious/Command/get.pm 2018-01-03 13:50:01.000000000 +0100 +++ new/Mojolicious-7.64/lib/Mojolicious/Command/get.pm 2018-02-01 22:46:09.000000000 +0100 @@ -3,8 +3,9 @@ use Mojo::DOM; use Mojo::IOLoop; -use Mojo::JSON qw(encode_json j); +use Mojo::JSON qw(to_json j); use Mojo::JSON::Pointer; +use Mojo::URL; use Mojo::UserAgent; use Mojo::Util qw(decode encode getopt); use Scalar::Util 'weaken'; @@ -31,6 +32,7 @@ 'o|connect-timeout=i' => sub { $ua->connect_timeout($_[1]) }, 'r|redirect' => \my $redirect, 'S|response-size=i' => sub { $ua->max_response_size($_[1]) }, + 'u|user=s' => \my $user, 'v|verbose' => \my $verbose; @args = map { decode 'UTF-8', $_ } @args; @@ -42,6 +44,7 @@ # Detect proxy for absolute URLs $url !~ m!^/! ? $ua->proxy->detect : $ua->server->app($self->app); + $url = Mojo::URL->new($url)->userinfo($user) if $user; $ua->max_redirects(10) if $redirect; my $buffer = ''; @@ -88,8 +91,7 @@ sub _json { return unless my $data = j(shift); return unless defined($data = Mojo::JSON::Pointer->new($data)->get(shift)); - return _say($data) unless ref $data eq 'HASH' || ref $data eq 'ARRAY'; - say encode_json($data); + _say(ref $data eq 'HASH' || ref $data eq 'ARRAY' ? to_json($data) : $data); } sub _say { length && say encode('UTF-8', $_) for @_ } @@ -142,6 +144,7 @@ mojo get mojolicious.org mojo get -v -r -o 25 -i 50 google.com mojo get -v -H 'Host: mojolicious.org' -H 'Accept: */*' mojolicious.org + mojo get -u 'sri:s3cret' https://mojolicious.org mojo get mojolicious.org > example.html mojo get -M PUT mojolicious.org < example.html mojo get -f 'q=Mojolicious' -f 'size=5' https://metacpan.org/search @@ -176,6 +179,8 @@ -r, --redirect Follow up to 10 redirects -S, --response-size <size> Maximum response size in bytes, defaults to 2147483648 (2GiB) + -u, --user <userinfo> Alternate mechanism for specifying + colon-separated username and password -v, --verbose Print request and response headers to STDERR diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.61/lib/Mojolicious/Guides/Contributing.pod new/Mojolicious-7.64/lib/Mojolicious/Guides/Contributing.pod --- old/Mojolicious-7.61/lib/Mojolicious/Guides/Contributing.pod 2017-12-15 00:06:31.000000000 +0100 +++ new/Mojolicious-7.64/lib/Mojolicious/Guides/Contributing.pod 2018-02-06 18:45:48.000000000 +0100 @@ -80,11 +80,11 @@ While the L<Mojolicious> distribution covers a wide range of features, we are rather conservative when it comes to adding new ones. So if your contribution -is not a bug fix, you can drastically increase its chances of getting accepted -by discussing it in advance on the -L<mailing list|http://groups.google.com/group/mojolicious> or the official IRC -channel C<#mojo> on C<irc.perl.org> -(L<chat now!|https://chat.mibbit.com/?channel=%23mojo&server=irc.perl.org>). +is not a simple bug fix, it is B<strongly recommended> that you discuss it in +advance on the L<mailing list|http://groups.google.com/group/mojolicious> or the +official IRC channel C<#mojo> on C<irc.perl.org> +(L<chat now!|https://chat.mibbit.com/?channel=%23mojo&server=irc.perl.org>), to +avoid unnecessary work and to increase its chances of getting accepted. The following mission statement and rules are the foundation of all L<Mojo> and L<Mojolicious> development. Please make sure that your contribution aligns well @@ -180,8 +180,7 @@ L<Mojolicious> is open source and free to use. However, the amount of effort needed to maintain the project and develop new features for it is not sustainable without proper financial backing. You can support the ongoing -development of L<Mojolicious> through L<PayPal|https://www.paypal.me/kraih> and -Bitcoin (C<1Cid78CmK4hvf78Ry8K2XeDx8pQHNh4hbz>). +development of L<Mojolicious> through L<PayPal|https://www.paypal.me/kraih>. If you run a business and use L<Mojolicious> in a revenue generating product, it makes business sense to support L<Mojolicious> development. Because it ensures diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.61/lib/Mojolicious/Guides/Cookbook.pod new/Mojolicious-7.64/lib/Mojolicious/Guides/Cookbook.pod --- old/Mojolicious-7.61/lib/Mojolicious/Guides/Cookbook.pod 2017-12-17 23:30:22.000000000 +0100 +++ new/Mojolicious-7.64/lib/Mojolicious/Guides/Cookbook.pod 2018-02-05 17:27:58.000000000 +0100 @@ -65,6 +65,62 @@ In L<Mojolicious> this event loop is L<Mojo::IOLoop>. +=head2 Reverse proxy + +A reverse proxy architecture is a deployment technique used in many production +environments, where a I<reverse proxy> server is put in front of your +application to act as the endpoint accessible by external clients. It can +provide a lot of benefits, like terminating SSL connections from the outside, +limiting the number of concurrent open sockets towards the Mojolicious +application (or even using Unix sockets), balancing load across multiple +instances, or supporting several applications through the same IP/port. + + .......................................... + : : + +--------+ : +-----------+ +---------------+ : + | |-------->| | | | : + | client | : | reverse |----->| Mojolicious | : + | |<--------| proxy | | application | : + +--------+ : | |<-----| | : + : +-----------+ +---------------+ : + : : + .. system boundary (e.g. same host) ...... + +This setup introduces some problems, though: the application will receive +requests from the reverse proxy instead of the original client; the +address/hostname where your application lives internally will be different from +the one visible from the outside; and if terminating SSL, the reverse proxy +exposes services via HTTPS while using HTTP towards the Mojolicious application. + +As an example, compare a sample request from the client and what the Mojolicious +application receives: + + client reverse proxy Mojolicious app + __|__ _______________|______________ ____|____ + / \ / \ / \ + 1.2.3.4 --HTTPS--> api.example.com 10.20.30.39 --HTTP--> 10.20.30.40 + + GET /foo/1 HTTP/1.1 | GET /foo/1 HTTP/1.1 + Host: api.example.com | Host: 10.20.30.40 + User-Agent: Firefox | User-Agent: ShinyProxy/1.2 + ... | ... + +However, now the client address is no longer available (which might be useful +for analytics, or Geo-IP) and URLs generated via +L<Mojolicious::Controller/"url_for"> will look like this: + + http://10.20.30.40/bar/2 + +instead of something meaningful for the client, like this: + + https://api.example.com/bar/2 + +To solve these problems, you can configure your reverse proxy to send the +missing data (see L</Nginx> and L</"Apache/mod_proxy">) and tell your +application about it by setting the environment variable C<MOJO_REVERSE_PROXY>. +For finer control, L</Rewriting> includes examples of how the changes could be +implemented manually. + =head1 DEPLOYMENT Getting L<Mojolicious> and L<Mojolicious::Lite> applications running on @@ -154,7 +210,6 @@ [Service] Type=simple ExecStart=/home/sri/myapp/script/my_app prefork -m production -l http://*:8080 - KillMode=process [Install] WantedBy=multi-user.target diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.61/lib/Mojolicious.pm new/Mojolicious-7.64/lib/Mojolicious.pm --- old/Mojolicious-7.61/lib/Mojolicious.pm 2018-01-04 19:52:04.000000000 +0100 +++ new/Mojolicious-7.64/lib/Mojolicious.pm 2018-02-06 21:52:04.000000000 +0100 @@ -66,7 +66,7 @@ has validator => sub { Mojolicious::Validator->new }; our $CODENAME = 'Doughnut'; -our $VERSION = '7.61'; +our $VERSION = '7.64'; sub AUTOLOAD { my $self = shift; @@ -945,6 +945,8 @@ Eugene Toropov +Flavio Poletti + Gisle Aas Graham Barr diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.61/t/mojo/log.t new/Mojolicious-7.64/t/mojo/log.t --- old/Mojolicious-7.61/t/mojo/log.t 2018-01-03 14:03:42.000000000 +0100 +++ new/Mojolicious-7.64/t/mojo/log.t 2018-02-07 10:46:27.000000000 +0100 @@ -50,7 +50,7 @@ like $log->format->(time, 'debug', qw(Test 1 2 3)), qr/^debug:\d+:Test:1:2:3$/, 'right format'; -# Short log messages +# Short log messages (systemd) { $log = Mojo::Log->new; ok !$log->short, 'long messages'; @@ -61,8 +61,18 @@ ok $log->short, 'short messages'; $log = Mojo::Log->new(short => 1); ok $log->short, 'short messages'; - like $log->format->(time, 'debug', 'Test 123'), qr/^\[debug\] Test 123\n$/, + like $log->format->(time, 'debug', 'Test 123'), qr/^<7>\[d\] Test 123\n$/, 'right format'; + like $log->format->(time, 'info', 'Test 123'), qr/^<6>\[i\] Test 123\n$/, + 'right format'; + like $log->format->(time, 'warn', 'Test 123'), qr/^<4>\[w\] Test 123\n$/, + 'right format'; + like $log->format->(time, 'error', 'Test 123'), qr/^<3>\[e\] Test 123\n$/, + 'right format'; + like $log->format->(time, 'fatal', 'Test 123'), qr/^<2>\[f\] Test 123\n$/, + 'right format'; + like $log->format->(time, 'debug', 'Test', '1', '2', '3'), + qr/^<7>\[d\] Test\n<7>1\n<7>2\n<7>3\n$/, 'right format'; } # Events diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.61/t/mojo/promise.t new/Mojolicious-7.64/t/mojo/promise.t --- old/Mojolicious-7.61/t/mojo/promise.t 2018-01-03 13:49:01.000000000 +0100 +++ new/Mojolicious-7.64/t/mojo/promise.t 2018-02-01 00:55:31.000000000 +0100 @@ -185,4 +185,21 @@ is_deeply \@results, [], 'promises not resolved'; is_deeply \@errors, ['third'], 'promise rejected'; +# Settle with promise +$promise = Mojo::Promise->new->resolve('works'); +@results = (); +$promise2 = Mojo::Promise->new->resolve($promise) + ->then(sub { push @results, 'first', @_; @_ }); +$promise2->then(sub { push @results, 'second', @_ }); +Mojo::IOLoop->one_tick; +is_deeply \@results, ['first', 'works', 'second', 'works'], 'promises resolved'; +$promise = Mojo::Promise->new->reject('works too'); +@errors = (); +$promise2 = Mojo::Promise->new->reject($promise) + ->catch(sub { push @errors, 'first', @_; @_ }); +$promise2->then(sub { push @errors, 'second', @_ }); +Mojo::IOLoop->one_tick; +is_deeply \@errors, ['first', 'works too', 'second', 'works too'], + 'promises rejected'; + done_testing();
