comparison secure_link.t @ 161:2c07dc5bc354

Tests: avoid using encode_base64url(). It only recently appeared in MIME::Base64 3.11 and only shipped with Perl 5.13.8+.
author Maxim Dounin <mdounin@mdounin.ru>
date Fri, 29 Jul 2011 02:28:45 +0400
parents 197d5d9fd7f9
children 6a0d934950bc
comparison
equal deleted inserted replaced
160:197d5d9fd7f9 161:2c07dc5bc354
10 use strict; 10 use strict;
11 11
12 use Test::More; 12 use Test::More;
13 13
14 use Digest::MD5 qw/ md5 md5_hex /; 14 use Digest::MD5 qw/ md5 md5_hex /;
15 use MIME::Base64 qw/ encode_base64url /; 15 use MIME::Base64 qw/ encode_base64 /;
16 16
17 BEGIN { use FindBin; chdir($FindBin::Bin); } 17 BEGIN { use FindBin; chdir($FindBin::Bin); }
18 18
19 use lib 'lib'; 19 use lib 'lib';
20 use Test::Nginx; 20 use Test::Nginx;
134 like(http_get('/p/' . md5_hex('fake') . '/test.html'), qr/^HTTP.*403/, 134 like(http_get('/p/' . md5_hex('fake') . '/test.html'), qr/^HTTP.*403/,
135 'request old style fake hash'); 135 'request old style fake hash');
136 like(http_get('/p/test.html'), qr/^HTTP.*403/, 'request old style no hash'); 136 like(http_get('/p/test.html'), qr/^HTTP.*403/, 'request old style no hash');
137 137
138 ############################################################################### 138 ###############################################################################
139
140 sub encode_base64url {
141 my $e = encode_base64(shift, "");
142 $e =~ s/=+\z//;
143 $e =~ tr[+/][-_];
144 return $e;
145 }
146
147 ###############################################################################