@@ -33,6 +33,7 @@ my %args = (
test_files => ((-d '.git' || $ENV{RELEASE_TESTING}) && -d 'xt') ? 't/ xt/' : 't/',
recursive_test_files => 1,
+
);
if (-d 'share') {
@@ -1,5 +1,13 @@
Revision history for Perl extension HTTP-Session2
+0.05 2014-03-18T18:52:37Z
+
+ - use Cookie::Baker for generating cookie string for Plack response object.
+ Because the document says HTTP::Session supports Cookie::Baker's expiration format like "-1d".
+ But it's not supported in previous version!!
+ https://github.com/tokuhirom/HTTP-Session2/pull/1
+ (magai)
+
0.04 2013-11-01T01:00:09Z
- Revert validate_empty_session flag introduced at 0.03.
@@ -4,7 +4,7 @@
"tokuhirom <tokuhirom@gmail.com>"
],
"dynamic_config" : 0,
- "generated_by" : "Minilla/v0.7.5",
+ "generated_by" : "Minilla/v0.12.0",
"license" : [
"perl_5"
],
@@ -64,7 +64,7 @@
"provides" : {
"HTTP::Session2" : {
"file" : "lib/HTTP/Session2.pm",
- "version" : "0.04"
+ "version" : "0.05"
},
"HTTP::Session2::Base" : {
"file" : "lib/HTTP/Session2/Base.pm"
@@ -77,7 +77,7 @@
},
"HTTP::Session2::ServerStore" : {
"file" : "lib/HTTP/Session2/ServerStore.pm",
- "version" : "0.04"
+ "version" : "0.05"
}
},
"release_status" : "stable",
@@ -91,5 +91,8 @@
"web" : "https://github.com/tokuhirom/HTTP-Session2"
}
},
- "version" : "0.04"
+ "version" : "0.05",
+ "x_contributors" : [
+ "magai <xxmagai@gmail.com>"
+ ]
}
@@ -3,19 +3,19 @@ abstract: 'HTTP session management'
author:
- 'tokuhirom <tokuhirom@gmail.com>'
build_requires:
- Plack::Response: 0
- Test::More: 0.98
- Test::WWW::Mechanize::PSGI: 0
+ Plack::Response: '0'
+ Test::More: '0.98'
+ Test::WWW::Mechanize::PSGI: '0'
configure_requires:
- CPAN::Meta: 0
- CPAN::Meta::Prereqs: 0
- Module::Build: 0.38
+ CPAN::Meta: '0'
+ CPAN::Meta::Prereqs: '0'
+ Module::Build: '0.38'
dynamic_config: 0
-generated_by: 'Minilla/v0.7.5, CPAN::Meta::Converter version 2.132510'
+generated_by: 'Minilla/v0.12.0, CPAN::Meta::Converter version 2.133380'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
- version: 1.4
+ version: '1.4'
name: HTTP-Session2
no_index:
directory:
@@ -30,7 +30,7 @@ no_index:
provides:
HTTP::Session2:
file: lib/HTTP/Session2.pm
- version: 0.04
+ version: '0.05'
HTTP::Session2::Base:
file: lib/HTTP/Session2/Base.pm
HTTP::Session2::ClientStore:
@@ -39,18 +39,20 @@ provides:
file: lib/HTTP/Session2/Expired.pm
HTTP::Session2::ServerStore:
file: lib/HTTP/Session2/ServerStore.pm
- version: 0.04
+ version: '0.05'
requires:
- Cookie::Baker: 0
- Digest::HMAC: 0
- Digest::SHA: 0
- Digest::SHA1: 0
- MIME::Base64: 0
- Mouse: 0
- parent: 0
- perl: 5.008005
+ Cookie::Baker: '0'
+ Digest::HMAC: '0'
+ Digest::SHA: '0'
+ Digest::SHA1: '0'
+ MIME::Base64: '0'
+ Mouse: '0'
+ parent: '0'
+ perl: '5.008005'
resources:
bugtracker: https://github.com/tokuhirom/HTTP-Session2/issues
homepage: https://github.com/tokuhirom/HTTP-Session2
repository: git://github.com/tokuhirom/HTTP-Session2.git
-version: 0.04
+version: '0.05'
+x_contributors:
+ - 'magai <xxmagai@gmail.com>'
@@ -53,8 +53,6 @@ Then, we need to support query parameter based session management.
But today, Japanese people are using smart phone :)
We don't have to support legacy phones on new project.
-
-
# Automatic XSRF token sending.
This is an example code for filling XSRF token.
@@ -189,3 +187,7 @@ it under the same terms as Perl itself.
# AUTHOR
tokuhirom <tokuhirom@gmail.com>
+
+# CONTRIBUTORS
+
+magai
@@ -1,29 +1,31 @@
-$(function () {
- "use strict";
+(function (document, $) {
+ $(function () {
+ "use strict";
- var xsrf_token = getXSRFToken();
- $("form").each(function () {
- var form = $(this);
- var method = form.attr('method');
- if (method === 'get' || method === 'GET') {
- return;
- }
+ var xsrf_token = getXSRFToken();
+ $("form").each(function () {
+ var form = $(this);
+ var method = form.attr('method');
+ if (method === 'get' || method === 'GET') {
+ return;
+ }
- var input = $(document.createElement('input'));
- input.attr('type', 'hidden');
- input.attr('name', 'XSRF-TOKEN');
- input.attr('value', xsrf_token);
- form.prepend(input);
- });
+ var input = $(document.createElement('input'));
+ input.attr('type', 'hidden');
+ input.attr('name', 'XSRF-TOKEN');
+ input.attr('value', xsrf_token);
+ form.prepend(input);
+ });
- function getXSRFToken() {
- var cookies = document.cookie.split(/\s*;\s*/);
- for (var i=0,l=cookies.length; i<l; i++) {
- var matched = cookies[i].match(/^XSRF-TOKEN=(.*)$/);
- if (matched) {
- return matched[1];
+ function getXSRFToken() {
+ var cookies = document.cookie.split(/\s*;\s*/);
+ for (var i=0,l=cookies.length; i<l; i++) {
+ var matched = cookies[i].match(/^XSRF-TOKEN=(.*)$/);
+ if (matched) {
+ return matched[1];
+ }
}
+ return undefined;
}
- return undefined;
- }
-});
+ });
+})(document, jQuery);
@@ -133,7 +133,8 @@ sub finalize_plack_response {
my @cookies = $self->finalize();
while (my ($name, $cookie) = splice @cookies, 0, 2) {
- $res->cookies->{$name} = $cookie;
+ my $baked = Cookie::Baker::bake_cookie( $name, $cookie );
+ $res->headers->push_header('Set-Cookie' => $baked);
}
}
@@ -4,7 +4,7 @@ use warnings;
use utf8;
use 5.008_001;
-our $VERSION = "0.04";
+our $VERSION = "0.05";
use Carp ();
use Digest::HMAC;
@@ -3,7 +3,7 @@ use 5.008005;
use strict;
use warnings;
-our $VERSION = "0.04";
+our $VERSION = "0.05";
1;
__END__
@@ -224,5 +224,9 @@ it under the same terms as Perl itself.
tokuhirom E<lt>tokuhirom@gmail.comE<gt>
+=head1 CONTRIBUTORS
+
+magai
+
=cut
@@ -7,21 +7,41 @@ use Plack::Response;
use HTTP::Session2::ClientStore;
use Test::WWW::Mechanize::PSGI;
-my $app = sub {
- my $env = shift;
+{
+ my $app = sub {
+ my $env = shift;
- my $session = HTTP::Session2::ClientStore->new(env => $env, secret => 'yes. i am secret man.');
- $session->set(foo => 'bar');
+ my $session = HTTP::Session2::ClientStore->new(env => $env, secret => 'yes. i am secret man.');
+ $session->set(foo => 'bar');
- my $res = Plack::Response->new(200);
- $session->finalize_plack_response($res);
- return $res->finalize;
-};
+ my $res = Plack::Response->new(200);
+ $session->finalize_plack_response($res);
+ return $res->finalize;
+ };
-my $mech = Test::WWW::Mechanize::PSGI->new(app => $app, max_redirect => 0);
-$mech->get('/');
-note $mech->response->headers->as_string;
-is cookie_count($mech), 2;
+ my $mech = Test::WWW::Mechanize::PSGI->new(app => $app, max_redirect => 0);
+ $mech->get('/');
+ note $mech->response->headers->as_string;
+ is cookie_count($mech), 2;
+}
+
+{
+ my $app = sub {
+ my $env = shift;
+
+ my $session = HTTP::Session2::ClientStore->new(env => $env, secret => 'yes. i am secret man.');
+ $session->expire;
+
+ my $res = Plack::Response->new(200);
+ $session->finalize_plack_response($res);
+ return $res->finalize;
+ };
+
+ my $mech = Test::WWW::Mechanize::PSGI->new(app => $app, max_redirect => 0);
+ $mech->get('/');
+ note $mech->response->headers->as_string;
+ is cookie_count($mech), 0;
+}
done_testing;