]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t9501-gitweb-standalone-http-status.sh
gitweb: add If-Modified-Since handling to git_snapshot().
[thirdparty/git.git] / t / t9501-gitweb-standalone-http-status.sh
index 358010315f24d0d3da053a065210a0f30dc81f9d..fa2f65f6be44fb7d6c4c22b9642b33cd90d51646 100755 (executable)
@@ -138,6 +138,39 @@ test_expect_success 'modification: feed if-modified-since (unmodified)' '
 '
 test_debug 'cat gitweb.headers'
 
+test_expect_success 'modification: snapshot last-modified' '
+       gitweb_run "p=.git;a=snapshot;h=master;sf=tgz" &&
+       grep "Status: 200 OK" gitweb.headers &&
+       grep "Last-modified: Thu, 7 Apr 2005 22:14:13 +0000" gitweb.headers
+'
+test_debug 'cat gitweb.headers'
+
+test_expect_success 'modification: snapshot if-modified-since (modified)' '
+       export HTTP_IF_MODIFIED_SINCE="Wed, 6 Apr 2005 22:14:13 +0000" &&
+       test_when_finished "unset HTTP_IF_MODIFIED_SINCE" &&
+       gitweb_run "p=.git;a=snapshot;h=master;sf=tgz" &&
+       grep "Status: 200 OK" gitweb.headers
+'
+test_debug 'cat gitweb.headers'
+
+test_expect_success 'modification: snapshot if-modified-since (unmodified)' '
+       export HTTP_IF_MODIFIED_SINCE="Thu, 7 Apr 2005 22:14:13 +0000" &&
+       test_when_finished "unset HTTP_IF_MODIFIED_SINCE" &&
+       gitweb_run "p=.git;a=snapshot;h=master;sf=tgz" &&
+       grep "Status: 304 Not Modified" gitweb.headers
+'
+test_debug 'cat gitweb.headers'
+
+test_expect_success 'modification: tree snapshot' '
+       ID=`git rev-parse --verify HEAD^{tree}` &&
+       export HTTP_IF_MODIFIED_SINCE="Wed, 6 Apr 2005 22:14:13 +0000" &&
+       test_when_finished "unset HTTP_IF_MODIFIED_SINCE" &&
+       gitweb_run "p=.git;a=snapshot;h=$ID;sf=tgz" &&
+       grep "Status: 200 OK" gitweb.headers &&
+       ! grep -i "last-modified" gitweb.headers
+'
+test_debug 'cat gitweb.headers'
+
 # ----------------------------------------------------------------------
 # load checking