Author: issac
Date: Mon Nov 15 18:42:07 2010
New Revision: 1035398
URL: http://svn.apache.org/viewvc?rev=1035398&view=rev
Log:
Perl glue tests (and extra docs) for HttpOnly
Modified:
httpd/apreq/trunk/glue/perl/lib/Apache2/Cookie.pm
httpd/apreq/trunk/glue/perl/t/apreq/cookie.t
httpd/apreq/trunk/glue/perl/t/response/TestApReq/cookie.pm
Modified: httpd/apreq/trunk/glue/perl/lib/Apache2/Cookie.pm
URL:
http://svn.apache.org/viewvc/httpd/apreq/trunk/glue/perl/lib/Apache2/Cookie.pm?rev=1035398&r1=1035397&r2=1035398&view=diff
==============================================================================
--- httpd/apreq/trunk/glue/perl/lib/Apache2/Cookie.pm (original)
+++ httpd/apreq/trunk/glue/perl/lib/Apache2/Cookie.pm Mon Nov 15 18:42:07 2010
@@ -450,6 +450,20 @@ Get or set the HttpOnly flag for the coo
+=head2 httponly
+
+ $cookie->httponly()
+ $cookie->httponly($set)
+
+Get or set the HttpOnly flag for the cookie:
+
+ $cookie->httponly(1);
+ $is_HttpOnly = $cookie->httponly;
+ $cookie->httponly(0);
+
+
+
+
=head2 comment
$cookie->comment()
Modified: httpd/apreq/trunk/glue/perl/t/apreq/cookie.t
URL:
http://svn.apache.org/viewvc/httpd/apreq/trunk/glue/perl/t/apreq/cookie.t?rev=1035398&r1=1035397&r2=1035398&view=diff
==============================================================================
--- httpd/apreq/trunk/glue/perl/t/apreq/cookie.t (original)
+++ httpd/apreq/trunk/glue/perl/t/apreq/cookie.t Mon Nov 15 18:42:07 2010
@@ -6,7 +6,7 @@ use Apache::Test;
use Apache::TestUtil;
use Apache::TestRequest qw(GET_BODY GET_HEAD);
-plan tests => 14, need_min_module_version('Apache::Test' => 1.29) || need_lwp;
+plan tests => 15, need_min_module_version('Apache::Test' => 1.29) || need_lwp;
my $module = "TestApReq::cookie";
my $location = Apache::TestRequest::module2url($module);
@@ -168,3 +168,15 @@ my $location = Apache::TestRequest::modu
my $str = GET_BODY("$location?test=$test", Cookie => $cookie);
ok t_cmp($str, $value, $test);
}
+{
+ my $test = 'httponly';
+ my $key = 'apache';
+ my $value = 'ok';
+ my $cookie = "$key=$value; HttpOnly";
+ my ($header) =
+ GET_HEAD("$location?test=$test&key=$key") =~ /^#Set-Cookie:\s+(.+)/m;
+
+ ok t_cmp($header, $cookie_in, $test);
+
+}
+
Modified: httpd/apreq/trunk/glue/perl/t/response/TestApReq/cookie.pm
URL:
http://svn.apache.org/viewvc/httpd/apreq/trunk/glue/perl/t/response/TestApReq/cookie.pm?rev=1035398&r1=1035397&r2=1035398&view=diff
==============================================================================
--- httpd/apreq/trunk/glue/perl/t/response/TestApReq/cookie.pm (original)
+++ httpd/apreq/trunk/glue/perl/t/response/TestApReq/cookie.pm Mon Nov 15
18:42:07 2010
@@ -68,6 +68,10 @@ sub handler {
$cookie->version(1);
$cookie->bake2($req);
}
+ elsif ($test eq 'httponly'){
+ $cookie->httponly(1);
+ $cookie->bake($req);
+ }
$r->print($cookie->value);
}