Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package MirrorCache for openSUSE:Factory 
checked in at 2023-09-07 21:13:40
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/MirrorCache (Old)
 and      /work/SRC/openSUSE:Factory/.MirrorCache.new.1766 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "MirrorCache"

Thu Sep  7 21:13:40 2023 rev:31 rq:1109455 version:1.063

Changes:
--------
--- /work/SRC/openSUSE:Factory/MirrorCache/MirrorCache.changes  2023-08-10 
15:35:00.488578270 +0200
+++ /work/SRC/openSUSE:Factory/.MirrorCache.new.1766/MirrorCache.changes        
2023-09-07 21:15:14.382664677 +0200
@@ -1,0 +2,6 @@
+Thu Aug 31 07:36:54 UTC 2023 - Andrii Nikitin <andrii.niki...@suse.com>
+
+- Update to version 1.063:
+  * Add cache-control options (#404)
+
+-------------------------------------------------------------------

Old:
----
  MirrorCache-1.062.obscpio

New:
----
  MirrorCache-1.063.obscpio

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ MirrorCache.spec ++++++
--- /var/tmp/diff_new_pack.AUCRv9/_old  2023-09-07 21:15:15.834716585 +0200
+++ /var/tmp/diff_new_pack.AUCRv9/_new  2023-09-07 21:15:15.838716728 +0200
@@ -22,7 +22,7 @@
 %define main_requires %{assetpack_requires} perl(Carp) perl(DBD::Pg) >= 3.7.4 
perl(DBI) >= 1.632 perl(DBIx::Class) >= 0.082801 
perl(DBIx::Class::DynamicDefault) perl(DateTime) perl(Encode) perl(Time::Piece) 
perl(Time::Seconds) perl(Time::ParseDate) perl(DateTime::Format::Pg) 
perl(Exporter) perl(File::Basename) perl(LWP::UserAgent) perl(Mojo::Base) 
perl(Mojo::ByteStream) perl(Mojo::IOLoop) perl(Mojo::JSON) perl(Mojo::Pg) 
perl(Mojo::URL) perl(Mojo::Util) perl(Mojolicious::Commands) 
perl(Mojolicious::Plugin) perl(Mojolicious::Plugin::RenderFile) 
perl(Mojolicious::Static) perl(Net::OpenID::Consumer) perl(POSIX) 
perl(Sort::Versions) perl(URI::Escape) perl(XML::Writer) perl(base) 
perl(constant) perl(diagnostics) perl(strict) perl(warnings) shadow 
rubygem(sass) perl(Net::DNS) perl(LWP::Protocol::https) perl(Digest::SHA) 
perl(Config::IniFiles)
 %define build_requires %{assetpack_requires} rubygem(sass) tidy sysuser-shadow 
sysuser-tools
 Name:           MirrorCache
-Version:        1.062
+Version:        1.063
 Release:        0
 Summary:        WebApp to redirect and manage mirrors
 License:        GPL-2.0-or-later

++++++ MirrorCache-1.062.obscpio -> MirrorCache-1.063.obscpio ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MirrorCache-1.062/lib/MirrorCache/Datamodule.pm 
new/MirrorCache-1.063/lib/MirrorCache/Datamodule.pm
--- old/MirrorCache-1.062/lib/MirrorCache/Datamodule.pm 2023-08-03 
10:35:43.000000000 +0200
+++ new/MirrorCache-1.063/lib/MirrorCache/Datamodule.pm 2023-08-31 
08:51:18.000000000 +0200
@@ -578,9 +578,15 @@
     $self->_pedantic($pedantic) if defined $pedantic;
 
     $self->agent; # parse headers
-    $self->must_render_from_root(1)
-        if ( $self->accept_all || !$self->extra )
-        && $path =~ 
m/.*\/(repodata\/repomd.xml[^\/]*|media\.1\/(media|products)|content|.*\.sha256(\.asc)|Release(.key|.gpg)?|InRelease|Packages(.gz)?|Sources(.gz)?|.*_Arch\.(files|db|key)(\.(sig|tar\.gz(\.sig)?))?|(files|primary|other).xml.gz|[Pp]ackages(\.[A-Z][A-Z])?\.(xz|gz)|gpg-pubkey.*\.asc|CHECKSUMS)$/;
+    if (
+        ( $self->accept_all || !$self->extra )
+        && $path =~ 
m/.*\/(repodata\/repomd.xml[^\/]*|media\.1\/(media|products)|content|.*\.sha256(\.asc)|Release(.key|.gpg)?|InRelease|Packages(.gz)?|Sources(.gz)?|.*_Arch\.(files|db|key)(\.(sig|tar\.gz(\.sig)?))?|(files|primary|other).xml.gz|[Pp]ackages(\.[A-Z][A-Z])?\.(xz|gz)|gpg-pubkey.*\.asc|CHECKSUMS(.asc)?)$/
 
+    ) {
+        $self->must_render_from_root(1);
+        my $time = ~time() & 0xff;
+
+        $self->c->res->headers->cache_control("public, max-age=$time, 
must-revalidate");
+    }
 
     my ($ext) = $path =~ /([^.]+)$/;
     my $mime = '';
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/MirrorCache-1.062/lib/MirrorCache/WebAPI/Plugin/Dir.pm 
new/MirrorCache-1.063/lib/MirrorCache/WebAPI/Plugin/Dir.pm
--- old/MirrorCache-1.062/lib/MirrorCache/WebAPI/Plugin/Dir.pm  2023-08-03 
10:35:43.000000000 +0200
+++ new/MirrorCache-1.063/lib/MirrorCache/WebAPI/Plugin/Dir.pm  2023-08-31 
08:51:18.000000000 +0200
@@ -81,6 +81,7 @@
       $success =
          _render_hashes($dm)
       || _render_small($dm)
+      || _set_cache_control($dm)
       || _redirect_project_ln_geo($dm)
       || _redirect_normalized($dm)
       || _render_stats($dm)
@@ -670,6 +671,12 @@
     return 1;
 }
 
+# if we don't render file directly - we set max-age to short value, because 
redirect or metalink may change
+sub _set_cache_control {
+    shift->c->res->headers->cache_control('public, max-age=300, 
must-revalidate');
+    return undef;
+}
+
 sub _render_hashes {
     my $dm = shift;
     my $c = $dm->c;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MirrorCache-1.062/t/environ/02-files.sh 
new/MirrorCache-1.063/t/environ/02-files.sh
--- old/MirrorCache-1.062/t/environ/02-files.sh 2023-08-03 10:35:43.000000000 
+0200
+++ new/MirrorCache-1.063/t/environ/02-files.sh 2023-08-31 08:51:18.000000000 
+0200
@@ -194,3 +194,11 @@
 # test case insensitive:
 $mc/curl -I /download/folder1/file1.1.dat | grep '302 Found'
 $mc/curl -I /download/Folder1/file1.1.DAT | grep '200 OK'
+
+echo check cache control
+$mc/curl -I -H "Accept: */*, application/metalink+xml" 
/download/Folder1/repodata/repomd.xml | grep Cache-Control
+$mc/curl -I /download/folder1/file1.1.dat | grep Cache-Control
+$mc/curl -I /download/Folder1/file1.1.DAT | grep Cache-Control
+
+
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/MirrorCache-1.062/t/environ/03-headquarter-subsidiaries.sh 
new/MirrorCache-1.063/t/environ/03-headquarter-subsidiaries.sh
--- old/MirrorCache-1.062/t/environ/03-headquarter-subsidiaries.sh      
2023-08-03 10:35:43.000000000 +0200
+++ new/MirrorCache-1.063/t/environ/03-headquarter-subsidiaries.sh      
2023-08-31 08:51:18.000000000 +0200
@@ -84,11 +84,20 @@
 echo check huge files are redirected to FAKEURL
 curl --interface $hq_interface -Is 
http://$hq_address/download/folder1/filehuge1.1.dat | grep "Location: 
http://$FAKEURL/folder1/filehuge1.1.dat";
 
+echo test cache-control
+curl --interface $na_interface -Is 
http://$hq_address/download/folder1/filebig1.1.dat | grep -i 'cache-control'
+curl --interface $na_interface -Is 
http://$hq_address/download/folder1/filehuge1.1.dat | grep -i 'cache-control'
+rc=0
+curl --interface $na_interface -Is 
http://$hq_address/download/folder1/filesmall1.1.dat | grep -i 'cache-control' 
|| rc=$?
+test $rc -gt 0
+
+echo check content-type
 ct=$($mc9/curl -I /download/folder1/file.json | grep Content-Type)
 [[ "$ct" =~ application/json ]]
 ct=$($mc9/curl -I /folder1/file.json | grep Content-Type)
 [[ "$ct" =~ application/json ]]
 
+echo check file listiing
 $mc9/curl /download/folder1/ | grep file.json
 $mc9/curl /folder1/ | grep file.json
 

++++++ MirrorCache.obsinfo ++++++
--- /var/tmp/diff_new_pack.AUCRv9/_old  2023-09-07 21:15:16.166728454 +0200
+++ /var/tmp/diff_new_pack.AUCRv9/_new  2023-09-07 21:15:16.170728597 +0200
@@ -1,5 +1,5 @@
 name: MirrorCache
-version: 1.062
-mtime: 1691051743
-commit: 4f34752b944d19295a710909c801dbcbbb2f818f
+version: 1.063
+mtime: 1693464678
+commit: 81990fc9da0374b3be6fba8e816056d88e96bfe2
 

Reply via email to