@@ -12,8 +12,6 @@ use utf8;
use Module::Build;
use File::Basename;
use File::Spec;
-use CPAN::Meta;
-use CPAN::Meta::Prereqs;
my %args = (
license => 'perl',
@@ -33,7 +31,8 @@ my %args = (
test_files => ((-d '.git' || $ENV{RELEASE_TESTING}) && -d 'xt') ? 't/ xt/' : 't/',
recursive_test_files => 1,
-
+
+
);
if (-d 'share') {
$args{share_dir} = 'share';
@@ -52,20 +51,15 @@ my $builder = Module::Build->subclass(
)->new(%args);
$builder->create_build_script();
-my $mbmeta = CPAN::Meta->load_file('MYMETA.json');
-my $meta = CPAN::Meta->load_file('META.json');
-my $prereqs_hash = CPAN::Meta::Prereqs->new(
- $meta->prereqs
-)->with_merged_prereqs(
- CPAN::Meta::Prereqs->new($mbmeta->prereqs)
-)->as_string_hash;
-my $mymeta = CPAN::Meta->new(
- {
- %{$meta->as_struct},
- prereqs => $prereqs_hash
- }
-);
-print "Merging cpanfile prereqs to MYMETA.yml\n";
-$mymeta->save('MYMETA.yml', { version => 1.4 });
-print "Merging cpanfile prereqs to MYMETA.json\n";
-$mymeta->save('MYMETA.json', { version => 2 });
+use File::Copy;
+
+print "cp META.json MYMETA.json\n";
+copy("META.json","MYMETA.json") or die "Copy failed(META.json): $!";
+
+if (-f 'META.yml') {
+ print "cp META.yml MYMETA.yml\n";
+ copy("META.yml","MYMETA.yml") or die "Copy failed(META.yml): $!";
+} else {
+ print "There is no META.yml... You may install this module from the repository...\n";
+}
+
@@ -1,5 +1,29 @@
Revision history for Perl extension HTTP-Session2
+1.00 2014-07-28T04:09:47Z
+
+ [INCOMPATIBLE CHANGE]
+ - I changed HMAC strategy on ServerSide mode.
+ Previous version uses
+
+ hmac_hex(data: $session_id, key: $secret)
+
+ New version is:
+
+ hmac_hex(data: $secret, key: $session)
+
+ This version is even secure. But, it's not a critical issue.
+
+ I think this change won't break your code.
+
+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/v2.1.1",
"license" : [
"perl_5"
],
@@ -28,15 +28,14 @@
"prereqs" : {
"configure" : {
"requires" : {
- "CPAN::Meta" : "0",
- "CPAN::Meta::Prereqs" : "0",
"Module::Build" : "0.38"
}
},
"develop" : {
"requires" : {
"Test::CPAN::Meta" : "0",
- "Test::MinimumVersion" : "0.10108",
+ "Test::MinimumVersion::Fast" : "0.04",
+ "Test::PAUSE::Permissions" : "0.04",
"Test::Pod" : "1.41",
"Test::Spellunker" : "v0.2.7"
}
@@ -64,7 +63,7 @@
"provides" : {
"HTTP::Session2" : {
"file" : "lib/HTTP/Session2.pm",
- "version" : "0.04"
+ "version" : "1.00"
},
"HTTP::Session2::Base" : {
"file" : "lib/HTTP/Session2/Base.pm"
@@ -77,7 +76,7 @@
},
"HTTP::Session2::ServerStore" : {
"file" : "lib/HTTP/Session2/ServerStore.pm",
- "version" : "0.04"
+ "version" : "1.00"
}
},
"release_status" : "stable",
@@ -91,5 +90,8 @@
"web" : "https://github.com/tokuhirom/HTTP-Session2"
}
},
- "version" : "0.04"
+ "version" : "1.00",
+ "x_contributors" : [
+ "magai <xxmagai@gmail.com>"
+ ]
}
@@ -3,19 +3,17 @@ 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
+ Module::Build: '0.38'
dynamic_config: 0
-generated_by: 'Minilla/v0.7.5, CPAN::Meta::Converter version 2.132510'
+generated_by: 'Minilla/v2.1.1, CPAN::Meta::Converter version 2.141520'
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 +28,7 @@ no_index:
provides:
HTTP::Session2:
file: lib/HTTP/Session2.pm
- version: 0.04
+ version: '1.00'
HTTP::Session2::Base:
file: lib/HTTP/Session2/Base.pm
HTTP::Session2::ClientStore:
@@ -39,18 +37,20 @@ provides:
file: lib/HTTP/Session2/Expired.pm
HTTP::Session2::ServerStore:
file: lib/HTTP/Session2/ServerStore.pm
- version: 0.04
+ version: '1.00'
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: '1.00'
+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 = "1.00";
use Carp ();
use Digest::HMAC;
@@ -111,7 +111,7 @@ sub expire {
sub _build_xsrf_token {
my $self = shift;
- Digest::HMAC::hmac_hex($self->id, $self->secret, $self->hmac_function);
+ Digest::HMAC::hmac_hex($self->secret, $self->id, $self->hmac_function);
}
sub save_data {
@@ -3,7 +3,7 @@ use 5.008005;
use strict;
use warnings;
-our $VERSION = "0.04";
+our $VERSION = "1.00";
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;