diff -Nru libmojolicious-perl-9.33+dfsg/Changes libmojolicious-perl-9.35+dfsg/Changes --- libmojolicious-perl-9.33+dfsg/Changes 2023-06-14 17:41:01.000000000 +0000 +++ libmojolicious-perl-9.35+dfsg/Changes 2023-10-27 17:10:16.000000000 +0000 @@ -1,4 +1,25 @@ +9.35 2023-10-27 + - Added EXPERIMENTAL support for persistent cookies in Netscape format. + - Added EXPERIMENTAL file attribute to Mojo::UserAgent::CookieJar. + - Added EXPERIMENTAL load, save and to_string methods to Mojo::UserAgent::CookieJar. + - Fixed error reporting when loading applicartions with syntax errors. (haarg) + - Fixed absolute URL support in url_for_file and url_for_asset methods. (rawleyfowler) + +9.34 2023-09-11 + - Added support for serving static files with a prefix. + - Deprecated Mojo::File::spurt in favor of Mojo::File::spew. + - Added prefix attribute to Mojolicious::Static. + - Added url_for_file method to Mojolicious::Controller. + - Added file_path method to Mojolicious::Static. + - Added spew method to Mojo::File. (genio) + - Added encoding option to slurp method in Mojo::File. (genio) + - Added url_for_asset and url_for_file helpers to Mojolicious::Plugins::DefaultHelpers. + - Added favicon helper to Mojolicious::Plugin::TagHelpers. + - Fixed support for module_true Perl feature in Mojolicious apps. (haarg) + - Fixed a bug in Mojo::Promise where map could hang on false values after concurrency limit. (ilmari) + - Fixed built-in templates to not require an internet connection. (hernan604) + 9.33 2023-06-14 - Improved log messages to refer to the FAQ when they have an entry. - Fixed a bug where the prefork server could sometimes send redundant QUIT signals, which could result in unintended diff -Nru libmojolicious-perl-9.33+dfsg/MANIFEST libmojolicious-perl-9.35+dfsg/MANIFEST --- libmojolicious-perl-9.33+dfsg/MANIFEST 2023-06-14 19:25:30.000000000 +0000 +++ libmojolicious-perl-9.35+dfsg/MANIFEST 2023-10-27 17:11:04.000000000 +0000 @@ -161,6 +161,7 @@ LICENSE Makefile.PL MANIFEST This list of files +MANIFEST.bak MANIFEST.SKIP README.md script/hypnotoad @@ -185,6 +186,7 @@ t/mojo/content.t t/mojo/cookie.t t/mojo/cookiejar.t +t/mojo/cookies/curl.txt t/mojo/daemon.t t/mojo/daemon_ipv6_tls.t t/mojo/date.t @@ -221,6 +223,7 @@ t/mojo/lib/Mojo/LoaderTestException/A.pm t/mojo/lib/Mojo/Server/Morbo/Backend/TestBackend.pm t/mojo/lib/Mojo/TestConnectProxy.pm +t/mojo/lib/myapp-module-true.pl t/mojo/lib/myapp.pl t/mojo/loader.t t/mojo/log.t @@ -344,6 +347,7 @@ t/mojolicious/signatures_lite_app.t t/mojolicious/single_file_test_app.conf t/mojolicious/static_lite_app.t +t/mojolicious/static_prefix_lite_app.t t/mojolicious/tag_helper_lite_app.t t/mojolicious/templates/23.html.epl t/mojolicious/templates/dies_too.html.ep diff -Nru libmojolicious-perl-9.33+dfsg/MANIFEST.bak libmojolicious-perl-9.35+dfsg/MANIFEST.bak --- libmojolicious-perl-9.33+dfsg/MANIFEST.bak 1970-01-01 00:00:00.000000000 +0000 +++ libmojolicious-perl-9.35+dfsg/MANIFEST.bak 2023-06-14 19:25:28.000000000 +0000 @@ -0,0 +1,384 @@ +.perltidyrc +Changes +examples/chat.pl +examples/connect-proxy.pl +examples/entities.pl +examples/fast.pl +examples/hello-template.pl +examples/hello.pl +examples/login/lib/LoginApp.pm +examples/login/lib/LoginApp/Controller/Login.pm +examples/login/lib/LoginApp/Model/Users.pm +examples/login/script/login_app +examples/login/t/login.t +examples/login/templates/layouts/default.html.ep +examples/login/templates/login/index.html.ep +examples/login/templates/login/protected.html.ep +examples/microhttpd.pl +examples/proxy.pl +examples/responses.pl +lib/Mojo.pm +lib/Mojo/Asset.pm +lib/Mojo/Asset/File.pm +lib/Mojo/Asset/Memory.pm +lib/Mojo/Base.pm +lib/Mojo/ByteStream.pm +lib/Mojo/Cache.pm +lib/Mojo/Collection.pm +lib/Mojo/Content.pm +lib/Mojo/Content/MultiPart.pm +lib/Mojo/Content/Single.pm +lib/Mojo/Cookie.pm +lib/Mojo/Cookie/Request.pm +lib/Mojo/Cookie/Response.pm +lib/Mojo/Date.pm +lib/Mojo/DOM.pm +lib/Mojo/DOM/CSS.pm +lib/Mojo/DOM/HTML.pm +lib/Mojo/DynamicMethods.pm +lib/Mojo/EventEmitter.pm +lib/Mojo/Exception.pm +lib/Mojo/File.pm +lib/Mojo/Headers.pm +lib/Mojo/HelloWorld.pm +lib/Mojo/Home.pm +lib/Mojo/IOLoop.pm +lib/Mojo/IOLoop/Client.pm +lib/Mojo/IOLoop/resources/server.crt +lib/Mojo/IOLoop/resources/server.key +lib/Mojo/IOLoop/Server.pm +lib/Mojo/IOLoop/Stream.pm +lib/Mojo/IOLoop/Subprocess.pm +lib/Mojo/IOLoop/TLS.pm +lib/Mojo/JSON.pm +lib/Mojo/JSON/Pointer.pm +lib/Mojo/Loader.pm +lib/Mojo/Log.pm +lib/Mojo/Message.pm +lib/Mojo/Message/Request.pm +lib/Mojo/Message/Response.pm +lib/Mojo/Parameters.pm +lib/Mojo/Path.pm +lib/Mojo/Promise.pm +lib/Mojo/Reactor.pm +lib/Mojo/Reactor/EV.pm +lib/Mojo/Reactor/Poll.pm +lib/Mojo/resources/html_entities.txt +lib/Mojo/Server.pm +lib/Mojo/Server/CGI.pm +lib/Mojo/Server/Daemon.pm +lib/Mojo/Server/Hypnotoad.pm +lib/Mojo/Server/Morbo.pm +lib/Mojo/Server/Morbo/Backend.pm +lib/Mojo/Server/Morbo/Backend/Poll.pm +lib/Mojo/Server/Prefork.pm +lib/Mojo/Server/PSGI.pm +lib/Mojo/Template.pm +lib/Mojo/Transaction.pm +lib/Mojo/Transaction/HTTP.pm +lib/Mojo/Transaction/WebSocket.pm +lib/Mojo/Upload.pm +lib/Mojo/URL.pm +lib/Mojo/UserAgent.pm +lib/Mojo/UserAgent/CookieJar.pm +lib/Mojo/UserAgent/Proxy.pm +lib/Mojo/UserAgent/Server.pm +lib/Mojo/UserAgent/Transactor.pm +lib/Mojo/Util.pm +lib/Mojo/WebSocket.pm +lib/Mojolicious.pm +lib/Mojolicious/Command.pm +lib/Mojolicious/Command/Author/cpanify.pm +lib/Mojolicious/Command/Author/generate.pm +lib/Mojolicious/Command/Author/generate/app.pm +lib/Mojolicious/Command/Author/generate/dockerfile.pm +lib/Mojolicious/Command/Author/generate/lite_app.pm +lib/Mojolicious/Command/Author/generate/makefile.pm +lib/Mojolicious/Command/Author/generate/plugin.pm +lib/Mojolicious/Command/Author/inflate.pm +lib/Mojolicious/Command/cgi.pm +lib/Mojolicious/Command/daemon.pm +lib/Mojolicious/Command/eval.pm +lib/Mojolicious/Command/get.pm +lib/Mojolicious/Command/prefork.pm +lib/Mojolicious/Command/psgi.pm +lib/Mojolicious/Command/routes.pm +lib/Mojolicious/Command/version.pm +lib/Mojolicious/Commands.pm +lib/Mojolicious/Controller.pm +lib/Mojolicious/Guides.pod +lib/Mojolicious/Guides/Contributing.pod +lib/Mojolicious/Guides/Cookbook.pod +lib/Mojolicious/Guides/FAQ.pod +lib/Mojolicious/Guides/Growing.pod +lib/Mojolicious/Guides/Rendering.pod +lib/Mojolicious/Guides/Routing.pod +lib/Mojolicious/Guides/Testing.pod +lib/Mojolicious/Guides/Tutorial.pod +lib/Mojolicious/Lite.pm +lib/Mojolicious/Plugin.pm +lib/Mojolicious/Plugin/Config.pm +lib/Mojolicious/Plugin/DefaultHelpers.pm +lib/Mojolicious/Plugin/EPLRenderer.pm +lib/Mojolicious/Plugin/EPRenderer.pm +lib/Mojolicious/Plugin/HeaderCondition.pm +lib/Mojolicious/Plugin/JSONConfig.pm +lib/Mojolicious/Plugin/Mount.pm +lib/Mojolicious/Plugin/NotYAMLConfig.pm +lib/Mojolicious/Plugin/TagHelpers.pm +lib/Mojolicious/Plugins.pm +lib/Mojolicious/Renderer.pm +lib/Mojolicious/resources/public/favicon.ico +lib/Mojolicious/resources/public/mojo/bootstrap/bootstrap.css +lib/Mojolicious/resources/public/mojo/bootstrap/bootstrap.js +lib/Mojolicious/resources/public/mojo/failraptor.png +lib/Mojolicious/resources/public/mojo/highlight.js/highlight-mojo-dark.css +lib/Mojolicious/resources/public/mojo/highlight.js/highlight.min.js +lib/Mojolicious/resources/public/mojo/highlight.js/mojolicious.min.js +lib/Mojolicious/resources/public/mojo/jquery/jquery.js +lib/Mojolicious/resources/public/mojo/logo-white-2x.png +lib/Mojolicious/resources/public/mojo/logo-white.png +lib/Mojolicious/resources/public/mojo/logo.png +lib/Mojolicious/resources/public/mojo/mojo.css +lib/Mojolicious/resources/public/mojo/noraptor.png +lib/Mojolicious/resources/public/mojo/notfound.png +lib/Mojolicious/resources/public/mojo/pinstripe-dark.png +lib/Mojolicious/resources/public/mojo/pinstripe-light.png +lib/Mojolicious/resources/templates/mojo/debug.html.ep +lib/Mojolicious/resources/templates/mojo/exception.html.ep +lib/Mojolicious/resources/templates/mojo/not_found.html.ep +lib/Mojolicious/Routes.pm +lib/Mojolicious/Routes/Match.pm +lib/Mojolicious/Routes/Pattern.pm +lib/Mojolicious/Routes/Route.pm +lib/Mojolicious/Sessions.pm +lib/Mojolicious/Static.pm +lib/Mojolicious/Types.pm +lib/Mojolicious/Validator.pm +lib/Mojolicious/Validator/Validation.pm +lib/ojo.pm +lib/Test/Mojo.pm +LICENSE +Makefile.PL +MANIFEST This list of files +MANIFEST.SKIP +README.md +script/hypnotoad +script/mojo +script/morbo +t/mojo/asset.t +t/mojo/base.t +t/mojo/bytestream.t +t/mojo/cache.t +t/mojo/certs/bad.crt +t/mojo/certs/bad.key +t/mojo/certs/ca.crt +t/mojo/certs/ca.key +t/mojo/certs/client.crt +t/mojo/certs/client.key +t/mojo/certs/domain.crt +t/mojo/certs/domain.key +t/mojo/certs/server.crt +t/mojo/certs/server.key +t/mojo/cgi.t +t/mojo/collection.t +t/mojo/content.t +t/mojo/cookie.t +t/mojo/cookiejar.t +t/mojo/daemon.t +t/mojo/daemon_ipv6_tls.t +t/mojo/date.t +t/mojo/dom.t +t/mojo/dynamic_methods.t +t/mojo/eventemitter.t +t/mojo/exception.t +t/mojo/exception/non_utf8.txt +t/mojo/exception/utf8.txt +t/mojo/file.t +t/mojo/headers.t +t/mojo/home.t +t/mojo/hypnotoad.t +t/mojo/ioloop.t +t/mojo/ioloop_ipv6.t +t/mojo/ioloop_tls.t +t/mojo/json.t +t/mojo/json_pointer.t +t/mojo/json_xs.t +t/mojo/lib/Mojo/.hidden.txt +t/mojo/lib/Mojo/.test/hidden.txt +t/mojo/lib/Mojo/BaseTest/Base1.pm +t/mojo/lib/Mojo/BaseTest/Base2.pm +t/mojo/lib/Mojo/BaseTest/Base3.pm +t/mojo/lib/Mojo/DeprecationTest.pm +t/mojo/lib/Mojo/LoaderException.pm +t/mojo/lib/Mojo/LoaderException2.pm +t/mojo/lib/Mojo/LoaderTest/A.pm +t/mojo/lib/Mojo/LoaderTest/B.pm +t/mojo/lib/Mojo/LoaderTest/C.pm +t/mojo/lib/Mojo/LoaderTest/D.txt +t/mojo/lib/Mojo/LoaderTest/E/F.pm +t/mojo/lib/Mojo/LoaderTest/E/G.txt +t/mojo/lib/Mojo/LoaderTestException/A.pm +t/mojo/lib/Mojo/Server/Morbo/Backend/TestBackend.pm +t/mojo/lib/Mojo/TestConnectProxy.pm +t/mojo/lib/myapp.pl +t/mojo/loader.t +t/mojo/log.t +t/mojo/morbo.t +t/mojo/parameters.t +t/mojo/path.t +t/mojo/prefork.t +t/mojo/promise.t +t/mojo/promise_async_await.t +t/mojo/proxy.t +t/mojo/psgi.t +t/mojo/reactor_detect.t +t/mojo/reactor_ev.t +t/mojo/reactor_poll.t +t/mojo/request.t +t/mojo/request_cgi.t +t/mojo/response.t +t/mojo/roles.t +t/mojo/signatures.t +t/mojo/subprocess.t +t/mojo/subprocess_ev.t +t/mojo/template.t +t/mojo/templates/exception.mt +t/mojo/templates/test.mt +t/mojo/templates/utf8_exception.mt +t/mojo/tls.t +t/mojo/transactor.t +t/mojo/url.t +t/mojo/user_agent.t +t/mojo/user_agent_online.t +t/mojo/user_agent_socks.t +t/mojo/user_agent_tls.t +t/mojo/user_agent_unix.t +t/mojo/util.t +t/mojo/websocket.t +t/mojo/websocket_frames.t +t/mojo/websocket_proxy.t +t/mojo/websocket_proxy_tls.t +t/mojolicious/app.t +t/mojolicious/charset_lite_app.t +t/mojolicious/command.t +t/mojolicious/commands.t +t/mojolicious/dispatch.t +t/mojolicious/dispatcher_lite_app.t +t/mojolicious/embedded_app.t +t/mojolicious/embedded_lite_app.json +t/mojolicious/embedded_lite_app.t +t/mojolicious/exception_lite_app.t +t/mojolicious/external/lib/MyApp.pm +t/mojolicious/external/my_app.conf +t/mojolicious/external/my_app.testing.conf +t/mojolicious/external/myapp.conf +t/mojolicious/external/myapp.pl +t/mojolicious/external/myapp.testing.conf +t/mojolicious/external/myapp2.pl +t/mojolicious/external/public/index.html +t/mojolicious/external/script/my_app +t/mojolicious/external/templates/index.html.ep +t/mojolicious/external_app.t +t/mojolicious/external_lite_app.t +t/mojolicious/group_lite_app.t +t/mojolicious/json_config_lite_app.json +t/mojolicious/json_config_lite_app.t +t/mojolicious/json_config_lite_app_abs.development.json +t/mojolicious/json_config_lite_app_abs.json +t/mojolicious/json_config_mode_lite_app.json +t/mojolicious/json_config_mode_lite_app.t +t/mojolicious/json_config_mode_lite_app.testing.json +t/mojolicious/layouted_lite_app.t +t/mojolicious/lib/AroundPlugin.pm +t/mojolicious/lib/EmbeddedTestApp.pm +t/mojolicious/lib/MojoliciousConfigTest.pm +t/mojolicious/lib/MojoliciousTest.pm +t/mojolicious/lib/MojoliciousTest/Baz.pm +t/mojolicious/lib/MojoliciousTest/Command/_test2_command.pm +t/mojolicious/lib/MojoliciousTest/Command/test_command.pm +t/mojolicious/lib/MojoliciousTest/Controller/Foo/Bar.pm +t/mojolicious/lib/MojoliciousTest/Exceptional.pm +t/mojolicious/lib/MojoliciousTest/Foo.pm +t/mojolicious/lib/MojoliciousTest/Plugin/DeploymentPlugin.pm +t/mojolicious/lib/MojoliciousTest/Plugin/Test/SomePlugin2.pm +t/mojolicious/lib/MojoliciousTest/Plugin/UPPERCASETestPlugin.pm +t/mojolicious/lib/MojoliciousTest/PODTest.pm +t/mojolicious/lib/MojoliciousTest/SideEffects/Test.pm +t/mojolicious/lib/MojoliciousTest/SyntaxError.pm +t/mojolicious/lib/MojoliciousTest2/Foo.pm +t/mojolicious/lib/MojoliciousTest3/Bar.pm +t/mojolicious/lib/MojoliciousTest3/Baz.pm +t/mojolicious/lib/PluginWithEmbeddedApp.pm +t/mojolicious/lib/PluginWithTemplate.pm +t/mojolicious/lib/SingleFileTestApp.pm +t/mojolicious/lite_app.t +t/mojolicious/log_lite_app.t +t/mojolicious/longpolling_lite_app.t +t/mojolicious/mojolicious_config_test.whatever.conf +t/mojolicious/multipath_lite_app.t +t/mojolicious/ojo.t +t/mojolicious/ojo_signatures.t +t/mojolicious/pattern.t +t/mojolicious/production_app.t +t/mojolicious/proxy_app.t +t/mojolicious/public/assets/foo.ab1234cd5678ef.css +t/mojolicious/public/assets/foo.ab1234cd5678ef.js +t/mojolicious/public/assets/foo/bar.321.js +t/mojolicious/public/assets/foo/bar/baz.123.js +t/mojolicious/public/assets/foo/bar/baz.development.js +t/mojolicious/public/assets/foo/bar/test.ab1234cd5678ef.min.js +t/mojolicious/public/assets/foo/bar/yada.css +t/mojolicious/public/hello.txt +t/mojolicious/public/hello2.txt +t/mojolicious/public/hello4.txt +t/mojolicious/public2/hello.txt +t/mojolicious/public2/hello3.txt +t/mojolicious/public_dev/another/file +t/mojolicious/public_dev/hello.txt +t/mojolicious/rebased_lite_app.t +t/mojolicious/renderer.t +t/mojolicious/restful_lite_app.t +t/mojolicious/routes.t +t/mojolicious/secret.txt +t/mojolicious/signatures_lite_app.t +t/mojolicious/single_file_test_app.conf +t/mojolicious/static_lite_app.t +t/mojolicious/tag_helper_lite_app.t +t/mojolicious/templates/23.html.epl +t/mojolicious/templates/dies_too.html.ep +t/mojolicious/templates/encoding.koi8-r.ep +t/mojolicious/templates/exception.html.epl +t/mojolicious/templates/exception.testing.html.ep +t/mojolicious/templates/foo/bar.rss.ep +t/mojolicious/templates/foo/bar/index.html.epl +t/mojolicious/templates/foo/bar/test.html.ep +t/mojolicious/templates/foo/index.html.xpl +t/mojolicious/templates/foo/yada.html.ep +t/mojolicious/templates/layouts/default.html.epl +t/mojolicious/templates/layouts/green.html.epl +t/mojolicious/templates/not_found.testing.html.ep +t/mojolicious/templates/simple.html.pod +t/mojolicious/templates/syntaxerror.html.epl +t/mojolicious/templates/withblock.txt.epl +t/mojolicious/templates/WithGreenLayout.html.epl +t/mojolicious/templates2/42.html+test.ep +t/mojolicious/templates2/42.html.ep +t/mojolicious/templates2/foo/yada.html.epl +t/mojolicious/testing_app.t +t/mojolicious/tls_lite_app.t +t/mojolicious/twinkle_lite_app.conf +t/mojolicious/twinkle_lite_app.t +t/mojolicious/types.t +t/mojolicious/upload_lite_app.t +t/mojolicious/upload_stream_lite_app.t +t/mojolicious/validation_lite_app.t +t/mojolicious/websocket_lite_app.t +t/mojolicious/yaml_config_lite_app.t +t/mojolicious/yaml_config_lite_app.yaml +t/mojolicious/yaml_config_lite_app.yml +t/mojolicious/yaml_config_lite_app_abs.development.yml +t/mojolicious/yaml_config_lite_app_abs.yml +t/pod.t +t/pod_coverage.t +t/test/mojo.t diff -Nru libmojolicious-perl-9.33+dfsg/META.json libmojolicious-perl-9.35+dfsg/META.json --- libmojolicious-perl-9.33+dfsg/META.json 2023-06-14 19:25:30.000000000 +0000 +++ libmojolicious-perl-9.35+dfsg/META.json 2023-10-27 17:11:04.000000000 +0000 @@ -64,6 +64,6 @@ "web" : "https://web.libera.chat/#mojo" } }, - "version" : "9.33", + "version" : "9.35", "x_serialization_backend" : "JSON::PP version 4.07" } diff -Nru libmojolicious-perl-9.33+dfsg/META.yml libmojolicious-perl-9.35+dfsg/META.yml --- libmojolicious-perl-9.33+dfsg/META.yml 2023-06-14 19:25:30.000000000 +0000 +++ libmojolicious-perl-9.35+dfsg/META.yml 2023-10-27 17:11:04.000000000 +0000 @@ -35,5 +35,5 @@ homepage: https://mojolicious.org license: http://www.opensource.org/licenses/artistic-license-2.0 repository: https://github.com/mojolicious/mojo.git -version: '9.33' +version: '9.35' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff -Nru libmojolicious-perl-9.33+dfsg/debian/changelog libmojolicious-perl-9.35+dfsg/debian/changelog --- libmojolicious-perl-9.33+dfsg/debian/changelog 2023-08-11 16:12:06.000000000 +0000 +++ libmojolicious-perl-9.35+dfsg/debian/changelog 2023-10-28 22:48:52.000000000 +0000 @@ -1,3 +1,17 @@ +libmojolicious-perl (9.35+dfsg-1) unstable; urgency=medium + + * Import upstream version 9.35+dfsg. + + -- gregor herrmann Sun, 29 Oct 2023 00:48:52 +0200 + +libmojolicious-perl (9.34+dfsg-1) unstable; urgency=medium + + * Import upstream version 9.34+dfsg. + * Add missing build dependency on dh-strip-nondeterminism for command + dh_strip_nondeterminism. + + -- gregor herrmann Sat, 30 Sep 2023 00:15:30 +0200 + libmojolicious-perl (9.33+dfsg-1) unstable; urgency=medium * Import upstream version 9.33+dfsg. diff -Nru libmojolicious-perl-9.33+dfsg/debian/control libmojolicious-perl-9.35+dfsg/debian/control --- libmojolicious-perl-9.33+dfsg/debian/control 2023-08-11 16:12:06.000000000 +0000 +++ libmojolicious-perl-9.35+dfsg/debian/control 2023-10-28 22:48:52.000000000 +0000 @@ -8,7 +8,8 @@ Section: perl Testsuite: autopkgtest-pkg-perl Priority: optional -Build-Depends: debhelper-compat (= 13) +Build-Depends: debhelper-compat (= 13), + dh-strip-nondeterminism Build-Depends-Indep: libcpan-meta-yaml-perl , libcpanel-json-xs-perl , libfuture-asyncawait-perl (>= 0.52) , diff -Nru libmojolicious-perl-9.33+dfsg/lib/Mojo/Asset/Memory.pm libmojolicious-perl-9.35+dfsg/lib/Mojo/Asset/Memory.pm --- libmojolicious-perl-9.33+dfsg/lib/Mojo/Asset/Memory.pm 2023-03-08 18:43:28.000000000 +0000 +++ libmojolicious-perl-9.35+dfsg/lib/Mojo/Asset/Memory.pm 2023-08-15 12:27:06.000000000 +0000 @@ -43,7 +43,7 @@ return substr shift->{content} // '', $offset, $max; } -sub move_to { path($_[1])->spurt($_[0]{content} // '') and return $_[0] } +sub move_to { path($_[1])->spew($_[0]{content} // '') and return $_[0] } sub size { length(shift->{content} // '') } diff -Nru libmojolicious-perl-9.33+dfsg/lib/Mojo/File.pm libmojolicious-perl-9.35+dfsg/lib/Mojo/File.pm --- libmojolicious-perl-9.33+dfsg/lib/Mojo/File.pm 2023-03-08 18:43:29.000000000 +0000 +++ libmojolicious-perl-9.35+dfsg/lib/Mojo/File.pm 2023-08-15 12:29:47.000000000 +0000 @@ -14,6 +14,7 @@ use File::Temp (); use IO::File (); use Mojo::Collection; +use Mojo::Util qw(decode deprecated encode); our @EXPORT_OK = ('curfile', 'path', 'tempdir', 'tempfile'); @@ -127,23 +128,30 @@ } sub slurp { - my $self = shift; + my ($self, $encoding) = @_; CORE::open my $file, '<', $$self or croak qq{Can't open file "$$self": $!}; my $ret = my $content = ''; while ($ret = $file->sysread(my $buffer, 131072, 0)) { $content .= $buffer } croak qq{Can't read from file "$$self": $!} unless defined $ret; - return $content; + return $encoding ? decode($encoding, $content) : $content; } -sub spurt { - my ($self, $content) = (shift, join '', @_); +sub spew { + my ($self, $content, $encoding) = @_; + $content = encode($encoding, $content) if $encoding; CORE::open my $file, '>', $$self or croak qq{Can't open file "$$self": $!}; ($file->syswrite($content) // -1) == length $content or croak qq{Can't write to file "$$self": $!}; return $self; } +# DEPRECATED! +sub spurt { + deprecated 'Mojo::File::spurt is deprecated in favor of Mojo::File::spew'; + shift->spew(join '', @_); +} + sub stat { File::stat::stat(${shift()}) } sub tap { shift->Mojo::Base::tap(@_) } @@ -192,7 +200,7 @@ # Use the alternative constructor use Mojo::File qw(path); my $path = path('/tmp/foo/bar')->make_path; - $path->child('test.txt')->spurt('Hello Mojo!'); + $path->child('test.txt')->spew('Hello Mojo!'); =head1 DESCRIPTION @@ -471,15 +479,17 @@ =head2 slurp my $bytes = $path->slurp; + my $chars = $path->slurp('UTF-8'); -Read all data at once from the file. +Read all data at once from the file. If an encoding is provided, an attempt will be made to decode the content. -=head2 spurt +=head2 spew - $path = $path->spurt($bytes); - $path = $path->spurt(@chunks_of_bytes); + $path = $path->spew($bytes); + $path = $path->spew($chars, 'UTF-8'); -Write all data at once to the file. +Write all data at once to the file. If an encoding is provided, an attempt to encode the content will be made prior to +writing. =head2 stat diff -Nru libmojolicious-perl-9.33+dfsg/lib/Mojo/Headers.pm libmojolicious-perl-9.35+dfsg/lib/Mojo/Headers.pm --- libmojolicious-perl-9.33+dfsg/lib/Mojo/Headers.pm 2023-03-08 18:43:29.000000000 +0000 +++ libmojolicious-perl-9.35+dfsg/lib/Mojo/Headers.pm 2023-09-20 16:02:47.000000000 +0000 @@ -236,6 +236,126 @@ L inherits all methods from L and implements the following new ones. +=head2 add + + $headers = $headers->add(Foo => 'one value'); + $headers = $headers->add(Foo => 'first value', 'second value'); + +Add header with one or more lines. + + # "Vary: Accept + # Vary: Accept-Encoding" + $headers->add(Vary => 'Accept')->add(Vary => 'Accept-Encoding')->to_string; + +=head2 append + + $headers = $headers->append(Vary => 'Accept-Encoding'); + +Append value to header and flatten it if necessary. + + # "Vary: Accept" + $headers->append(Vary => 'Accept')->to_string; + + # "Vary: Accept, Accept-Encoding" + $headers->vary('Accept')->append(Vary => 'Accept-Encoding')->to_string; + +=head2 clone + + my $clone = $headers->clone; + +Return a new L object cloned from these headers. + +=head2 dehop + + $headers = $headers->dehop; + +Remove hop-by-hop headers that should not be retransmitted. + +=head2 every_header + + my $all = $headers->every_header('Location'); + +Similar to L, but returns all headers sharing the same name as an array reference. + + # Get first header value + say $headers->every_header('Location')->[0]; + +=head2 from_hash + + $headers = $headers->from_hash({'Cookie' => 'a=b'}); + $headers = $headers->from_hash({'Cookie' => ['a=b', 'c=d']}); + $headers = $headers->from_hash({}); + +Parse headers from a hash reference, an empty hash removes all headers. + +=head2 header + + my $value = $headers->header('Foo'); + $headers = $headers->header(Foo => 'one value'); + $headers = $headers->header(Foo => 'first value', 'second value'); + +Get or replace the current header values. + +=head2 is_finished + + my $bool = $headers->is_finished; + +Check if header parser is finished. + +=head2 is_limit_exceeded + + my $bool = $headers->is_limit_exceeded; + +Check if headers have exceeded L or L. + +=head2 leftovers + + my $bytes = $headers->leftovers; + +Get and remove leftover data from header parser. + +=head2 names + + my $names = $headers->names; + +Return an array reference with all currently defined headers. + + # Names of all headers + say for @{$headers->names}; + +=head2 parse + + $headers = $headers->parse("Content-Type: text/plain\x0d\x0a\x0d\x0a"); + +Parse formatted headers. + +=head2 remove + + $headers = $headers->remove('Foo'); + +Remove a header. + +=head2 to_hash + + my $single = $headers->to_hash; + my $multi = $headers->to_hash(1); + +Turn headers into hash reference, array references to represent multiple headers with the same name are disabled by +default. + + say $headers->to_hash->{DNT}; + +=head2 to_string + + my $str = $headers->to_string; + +Turn headers into a string, suitable for HTTP messages. + + +=head1 ADDITIONAL METHODS + +Additionally, the following shortcuts are available, for accessing and manipulating commonly-used headers: + =head2 accept my $accept = $headers->accept; @@ -279,17 +399,6 @@ Get or replace current header value, shortcut for the C header from L. -=head2 add - - $headers = $headers->add(Foo => 'one value'); - $headers = $headers->add(Foo => 'first value', 'second value'); - -Add header with one or more lines. - - # "Vary: Accept - # Vary: Accept-Encoding" - $headers->add(Vary => 'Accept')->add(Vary => 'Accept-Encoding')->to_string; - =head2 allow my $allow = $headers->allow; @@ -297,18 +406,6 @@ Get or replace current header value, shortcut for the C header. -=head2 append - - $headers = $headers->append(Vary => 'Accept-Encoding'); - -Append value to header and flatten it if necessary. - - # "Vary: Accept" - $headers->append(Vary => 'Accept')->to_string; - - # "Vary: Accept, Accept-Encoding" - $headers->vary('Accept')->append(Vary => 'Accept-Encoding')->to_string; - =head2 authorization my $authorization = $headers->authorization; @@ -323,12 +420,6 @@ Get or replace current header value, shortcut for the C header. -=head2 clone - - my $clone = $headers->clone; - -Return a new L object cloned from these headers. - =head2 connection my $connection = $headers->connection; @@ -408,12 +499,6 @@ Get or replace current header value, shortcut for the C header. -=head2 dehop - - $headers = $headers->dehop; - -Remove hop-by-hop headers that should not be retransmitted. - =head2 dnt my $dnt = $headers->dnt; @@ -429,15 +514,6 @@ Get or replace current header value, shortcut for the C header. -=head2 every_header - - my $all = $headers->every_header('Location'); - -Similar to L, but returns all headers sharing the same name as an array reference. - - # Get first header value - say $headers->every_header('Location')->[0]; - =head2 expect my $expect = $headers->expect; @@ -452,22 +528,6 @@ Get or replace current header value, shortcut for the C header. -=head2 from_hash - - $headers = $headers->from_hash({'Cookie' => 'a=b'}); - $headers = $headers->from_hash({'Cookie' => ['a=b', 'c=d']}); - $headers = $headers->from_hash({}); - -Parse headers from a hash reference, an empty hash removes all headers. - -=head2 header - - my $value = $headers->header('Foo'); - $headers = $headers->header(Foo => 'one value'); - $headers = $headers->header(Foo => 'first value', 'second value'); - -Get or replace the current header values. - =head2 host my $host = $headers->host; @@ -489,18 +549,6 @@ Get or replace current header value, shortcut for the C header. -=head2 is_finished - - my $bool = $headers->is_finished; - -Check if header parser is finished. - -=head2 is_limit_exceeded - - my $bool = $headers->is_limit_exceeded; - -Check if headers have exceeded L or L. - =head2 last_modified my $date = $headers->last_modified; @@ -508,12 +556,6 @@ Get or replace current header value, shortcut for the C header. -=head2 leftovers - - my $bytes = $headers->leftovers; - -Get and remove leftover data from header parser. - =head2 link my $link = $headers->link; @@ -540,15 +582,6 @@ Get or replace current header value, shortcut for the C header. -=head2 names - - my $names = $headers->names; - -Return an array reference with all currently defined headers. - - # Names of all headers - say for @{$headers->names}; - =head2 origin my $origin = $headers->origin; @@ -557,12 +590,6 @@ Get or replace current header value, shortcut for the C header from L. -=head2 parse - - $headers = $headers->parse("Content-Type: text/plain\x0d\x0a\x0d\x0a"); - -Parse formatted headers. - =head2 proxy_authenticate my $authenticate = $headers->proxy_authenticate; @@ -599,12 +626,6 @@ Get or replace current header value, shortcut for the C header, there was a typo in L which resulted in C becoming an official header. -=head2 remove - - $headers = $headers->remove('Foo'); - -Remove a header. - =head2 sec_websocket_accept my $accept = $headers->sec_websocket_accept; @@ -691,22 +712,6 @@ Get or replace current header value, shortcut for the C header. -=head2 to_hash - - my $single = $headers->to_hash; - my $multi = $headers->to_hash(1); - -Turn headers into hash reference, array references to represent multiple headers with the same name are disabled by -default. - - say $headers->to_hash->{DNT}; - -=head2 to_string - - my $str = $headers->to_string; - -Turn headers into a string, suitable for HTTP messages. - =head2 trailer my $trailer = $headers->trailer; diff -Nru libmojolicious-perl-9.33+dfsg/lib/Mojo/Promise.pm libmojolicious-perl-9.35+dfsg/lib/Mojo/Promise.pm --- libmojolicious-perl-9.33+dfsg/lib/Mojo/Promise.pm 2023-03-08 18:49:14.000000000 +0000 +++ libmojolicious-perl-9.35+dfsg/lib/Mojo/Promise.pm 2023-07-06 17:03:59.000000000 +0000 @@ -72,7 +72,8 @@ my @wait = map { $start[0]->clone } 0 .. $#items; my $start_next = sub { - return () unless my $item = shift @items; + return () unless @items; + my $item = shift @items; my ($start_next, $chain) = (__SUB__, shift @wait); $_->$cb->then(sub { $chain->resolve(@_); $start_next->() }, sub { $chain->reject(@_); @items = () }) for $item; return (); diff -Nru libmojolicious-perl-9.33+dfsg/lib/Mojo/Server/Prefork.pm libmojolicious-perl-9.35+dfsg/lib/Mojo/Server/Prefork.pm --- libmojolicious-perl-9.33+dfsg/lib/Mojo/Server/Prefork.pm 2023-06-14 17:38:31.000000000 +0000 +++ libmojolicious-perl-9.35+dfsg/lib/Mojo/Server/Prefork.pm 2023-08-15 12:27:14.000000000 +0000 @@ -39,7 +39,7 @@ return if -e (my $file = path($self->pid_file)); # Create PID file - if (my $err = eval { $file->spurt("$pid\n")->chmod(0644) } ? undef : $@) { + if (my $err = eval { $file->spew("$pid\n")->chmod(0644) } ? undef : $@) { $self->app->log->error(qq{Can't create process id file "$file": $err}) and die qq{Can't create process id file "$file": $err}; } diff -Nru libmojolicious-perl-9.33+dfsg/lib/Mojo/Server.pm libmojolicious-perl-9.35+dfsg/lib/Mojo/Server.pm --- libmojolicious-perl-9.33+dfsg/lib/Mojo/Server.pm 2023-03-08 18:43:29.000000000 +0000 +++ libmojolicious-perl-9.35+dfsg/lib/Mojo/Server.pm 2023-09-20 16:02:47.000000000 +0000 @@ -54,8 +54,10 @@ local @ARGS_OVERRIDE = @args; # Try to load application from script into sandbox - delete $INC{$path}; - my $app = eval "package Mojo::Server::Sandbox::@{[md5_sum $path]}; require \$path"; + my $app = eval sprintf <<'END_CODE', md5_sum($path); + package Mojo::Server::Sandbox::%s; + do $path or die $@ || $! || "$path did not return a true value"; +END_CODE die qq{Can't load application from file "$path": $@} if $@; die qq{File "$path" did not return an application object.\n} unless blessed $app && $app->can('handler'); $self->app($app); diff -Nru libmojolicious-perl-9.33+dfsg/lib/Mojo/UserAgent/CookieJar.pm libmojolicious-perl-9.35+dfsg/lib/Mojo/UserAgent/CookieJar.pm --- libmojolicious-perl-9.33+dfsg/lib/Mojo/UserAgent/CookieJar.pm 2023-03-08 18:43:30.000000000 +0000 +++ libmojolicious-perl-9.35+dfsg/lib/Mojo/UserAgent/CookieJar.pm 2023-10-27 17:08:16.000000000 +0000 @@ -2,12 +2,15 @@ use Mojo::Base -base; use Mojo::Cookie::Request; +use Mojo::File qw(path); use Mojo::Path; use Scalar::Util qw(looks_like_number); -has 'ignore'; +has [qw(file ignore)]; has max_cookie_size => 4096; +my $COMMENT = "# Netscape HTTP Cookie File\n# This file was generated by Mojolicious! Edit at your own risk.\n\n"; + sub add { my ($self, @cookies) = @_; @@ -58,7 +61,11 @@ } } -sub empty { delete shift->{jar} } +sub empty { + my $self = shift; + delete $self->{jar}; + return $self; +} sub find { my ($self, $url) = @_; @@ -93,6 +100,36 @@ return \@found; } +sub load { + my $self = shift; + + my $file = $self->file; + return $self unless $file && -r $file; + + for my $line (split "\n", path($file)->slurp) { + + # Prefix used by curl for HttpOnly cookies + my $httponly = $line =~ s/^#HttpOnly_// ? 1 : 0; + next if $line =~ /^#/; + + my @values = split "\t", $line; + next if @values != 7; + + $self->add(Mojo::Cookie::Response->new({ + domain => $values[0] =~ s/^\.//r, + host_only => $values[1] eq 'FALSE' ? 1 : 0, + path => $values[2], + secure => $values[3] eq 'FALSE' ? 0 : 1, + expires => $values[4] eq '0' ? undef : $values[4], + name => $values[5], + value => $values[6], + httponly => $httponly + })); + } + + return $self; +} + sub prepare { my ($self, $tx) = @_; return unless keys %{$self->{jar}}; @@ -100,6 +137,34 @@ $req->cookies(@{$self->find($req->url)}); } +sub save { + my $self = shift; + return $self unless my $file = $self->file; + + my $final = path($file); + my $tmp = path("$file.$$"); + $tmp->spew($COMMENT . $self->to_string)->move_to($final); + + return $self; +} + +sub to_string { + my $self = shift; + + my @lines; + for my $cookie (@{$self->all}) { + my $line = [ + $cookie->domain, $cookie->host_only ? 'FALSE' : 'TRUE', + $cookie->path, $cookie->secure ? 'TRUE' : 'FALSE', + $cookie->expires // 0, $cookie->name, + $cookie->value + ]; + push @lines, join "\t", @$line; + } + + return join "\n", @lines, ''; +} + sub _compare { my ($cookie, $path, $name, $domain) = @_; return $cookie->path ne $path || $cookie->name ne $name || $cookie->domain ne $domain; @@ -145,6 +210,20 @@ L implements the following attributes. +=head2 file + + my $file = $jar->file; + $jar = $jar->file('/home/sri/cookies.txt'); + +File to L cookies from and L cookies to in Netscape format. Note that this attribute is +B and might change without warning! + + # Save cookies to file + $jar->file('cookies.txt')->save; + + # Empty cookie jar and load cookies from file + $jar->file('cookies.txt')->empty->load; + =head2 ignore my $ignore = $jar->ignore; @@ -195,7 +274,7 @@ =head2 empty - $jar->empty; + $jar = $jar->empty; Empty the jar. @@ -208,12 +287,30 @@ # Names of all cookies found say $_->name for @{$jar->find(Mojo::URL->new('http://example.com/foo'))}; +=head2 load + + $jar = $jar->load; + +Load cookies from L. Note that this method is B and might change without warning! + =head2 prepare $jar->prepare(Mojo::Transaction::HTTP->new); Prepare request cookies for transaction. +=head2 save + + $jar = $jar->save; + +Save cookies to L. Note that this method is B and might change without warning! + +=head2 to_string + + my $string = $jar->to_string; + +Stringify cookies in Netscape format. Note that this method is B and might change without warning! + =head1 SEE ALSO L, L, L. diff -Nru libmojolicious-perl-9.33+dfsg/lib/Mojolicious/Command.pm libmojolicious-perl-9.35+dfsg/lib/Mojolicious/Command.pm --- libmojolicious-perl-9.33+dfsg/lib/Mojolicious/Command.pm 2023-03-08 18:43:30.000000000 +0000 +++ libmojolicious-perl-9.35+dfsg/lib/Mojolicious/Command.pm 2023-08-15 12:27:23.000000000 +0000 @@ -59,7 +59,7 @@ my ($self, $path, $data) = @_; return $self->_loud(" [exist] $path") if -f $path; $self->create_dir(path($path)->dirname); - path($path)->spurt($data); + path($path)->spew($data); return $self->_loud(" [write] $path"); } diff -Nru libmojolicious-perl-9.33+dfsg/lib/Mojolicious/Controller.pm libmojolicious-perl-9.35+dfsg/lib/Mojolicious/Controller.pm --- libmojolicious-perl-9.33+dfsg/lib/Mojolicious/Controller.pm 2023-03-08 18:43:30.000000000 +0000 +++ libmojolicious-perl-9.35+dfsg/lib/Mojolicious/Controller.pm 2023-10-06 00:17:40.000000000 +0000 @@ -11,6 +11,8 @@ use Mojolicious::Routes::Match; use Scalar::Util (); +my $ABSOLUTE = qr!^(?:[^:/?#]+:|//|#)!; + has [qw(app tx)] => undef, weak => 1; has match => sub { Mojolicious::Routes::Match->new(root => shift->app->routes) }; @@ -239,7 +241,7 @@ # Absolute URL return $target if Scalar::Util::blessed $target && $target->isa('Mojo::URL'); - return Mojo::URL->new($target) if $target =~ m!^(?:[^:/?#]+:|//|#)!; + return Mojo::URL->new($target) if $target =~ $ABSOLUTE; # Base my $url = Mojo::URL->new; @@ -274,7 +276,12 @@ sub url_for_asset { my ($self, $asset) = @_; - return $self->url_for($self->app->static->asset_path($asset)); + return $self->url_for($asset =~ $ABSOLUTE ? $asset : $self->app->static->asset_path($asset)); +} + +sub url_for_file { + my ($self, $file) = @_; + return $self->url_for($file =~ $ABSOLUTE ? $file : $self->app->static->file_path($file)); } sub write { @@ -780,6 +787,12 @@ Generate a portable L object with base for a static asset. +=head2 url_for_file + + my $url = $c->url_for_file('/index.html'); + +Generate a portable L object with base for a static file. + =head2 write $c = $c->write; diff -Nru libmojolicious-perl-9.33+dfsg/lib/Mojolicious/Guides/Rendering.pod libmojolicious-perl-9.35+dfsg/lib/Mojolicious/Guides/Rendering.pod --- libmojolicious-perl-9.33+dfsg/lib/Mojolicious/Guides/Rendering.pod 2022-09-11 00:39:58.000000000 +0000 +++ libmojolicious-perl-9.35+dfsg/lib/Mojolicious/Guides/Rendering.pod 2023-08-15 18:05:19.000000000 +0000 @@ -356,6 +356,15 @@ app->start; +By default static files do not use a prefix and are simply served with a higher precedence than routes. This can be +changed with L. + + # Serve static files only with a "/static" prefix + $app->static->prefix('/static'); + +To allow for the prefix to be configured dynamically, you can use L to generate +URLs with it. Many tag helpers will also use the prefix automatically when it makes sense. + =head2 Static assets While Mojolicious does not have any special support for frontend frameworks like L and diff -Nru libmojolicious-perl-9.33+dfsg/lib/Mojolicious/Plugin/DefaultHelpers.pm libmojolicious-perl-9.35+dfsg/lib/Mojolicious/Plugin/DefaultHelpers.pm --- libmojolicious-perl-9.33+dfsg/lib/Mojolicious/Plugin/DefaultHelpers.pm 2023-05-08 22:06:24.000000000 +0000 +++ libmojolicious-perl-9.35+dfsg/lib/Mojolicious/Plugin/DefaultHelpers.pm 2023-08-15 14:57:23.000000000 +0000 @@ -16,7 +16,7 @@ my ($self, $app) = @_; # Controller alias helpers - for my $name (qw(app param stash session url_for)) { + for my $name (qw(app param stash session url_for url_for_asset url_for_file)) { $app->helper($name => sub { shift->$name(@_) }); } @@ -859,6 +859,18 @@ %= url_for('/index.html')->query(foo => 'bar') +=head2 url_for_asset + + %= url_for_asset('/app.js'); + +Alias for L. + +=head2 url_for_file + + %= url_for_file('/index.html'); + +Alias for L. + =head2 url_with %= url_with 'named', foo => 'bar', baz => 'yada' diff -Nru libmojolicious-perl-9.33+dfsg/lib/Mojolicious/Plugin/TagHelpers.pm libmojolicious-perl-9.35+dfsg/lib/Mojolicious/Plugin/TagHelpers.pm --- libmojolicious-perl-9.33+dfsg/lib/Mojolicious/Plugin/TagHelpers.pm 2023-03-08 18:43:31.000000000 +0000 +++ libmojolicious-perl-9.35+dfsg/lib/Mojolicious/Plugin/TagHelpers.pm 2023-08-15 15:43:41.000000000 +0000 @@ -24,8 +24,9 @@ $app->helper(button_to => sub { _button_to(0, @_) }); $app->helper(check_box => sub { _input(@_, type => 'checkbox') }); $app->helper(csrf_button_to => sub { _button_to(1, @_) }); + $app->helper(favicon => sub { _favicon(@_) }); $app->helper(file_field => sub { _empty_field('file', @_) }); - $app->helper(image => sub { _tag('img', src => shift->url_for(shift), @_) }); + $app->helper(image => sub { _tag('img', src => _file_url(shift, shift), @_) }); $app->helper(input_tag => sub { _input(@_) }); $app->helper(password_field => sub { _empty_field('password', @_) }); $app->helper(radio_button => sub { _input(@_, type => 'radio') }); @@ -60,6 +61,16 @@ return _validation($c, $name, 'input', name => $name, @_, type => $type); } +sub _favicon { + my ($c, $file) = @_; + return _tag('link', rel => 'icon', href => _file_url($c, $file // 'favicon.ico')); +} + +sub _file_url { + my ($c, $url) = @_; + return blessed $url && $url->isa('Mojo::URL') ? $url : $c->url_for_file($url); +} + sub _form_for { my ($c, @url) = (shift, shift); push @url, shift if ref $_[0] eq 'HASH'; @@ -103,7 +114,7 @@ sub _javascript { my $c = shift; my $content = ref $_[-1] eq 'CODE' ? "//() . "\n//]]>" : ''; - my @src = @_ % 2 ? (src => $c->url_for(shift)) : (); + my @src = @_ % 2 ? (src => _file_url($c, shift)) : (); return _tag('script', @src, @_, sub {$content}); } @@ -166,7 +177,7 @@ my $c = shift; my $content = ref $_[-1] eq 'CODE' ? "/*() . "\n/*]]>*/" : ''; return _tag('style', @_, sub {$content}) unless @_ % 2; - return _tag('link', rel => 'stylesheet', href => $c->url_for(shift), @_); + return _tag('link', rel => 'stylesheet', href => _file_url($c, shift), @_); } sub _submit_button { @@ -352,6 +363,16 @@ +=head2 favicon + + %= favicon + %= favicon '/favicon.ico'; + +Generate C tag for favicon, defaulting to the one that comes bundled with Mojolicious. + + + + =head2 file_field %= file_field 'avatar' diff -Nru libmojolicious-perl-9.33+dfsg/lib/Mojolicious/Static.pm libmojolicious-perl-9.35+dfsg/lib/Mojolicious/Static.pm --- libmojolicious-perl-9.33+dfsg/lib/Mojolicious/Static.pm 2023-03-08 18:43:31.000000000 +0000 +++ libmojolicious-perl-9.35+dfsg/lib/Mojolicious/Static.pm 2023-09-20 16:05:06.000000000 +0000 @@ -16,12 +16,13 @@ has classes => sub { ['main'] }; has extra => sub { +{%EXTRA} }; has paths => sub { [] }; +has 'prefix'; sub asset_path { my ($self, $asset) = @_; $asset = "/$asset" unless $asset =~ /^\//; my $assets = $self->{assets} //= {}; - return '/' . $self->asset_dir . ($assets->{$asset} // $asset); + return $self->file_path('/' . $self->asset_dir . ($assets->{$asset} // $asset)); } sub dispatch { @@ -70,6 +71,13 @@ return exists $extra->{$rel} ? _get_file($extra->{$rel}) : undef; } +sub file_path { + my ($self, $file) = @_; + $file = "/$file" unless $file =~ /^\//; + return $file unless my $prefix = $self->prefix; + return "$prefix$file"; +} + sub is_fresh { my ($self, $c, $options) = @_; @@ -94,6 +102,13 @@ sub serve { my ($self, $c, $rel) = @_; + + # Prefix + if (my $prefix = $self->prefix) { + $rel = "/$rel"; + return undef unless $rel =~ s/^\Q$prefix\E\///; + } + return undef unless my $asset = $self->file($rel); $c->app->types->content_type($c, {file => $rel}); return !!$self->serve_asset($c, $asset); @@ -248,6 +263,14 @@ # Add another "public" directory with higher precedence unshift @{$static->paths}, '/home/sri/themes/blue/public'; +=head2 prefix + + my $prefix = $static->prefix; + $static = $static->prefix('/static'); + +Prefix to use for all static files, defaults to C. This can be very useful for production deployments where the +reverse proxy server should take over serving static files. + =head1 METHODS L inherits all methods from L and implements the following new ones. @@ -275,6 +298,12 @@ my $content = $static->file('foo/bar.html')->slurp; +=head2 file_path + + my $path = $static->file_path('/index.html'); + +Get static file path with L if it has been configured. + =head2 is_fresh my $bool = $static->is_fresh(Mojolicious::Controller->new, {etag => 'abc'}); diff -Nru libmojolicious-perl-9.33+dfsg/lib/Mojolicious/resources/templates/mojo/debug.html.ep libmojolicious-perl-9.35+dfsg/lib/Mojolicious/resources/templates/mojo/debug.html.ep --- libmojolicious-perl-9.33+dfsg/lib/Mojolicious/resources/templates/mojo/debug.html.ep 2023-04-27 22:37:27.000000000 +0000 +++ libmojolicious-perl-9.35+dfsg/lib/Mojolicious/resources/templates/mojo/debug.html.ep 2023-08-15 15:08:54.000000000 +0000 @@ -7,13 +7,13 @@ <%= $title %> (<%= app->mode %> mode) + %= favicon %= javascript '/mojo/jquery/jquery.js' %= javascript '/mojo/highlight.js/highlight.min.js' %= javascript '/mojo/highlight.js/mojolicious.min.js' %= javascript '/mojo/bootstrap/bootstrap.js' %= stylesheet '/mojo/bootstrap/bootstrap.css' %= stylesheet '/mojo/highlight.js/highlight-mojo-dark.css' - %= stylesheet 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css' %= stylesheet '/mojo/mojo.css' +