about summary refs log tree commit homepage
path: root/lib/PublicInbox/Fetch.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-09-12 11:58:15 +0000
committerEric Wong <e@80x24.org>2021-09-12 12:01:24 +0000
commitdc489bfd4b4c659b7ebb166ab540b4e767e51aaa (patch)
tree3cc77bc3da1bb325674571e475e65bedfc7cd86a /lib/PublicInbox/Fetch.pm
parent3937f58b74e4b764e76ade523fec8497aa1b0611 (diff)
downloadpublic-inbox-dc489bfd4b4c659b7ebb166ab540b4e767e51aaa.tar.gz
Timestamp comparisons only have 1 second granularity, which
isn't nearly enough for our test cases, and probably not for
real world use for "git send-email" bursts and fast SMTP
servers.

We'll continue to check modification times inside the manifest,
though, in case an extremely rare SHA-1 collision is found...
Diffstat (limited to 'lib/PublicInbox/Fetch.pm')
-rw-r--r--lib/PublicInbox/Fetch.pm7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/PublicInbox/Fetch.pm b/lib/PublicInbox/Fetch.pm
index 4d501108..6a6daee6 100644
--- a/lib/PublicInbox/Fetch.pm
+++ b/lib/PublicInbox/Fetch.pm
@@ -53,7 +53,6 @@ sub do_manifest ($$$) {
                         PublicInbox::LeiMirror::decode_manifest($fh, $mf, $mf)
                 };
                 $lei->err($@) if $@;
-                push @opt, '-z', $mf if defined($m0);
         }
         my $curl_cmd = $lei->{curl}->for_uri($lei, $muri, @opt);
         my $opt = {};
@@ -64,11 +63,11 @@ sub do_manifest ($$$) {
                 $lei->child_error($cerr, "@$curl_cmd failed");
                 return;
         }
-        return [ 304 ] if !-s $ft; # 304 Not Modified via curl -z
         my $m1 = PublicInbox::LeiMirror::decode_manifest($ft, $fn, $muri);
         my $mdiff = { %$m1 };
 
-        # filter out unchanged entries
+        # filter out unchanged entries.  We check modified, too, since
+        # fingerprints are SHA-1, so there's a teeny chance they'll collide
         while (my ($k, $v0) = each %{$m0 // {}}) {
                 my $cur = $m1->{$k} // next;
                 my $f0 = $v0->{fingerprint} // next;
@@ -77,6 +76,7 @@ sub do_manifest ($$$) {
                 my $t1 = $cur->{modified} // next;
                 delete($mdiff->{$k}) if $f0 eq $f1 && $t0 == $t1;
         }
+        return unless keys %$mdiff;
         my (undef, $v1_path, @v2_epochs) =
                 PublicInbox::LeiMirror::deduce_epochs($mdiff, $ibx_uri->path);
         [ 200, $v1_path, \@v2_epochs, $muri, $ft, $mf ];
@@ -118,7 +118,6 @@ EOM
         $lei->qerr("# inbox URL: $ibx_uri/");
         my $res = do_manifest($lei, $dir, $ibx_uri) or return;
         my ($code, $v1_path, $v2_epochs, $muri, $ft, $mf) = @$res;
-        return if $code == 304;
         if ($code == 404) {
                 # any pre-manifest.js.gz instances running? Just fetch all
                 # existing ones and unconditionally try cloning the next