| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Plack::App::PubSubHubbub::Subscriber::Config; |
|
2
|
4
|
|
|
4
|
|
33275
|
use strict; |
|
|
4
|
|
|
|
|
11
|
|
|
|
4
|
|
|
|
|
165
|
|
|
3
|
4
|
|
|
4
|
|
27
|
use warnings; |
|
|
4
|
|
|
|
|
12
|
|
|
|
4
|
|
|
|
|
138
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
4
|
|
|
4
|
|
1220
|
use URI; |
|
|
4
|
|
|
|
|
9162
|
|
|
|
4
|
|
|
|
|
1227
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Plack::App::PubSubHubbub::Subscriber::Config |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Plack::App::PubSubHubbub::Subscriber::Config->new( |
|
14
|
|
|
|
|
|
|
callback => 'http://example.org/callback', |
|
15
|
|
|
|
|
|
|
verify => 'sync', |
|
16
|
|
|
|
|
|
|
lease_seconds => 86400, |
|
17
|
|
|
|
|
|
|
token_in_path => 1, |
|
18
|
|
|
|
|
|
|
); |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head2 $class->new( %args ) |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=over 4 |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=item * C is required, must be 'http', must not contain fragment. |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=item * C can be 'sync' or 'async', and defaults to 'sync'. |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=item * C defaults to undef. |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=item * C defaults to 1. This puts the token in the callback URL path, and does not use the hub.verify_token argument of the query string. The main benefit is that the token also known when a ping is received. |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=cut |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub new { |
|
37
|
9
|
|
|
9
|
1
|
4443
|
my $class = shift; |
|
38
|
9
|
|
|
|
|
36
|
my %args = @_; |
|
39
|
9
|
|
|
|
|
31
|
my $self = bless {}, $class; |
|
40
|
|
|
|
|
|
|
|
|
41
|
9
|
|
100
|
|
|
53
|
my $verify = $args{verify} || 'sync'; |
|
42
|
9
|
100
|
100
|
|
|
61
|
die "verify must be 'sync' or 'async'" |
|
43
|
|
|
|
|
|
|
unless $verify eq 'sync' || $verify eq 'async'; |
|
44
|
8
|
|
|
|
|
33
|
$self->{verify} = $verify; |
|
45
|
|
|
|
|
|
|
|
|
46
|
8
|
100
|
|
|
|
52
|
my $cb = $args{callback} |
|
47
|
|
|
|
|
|
|
or die "'callback' required"; |
|
48
|
7
|
50
|
|
|
|
50
|
my $uri = URI->new($cb) |
|
49
|
|
|
|
|
|
|
or die "invalid callback"; |
|
50
|
7
|
100
|
|
|
|
40565
|
die "support only http" |
|
51
|
|
|
|
|
|
|
unless $uri->scheme eq 'http'; |
|
52
|
6
|
100
|
|
|
|
199
|
die "fragment is not accepted in the callback" |
|
53
|
|
|
|
|
|
|
if $uri->fragment; |
|
54
|
5
|
|
|
|
|
54
|
$self->{callback} = $cb; |
|
55
|
|
|
|
|
|
|
|
|
56
|
5
|
|
|
|
|
14
|
my $lease = $args{lease_seconds}; |
|
57
|
5
|
100
|
|
|
|
16
|
if (defined $lease) { |
|
58
|
2
|
100
|
|
|
|
26
|
die "invalid number of seconds" |
|
59
|
|
|
|
|
|
|
unless $lease >= 0; |
|
60
|
|
|
|
|
|
|
} |
|
61
|
4
|
|
|
|
|
9
|
$self->{lease_seconds} = $lease; |
|
62
|
|
|
|
|
|
|
|
|
63
|
4
|
|
100
|
|
|
27
|
$self->{token_in_path} = $args{token_in_path} // 1; |
|
64
|
|
|
|
|
|
|
|
|
65
|
4
|
|
|
|
|
70
|
return $self; |
|
66
|
|
|
|
|
|
|
} |
|
67
|
|
|
|
|
|
|
|
|
68
|
9
|
|
|
9
|
1
|
6973
|
sub callback { $_[0]->{callback} } |
|
69
|
|
|
|
|
|
|
|
|
70
|
5
|
|
|
5
|
1
|
31
|
sub verify { $_[0]->{verify} } |
|
71
|
|
|
|
|
|
|
|
|
72
|
5
|
|
|
5
|
1
|
27
|
sub lease_seconds { $_[0]->{lease_seconds} } |
|
73
|
|
|
|
|
|
|
|
|
74
|
6
|
|
|
6
|
1
|
64
|
sub token_in_path { $_[0]->{token_in_path} } |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
1; |