You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by co...@apache.org on 2020/08/28 00:29:51 UTC

svn commit: r1881264 - in /httpd/test/framework/trunk/t: conf/extra.conf.in modules/rewrite.t

Author: covener
Date: Fri Aug 28 00:29:50 2020
New Revision: 1881264

URL: http://svn.apache.org/viewvc?rev=1881264&view=rev
Log:
samesite tests


Modified:
    httpd/test/framework/trunk/t/conf/extra.conf.in
    httpd/test/framework/trunk/t/modules/rewrite.t

Modified: httpd/test/framework/trunk/t/conf/extra.conf.in
URL: http://svn.apache.org/viewvc/httpd/test/framework/trunk/t/conf/extra.conf.in?rev=1881264&r1=1881263&r2=1881264&view=diff
==============================================================================
--- httpd/test/framework/trunk/t/conf/extra.conf.in (original)
+++ httpd/test/framework/trunk/t/conf/extra.conf.in Fri Aug 28 00:29:50 2020
@@ -262,6 +262,12 @@
     ### Redirect, server context
     RewriteRule ^/modules/rewrite/redirect.html$ http://@SERVERNAME@:@PORT@/foobar.html [L,R=301]
 
+    RewriteRule ^/modules/rewrite/cookie/0 - [CO=NAME3:VAL:localhost:86400:/0:secure:httponly:0]
+    RewriteRule ^/modules/rewrite/cookie/false - [CO=NAME3:VAL:localhost:86400:/0:secure:httponly:false]
+    RewriteRule ^/modules/rewrite/cookie/lax - [CO=NAME3:VAL:localhost:86400:/0:secure:httponly:lax]
+    RewriteRule ^/modules/rewrite/cookie/none - [CO=NAME3:VAL:localhost:86400:/0:secure:httponly:none]
+    RewriteRule ^/modules/rewrite/cookie/foo - [CO=NAME3:VAL:localhost:86400:/0:secure:httponly:foo]
+
    <VirtualHost cve_2011_3368_rewrite>
       DocumentRoot @SERVERROOT@/htdocs/modules/proxy
       RewriteEngine On

Modified: httpd/test/framework/trunk/t/modules/rewrite.t
URL: http://svn.apache.org/viewvc/httpd/test/framework/trunk/t/modules/rewrite.t?rev=1881264&r1=1881263&r2=1881264&view=diff
==============================================================================
--- httpd/test/framework/trunk/t/modules/rewrite.t (original)
+++ httpd/test/framework/trunk/t/modules/rewrite.t Fri Aug 28 00:29:50 2020
@@ -26,8 +26,9 @@ if (!have_min_apache_version('2.4')) {
 
 # Specific tests for PR 58231
 my $vary_header_tests = (have_min_apache_version("2.4.30") ? 9 : 0) + (have_min_apache_version("2.4.29") ? 4 : 0);
+my $cookie_tests = have_min_apache_version("2.5.1") ? 5 : 0;
 
-plan tests => @map * @num + 16 + $vary_header_tests, todo => \@todo, need_module 'rewrite';
+plan tests => @map * @num + 16 + $vary_header_tests + $cookie_tests, todo => \@todo, need_module 'rewrite';
 
 foreach (@map) {
     foreach my $n (@num) {
@@ -168,3 +169,16 @@ if (have_min_apache_version("2.4.30")) {
     ok t_cmp($r->content, qr/VARY4/, "Correct internal redirect happened, OK");
     ok t_cmp($r->header("Vary"), qr/(?!.*Host.*)/, "Vary:Host header not added, OK");
 }
+
+if (have_min_apache_version("2.5.1")) {
+    $r = GET("/modules/rewrite/cookie/0");
+    ok t_cmp($r->header("Set-Cookie"), qr/(?!.*SameSite=.*)/, "samesite present with 0");
+    $r = GET("/modules/rewrite/cookie/false");
+    ok t_cmp($r->header("Set-Cookie"), qr/(?!.*SameSite=.*)/, "samesite present with false");
+    $r = GET("/modules/rewrite/cookie/none");
+    ok t_cmp($r->header("Set-Cookie"), qr/SameSite=none/, "no samesite=none");
+    $r = GET("/modules/rewrite/cookie/lax");
+    ok t_cmp($r->header("Set-Cookie"), qr/SameSite=lax/, "no samesite=lax");
+    $r = GET("/modules/rewrite/cookie/foo");
+    ok t_cmp($r->header("Set-Cookie"), qr/SameSite=foo/, "no samesite=foo");
+}