Hello community, here is the log from the commit of package perl-Mojolicious for openSUSE:Factory checked in at 2017-03-18 20:47:28 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Mojolicious (Old) and /work/SRC/openSUSE:Factory/.perl-Mojolicious.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Mojolicious" Sat Mar 18 20:47:28 2017 rev:65 rq:479452 version:7.29 Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Mojolicious/perl-Mojolicious.changes 2017-03-13 15:28:02.472426173 +0100 +++ /work/SRC/openSUSE:Factory/.perl-Mojolicious.new/perl-Mojolicious.changes 2017-03-18 20:47:31.255630468 +0100 @@ -1,0 +2,12 @@ +Wed Mar 15 07:19:20 UTC 2017 - [email protected] + +- updated to 7.29 + see /usr/share/doc/packages/perl-Mojolicious/Changes + + 7.29 2017-03-12 + - Added support for overriding configuration files in applications tested with + Test::Mojo. + - Added html_attr_unescape function to Mojo::Util. + - Fixed unescaping of HTML5 attribute values in Mojo::DOM::HTML. + +------------------------------------------------------------------- Old: ---- Mojolicious-7.28.tar.gz New: ---- Mojolicious-7.29.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Mojolicious.spec ++++++ --- /var/tmp/diff_new_pack.IXEbZD/_old 2017-03-18 20:47:32.347475787 +0100 +++ /var/tmp/diff_new_pack.IXEbZD/_new 2017-03-18 20:47:32.351475220 +0100 @@ -17,7 +17,7 @@ Name: perl-Mojolicious -Version: 7.28 +Version: 7.29 Release: 0 %define cpan_name Mojolicious Summary: Real-time web framework ++++++ Mojolicious-7.28.tar.gz -> Mojolicious-7.29.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.28/Changes new/Mojolicious-7.29/Changes --- old/Mojolicious-7.28/Changes 2017-03-07 22:17:16.000000000 +0100 +++ new/Mojolicious-7.29/Changes 2017-03-12 13:14:41.000000000 +0100 @@ -1,4 +1,10 @@ +7.29 2017-03-12 + - Added support for overriding configuration files in applications tested with + Test::Mojo. + - Added html_attr_unescape function to Mojo::Util. + - Fixed unescaping of HTML5 attribute values in Mojo::DOM::HTML. + 7.28 2017-03-07 - Added copy_to, realpath and sibling methods to Mojo::File. - Added dir option to list_tree method in Mojo::File. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.28/META.json new/Mojolicious-7.29/META.json --- old/Mojolicious-7.28/META.json 2017-03-07 22:35:59.000000000 +0100 +++ new/Mojolicious-7.29/META.json 2017-03-15 00:27:16.000000000 +0100 @@ -58,6 +58,6 @@ }, "x_IRC" : "irc://irc.perl.org/#mojo" }, - "version" : "7.28", + "version" : "7.29", "x_serialization_backend" : "JSON::PP version 2.27400" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.28/META.yml new/Mojolicious-7.29/META.yml --- old/Mojolicious-7.28/META.yml 2017-03-07 22:35:59.000000000 +0100 +++ new/Mojolicious-7.29/META.yml 2017-03-15 00:27:16.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.28' +version: '7.29' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.28/lib/Mojo/DOM/HTML.pm new/Mojolicious-7.29/lib/Mojo/DOM/HTML.pm --- old/Mojolicious-7.28/lib/Mojo/DOM/HTML.pm 2016-07-19 02:38:18.000000000 +0200 +++ new/Mojolicious-7.29/lib/Mojo/DOM/HTML.pm 2017-03-09 21:14:29.000000000 +0100 @@ -1,7 +1,7 @@ package Mojo::DOM::HTML; use Mojo::Base -base; -use Mojo::Util qw(html_unescape xml_escape); +use Mojo::Util qw(html_attr_unescape html_unescape xml_escape); use Scalar::Util 'weaken'; has tree => sub { ['root'] }; @@ -125,7 +125,7 @@ # Empty tag ++$closing and next if $key eq '/'; - $attrs{$key} = defined $value ? html_unescape $value : $value; + $attrs{$key} = defined $value ? html_attr_unescape $value : $value; } # "image" is an alias for "img" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.28/lib/Mojo/Server.pm new/Mojolicious-7.29/lib/Mojo/Server.pm --- old/Mojolicious-7.28/lib/Mojo/Server.pm 2017-01-26 00:07:47.000000000 +0100 +++ new/Mojolicious-7.29/lib/Mojo/Server.pm 2017-03-12 13:05:42.000000000 +0100 @@ -12,9 +12,9 @@ has reverse_proxy => sub { $ENV{MOJO_REVERSE_PROXY} }; sub build_app { - my ($self, $app) = @_; + my ($self, $app) = (shift, shift); local $ENV{MOJO_EXE}; - return $self->app($app->new)->app unless my $e = load_class $app; + return $self->app($app->new(@_))->app unless my $e = load_class $app; die ref $e ? $e : qq{Can't find application class "$app" in \@INC. (@INC)\n}; } @@ -150,6 +150,8 @@ =head2 build_app my $app = $server->build_app('MyApp'); + my $app = $server->build_app('MyApp', log => Mojo::Log->new); + my $app = $server->build_app('MyApp', {log => Mojo::Log->new}); Build application from class and assign it to L</"app">. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.28/lib/Mojo/Util.pm new/Mojolicious-7.29/lib/Mojo/Util.pm --- old/Mojolicious-7.28/lib/Mojo/Util.pm 2017-01-19 21:14:59.000000000 +0100 +++ new/Mojolicious-7.29/lib/Mojo/Util.pm 2017-03-09 21:03:15.000000000 +0100 @@ -51,14 +51,17 @@ # "Sun, 06 Nov 1994 08:49:37 GMT" and "Sunday, 06-Nov-94 08:49:37 GMT" my $EXPIRES_RE = qr/(\w+\W+\d+\W+\w+\W+\d+\W+\d+:\d+:\d+\W*\w+)/; +# HTML entities +my $ENTITY_RE = qr/&(?:\#((?:[0-9]{1,7}|x[0-9a-fA-F]{1,6}));|(\w+[;=]?))/; + # Encoding cache my %CACHE; our @EXPORT_OK = ( qw(b64_decode b64_encode camelize class_to_file class_to_path decamelize), qw(decode deprecated dumper encode extract_usage getopt hmac_sha1_sum), - qw(html_unescape md5_bytes md5_sum monkey_patch punycode_decode), - qw(punycode_encode quote secure_compare sha1_bytes sha1_sum), + qw(html_attr_unescape html_unescape md5_bytes md5_sum monkey_patch), + qw(punycode_decode punycode_encode quote secure_compare sha1_bytes sha1_sum), qw(split_cookie_header split_header steady_time tablify term_escape trim), qw(unindent unquote url_escape url_unescape xml_escape xor_encode) ); @@ -155,12 +158,8 @@ Getopt::Long::Configure($save); } -sub html_unescape { - my $str = shift; - $str - =~ s/&(?:\#((?:[0-9]{1,7}|x[0-9a-fA-F]{1,6}));|(\w+;?))/_decode($1, $2)/ge; - return $str; -} +sub html_attr_unescape { _html(shift, 1) } +sub html_unescape { _html(shift, 0) } # Declared in Mojo::Base to avoid circular require problems sub monkey_patch { Mojo::Base::_monkey_patch(@_) } @@ -367,25 +366,27 @@ return $k + (((PC_BASE - PC_TMIN + 1) * $delta) / ($delta + PC_SKEW)); } -sub _decode { - my ($point, $name) = @_; +sub _encoding { + $CACHE{$_[0]} //= find_encoding($_[0]) // croak "Unknown encoding '$_[0]'"; +} + +sub _entity { + my ($point, $name, $attr) = @_; # Code point return chr($point !~ /^x/ ? $point : hex $point) unless defined $name; # Named character reference - my $rest = ''; + my $rest = my $last = ''; while (length $name) { - return $ENTITIES{$name} . reverse $rest if exists $ENTITIES{$name}; - $rest .= chop $name; + return $ENTITIES{$name} . reverse $rest + if exists $ENTITIES{$name} + && (!$attr || $name =~ /;$/ || $last !~ /[A-Za-z0-9=]/); + $rest .= $last = chop $name; } return '&' . reverse $rest; } -sub _encoding { - $CACHE{$_[0]} //= find_encoding($_[0]) // croak "Unknown encoding '$_[0]'"; -} - # Supported on Perl 5.14+ sub _global_destruction { defined ${^GLOBAL_PHASE} && ${^GLOBAL_PHASE} eq 'DESTRUCT'; @@ -418,6 +419,12 @@ return [@part ? (@tree, \@part) : @tree]; } +sub _html { + my ($str, $attr) = @_; + $str =~ s/$ENTITY_RE/_entity($1, $2, $attr)/geo; + return $str; +} + sub _options { # Hash or name (one) @@ -631,6 +638,19 @@ # "11cedfd5ec11adc0ec234466d8a0f2a83736aa68" hmac_sha1_sum 'foo', 'passw0rd'; +=head2 html_attr_unescape + + my $str = html_attr_unescape $escaped; + +Same as L</"html_unescape">, but handles special rules from the +L<HTML Living Standard|https://html.spec.whatwg.org> for HTML attributes. + + # "foo=bar<est=baz" + html_attr_unescape 'foo=bar<est=baz'; + + # "foo=bar<est=baz" + html_attr_unescape 'foo=bar<est=baz'; + =head2 html_unescape my $str = html_unescape $escaped; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.28/lib/Mojolicious/Plugin/Config.pm new/Mojolicious-7.29/lib/Mojolicious/Plugin/Config.pm --- old/Mojolicious-7.28/lib/Mojolicious/Plugin/Config.pm 2017-01-09 18:47:43.000000000 +0100 +++ new/Mojolicious-7.29/lib/Mojolicious/Plugin/Config.pm 2017-03-12 13:12:22.000000000 +0100 @@ -22,6 +22,9 @@ sub register { my ($self, $app, $conf) = @_; + # Override + return $app->config if $app->config->{config_override}; + # Config file my $file = $conf->{file} || $ENV{MOJO_CONFIG}; $file ||= $app->moniker . '.' . ($conf->{ext} || 'conf'); @@ -101,6 +104,9 @@ C<$moniker.conf> with C<mode> specific ones like C<$moniker.$mode.conf>, which will be detected automatically. +If the configuration value C<config_override> has been set in L<Mojo/"config"> +when this plugin is loaded, it will not do anything. + The code of this plugin is a good example for learning to build new plugins, you're welcome to fork it. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.28/lib/Mojolicious/Plugin/JSONConfig.pm new/Mojolicious-7.29/lib/Mojolicious/Plugin/JSONConfig.pm --- old/Mojolicious-7.28/lib/Mojolicious/Plugin/JSONConfig.pm 2017-01-09 18:47:43.000000000 +0100 +++ new/Mojolicious-7.29/lib/Mojolicious/Plugin/JSONConfig.pm 2017-03-12 13:09:50.000000000 +0100 @@ -80,6 +80,9 @@ extend the normal configuration file C<$moniker.json> with C<mode> specific ones like C<$moniker.$mode.json>, which will be detected automatically. +If the configuration value C<config_override> has been set in L<Mojo/"config"> +when this plugin is loaded, it will not do anything. + The code of this plugin is a good example for learning to build new plugins, you're welcome to fork it. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.28/lib/Mojolicious.pm new/Mojolicious-7.29/lib/Mojolicious.pm --- old/Mojolicious-7.28/lib/Mojolicious.pm 2017-03-05 22:38:27.000000000 +0100 +++ new/Mojolicious-7.29/lib/Mojolicious.pm 2017-03-12 13:08:54.000000000 +0100 @@ -58,7 +58,7 @@ has validator => sub { Mojolicious::Validator->new }; our $CODENAME = 'Doughnut'; -our $VERSION = '7.28'; +our $VERSION = '7.29'; sub AUTOLOAD { my $self = shift; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.28/lib/Test/Mojo.pm new/Mojolicious-7.29/lib/Test/Mojo.pm --- old/Mojolicious-7.28/lib/Test/Mojo.pm 2016-12-09 00:33:21.000000000 +0100 +++ new/Mojolicious-7.29/lib/Test/Mojo.pm 2017-03-12 13:37:57.000000000 +0100 @@ -240,8 +240,12 @@ sub new { my $self = shift->SUPER::new; + return $self unless my $app = shift; - return $self->app(ref $app ? $app : Mojo::Server->new->build_app($app)); + + my @args = @_ ? {config => {config_override => 1, %{shift()}}} : (); + return $self->app( + ref $app ? $app : Mojo::Server->new->build_app($app, @args)); } sub options_ok { shift->_build_ok(OPTIONS => @_) } @@ -876,9 +880,15 @@ my $t = Test::Mojo->new; my $t = Test::Mojo->new('MyApp'); + my $t = Test::Mojo->new(MyApp => {foo => 'bar', baz => 23}); my $t = Test::Mojo->new(MyApp->new); -Construct a new L<Test::Mojo> object. +Construct a new L<Test::Mojo> object. In addition to a class name, you can pass +along a hash reference with configuration values that will be used to +instantiate the application. The special configuration value C<config_override> +will be set in L<Mojo/"config"> as well, which is used to disable configuration +plugins like L<Mojolicious::Plugin::Config> and +L<Mojolicious::Plugin::JSONConfig> for tests. =head2 options_ok diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.28/t/mojo/dom.t new/Mojolicious-7.29/t/mojo/dom.t --- old/Mojolicious-7.28/t/mojo/dom.t 2016-07-19 02:38:18.000000000 +0200 +++ new/Mojolicious-7.29/t/mojo/dom.t 2017-03-09 21:14:24.000000000 +0100 @@ -786,6 +786,18 @@ is $dom->at('.line2')->tag, 'div', 'right tag'; is $dom->at('.line3'), undef, 'no result'; +# Entities in attributes +$dom = Mojo::DOM->new(qq{<a href="/?foo<=bar"></a>}); +is $dom->at('a')->{href}, '/?foo<=bar', 'right attribute value'; +$dom = Mojo::DOM->new(qq{<a href="/?f<oo=bar"></a>}); +is $dom->at('a')->{href}, '/?f<oo=bar', 'right attribute value'; +$dom = Mojo::DOM->new(qq{<a href="/?f<-oo=bar"></a>}); +is $dom->at('a')->{href}, '/?f<-oo=bar', 'right attribute value'; +$dom = Mojo::DOM->new(qq{<a href="/?foo=<"></a>}); +is $dom->at('a')->{href}, '/?foo=<', 'right attribute value'; +$dom = Mojo::DOM->new(qq{<a href="/?f<oo=bar"></a>}); +is $dom->at('a')->{href}, '/?f<oo=bar', 'right attribute value'; + # Whitespaces before closing bracket $dom = Mojo::DOM->new('<div >content</div>'); ok $dom->at('div'), 'tag found'; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.28/t/mojo/util.t new/Mojolicious-7.29/t/mojo/util.t --- old/Mojolicious-7.28/t/mojo/util.t 2017-01-19 21:13:34.000000000 +0100 +++ new/Mojolicious-7.29/t/mojo/util.t 2017-03-09 21:07:16.000000000 +0100 @@ -11,10 +11,10 @@ use Mojo::Util qw(b64_decode b64_encode camelize class_to_file class_to_path decamelize), qw(decode dumper encode extract_usage getopt hmac_sha1_sum html_unescape), - qw(md5_bytes md5_sum monkey_patch punycode_decode punycode_encode quote), - qw(secure_compare sha1_bytes sha1_sum split_cookie_header split_header), - qw(steady_time tablify term_escape trim unindent unquote url_escape), - qw(url_unescape xml_escape xor_encode); + qw(html_attr_unescape md5_bytes md5_sum monkey_patch punycode_decode), + qw(punycode_encode quote secure_compare sha1_bytes sha1_sum), + qw(split_cookie_header split_header steady_time tablify term_escape trim), + qw(unindent unquote url_escape url_unescape xml_escape xor_encode); # camelize is camelize('foo_bar_baz'), 'FooBarBaz', 'right camelized result'; @@ -236,6 +236,17 @@ is html_unescape('&0&Ltf&&0oo ba;<r'), "&0&Ltf&&0oo\x{00a0}ba;<r", 'right HTML unescaped result'; +# html_attr_unescape +is html_attr_unescape('/?foo<=bar'), '/?foo<=bar', + 'right HTML unescaped result'; +is html_attr_unescape('/?f<oo=bar'), '/?f<oo=bar', + 'right HTML unescaped result'; +is html_attr_unescape('/?f<-oo=bar'), '/?f<-oo=bar', + 'right HTML unescaped result'; +is html_attr_unescape('/?foo=<'), '/?foo=<', 'right HTML unescaped result'; +is html_attr_unescape('/?f<oo=bar'), '/?f<oo=bar', + 'right HTML unescaped result'; + # url_unescape (bengal numbers with nothing to unescape) is html_unescape('&#০৩৯;&#x০৩৯;'), '&#০৩৯;&#x০৩৯;', 'no changes'; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.28/t/mojolicious/external_app.t new/Mojolicious-7.29/t/mojolicious/external_app.t --- old/Mojolicious-7.28/t/mojolicious/external_app.t 2016-07-19 02:38:18.000000000 +0200 +++ new/Mojolicious-7.29/t/mojolicious/external_app.t 2017-03-12 12:56:20.000000000 +0100 @@ -24,4 +24,18 @@ # More text from config file $t->get_ok('/test')->status_is(200)->content_is('works%21'); +# Config override +$t = Test::Mojo->new( + MyApp => {whatever => 'override!', works => 'override two!'}); + +# Text from config override +$t->get_ok('/')->status_is(200)->content_is('override two!'); + +# Static file again +$t->get_ok('/index.html')->status_is(200) + ->content_is("External static file!\n"); + +# More text from config override +$t->get_ok('/test')->status_is(200)->content_is('override!'); + done_testing();
