line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
##---------------------------------------------------------------------------- |
2
|
|
|
|
|
|
|
## Asynchronous HTTP Request and Promise - ~/lib/HTTP/Promise/Headers/ClearSiteData.pm |
3
|
|
|
|
|
|
|
## Version v0.1.0 |
4
|
|
|
|
|
|
|
## Copyright(c) 2022 DEGUEST Pte. Ltd. |
5
|
|
|
|
|
|
|
## Author: Jacques Deguest <jack@deguest.jp> |
6
|
|
|
|
|
|
|
## Created 2022/05/07 |
7
|
|
|
|
|
|
|
## Modified 2022/05/07 |
8
|
|
|
|
|
|
|
## All rights reserved. |
9
|
|
|
|
|
|
|
## |
10
|
|
|
|
|
|
|
## |
11
|
|
|
|
|
|
|
## This program is free software; you can redistribute it and/or modify it |
12
|
|
|
|
|
|
|
## under the same terms as Perl itself. |
13
|
|
|
|
|
|
|
##---------------------------------------------------------------------------- |
14
|
|
|
|
|
|
|
package HTTP::Promise::Headers::ClearSiteData; |
15
|
|
|
|
|
|
|
BEGIN |
16
|
|
|
|
|
|
|
{ |
17
|
3
|
|
|
3
|
|
3456
|
use strict; |
|
3
|
|
|
|
|
20
|
|
|
3
|
|
|
|
|
100
|
|
18
|
3
|
|
|
3
|
|
13
|
use warnings; |
|
3
|
|
|
|
|
14
|
|
|
3
|
|
|
|
|
81
|
|
19
|
3
|
|
|
3
|
|
15
|
use warnings::register; |
|
3
|
|
|
|
|
17
|
|
|
3
|
|
|
|
|
383
|
|
20
|
3
|
|
|
3
|
|
19
|
use parent qw( HTTP::Promise::Headers::Generic ); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
19
|
|
21
|
3
|
|
|
3
|
|
299
|
our $VERSION = 'v0.1.0'; |
22
|
|
|
|
|
|
|
}; |
23
|
|
|
|
|
|
|
|
24
|
3
|
|
|
3
|
|
18
|
use strict; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
56
|
|
25
|
3
|
|
|
3
|
|
13
|
use warnings; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
1190
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub init |
28
|
|
|
|
|
|
|
{ |
29
|
3
|
|
|
3
|
1
|
5626
|
my $self = shift( @_ ); |
30
|
3
|
|
|
|
|
176
|
$self->{params} = []; |
31
|
3
|
|
|
|
|
14
|
$self->{properties} = {}; |
32
|
3
|
50
|
66
|
|
|
50
|
@_ = () if( @_ == 1 && $self->_is_a( $_[0] => 'Module::Generic::Null' ) ); |
33
|
3
|
100
|
|
|
|
70
|
if( @_ ) |
34
|
|
|
|
|
|
|
{ |
35
|
2
|
|
|
|
|
10
|
my $this = shift( @_ ); |
36
|
2
|
50
|
|
|
|
23
|
my $ref = $self->new_array( $self->_is_array( $this ) ? $this : [$self->_qstring_split( "$this" )] ); |
37
|
2
|
|
|
|
|
89
|
$self->params( $ref ); |
38
|
|
|
|
|
|
|
} |
39
|
3
|
|
|
|
|
1904
|
$self->{_init_strict_use_sub} = 1; |
40
|
3
|
50
|
|
|
|
28
|
$self->SUPER::init( @_ ) || return( $self->pass_error ); |
41
|
3
|
|
|
|
|
26
|
$self->_field_name( 'Clear-Site-Data' ); |
42
|
3
|
|
|
|
|
2397
|
return( $self ); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub as_string |
46
|
|
|
|
|
|
|
{ |
47
|
6
|
|
|
6
|
1
|
577
|
my $self = shift( @_ ); |
48
|
6
|
|
|
|
|
20
|
my $params = $self->params; |
49
|
6
|
50
|
|
|
|
4615
|
return( $params->is_empty ? '' : $self->_qstring_join( @$params ) ); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
4
|
|
|
4
|
1
|
38
|
sub cache { return( shift->_set_get_property_boolean( 'cache', @_ ) ); } |
53
|
|
|
|
|
|
|
|
54
|
2
|
|
|
2
|
1
|
13
|
sub cookies { return( shift->_set_get_property_boolean( 'cookies', @_ ) ); } |
55
|
|
|
|
|
|
|
|
56
|
2
|
|
|
2
|
1
|
8
|
sub execution_contexts { return( shift->_set_get_property_boolean( 'executionContexts', @_ ) ); } |
57
|
|
|
|
|
|
|
|
58
|
19
|
|
|
19
|
1
|
69
|
sub params { return( shift->_set_get_array_as_object( 'params', @_ ) ); } |
59
|
|
|
|
|
|
|
|
60
|
11
|
|
|
11
|
1
|
54
|
sub properties { return( shift->_set_get_hash_as_mix_object( 'properties', @_ ) ); } |
61
|
|
|
|
|
|
|
|
62
|
2
|
|
|
2
|
1
|
15
|
sub storage { return( shift->_set_get_property_boolean( 'storage', @_ ) ); } |
63
|
|
|
|
|
|
|
|
64
|
1
|
|
|
1
|
1
|
9
|
sub wildcard { return( shift->_set_get_property_boolean( '*', @_ ) ); } |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
1; |
67
|
|
|
|
|
|
|
# NOTE: POD |
68
|
|
|
|
|
|
|
__END__ |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=encoding utf-8 |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 NAME |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
HTTP::Promise::Headers::ClearSiteData - Clear-Site-Data Header Field |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 SYNOPSIS |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
use HTTP::Promise::Headers::ClearSiteData; |
79
|
|
|
|
|
|
|
my $csd = HTTP::Promise::Headers::ClearSiteData->new || |
80
|
|
|
|
|
|
|
die( HTTP::Promise::Headers::ClearSiteData->error, "\n" ); |
81
|
|
|
|
|
|
|
my $h = HTTP::Promise::Headers::ClearSiteData->new; |
82
|
|
|
|
|
|
|
# Single directive |
83
|
|
|
|
|
|
|
# Clear-Site-Data: "cache" |
84
|
|
|
|
|
|
|
$h->cache(1); |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
# Multiple directives (comma separated) |
87
|
|
|
|
|
|
|
# Clear-Site-Data: "cache", "cookies" |
88
|
|
|
|
|
|
|
$h->cache(1); |
89
|
|
|
|
|
|
|
$h->cookies(1); |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
# Wild card |
92
|
|
|
|
|
|
|
# Clear-Site-Data: "*" |
93
|
|
|
|
|
|
|
$h->params('*'); |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 VERSION |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
v0.1.0 |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 DESCRIPTION |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
The following is an extract from Mozilla documentation. |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
The C<Clear-Site-Data> header clears browsing data (cookies, storage, cache) associated with the requesting website. It allows web developers to have more control over the data stored by a client browser for their origins. |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Example: |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
Clear-Site-Data: "cache", "cookies", "storage", "executionContexts" |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 METHODS |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head2 cache |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
Sets or gets the property C<cache> |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Indicates that the server wishes to remove locally cached data (the browser cache, see HTTP caching) for the origin of the response URL. Depending on the browser, this might also clear out things like pre-rendered pages, script caches, WebGL shader caches, or address bar suggestions. |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head2 cookies |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
Sets or gets the property C<cookies> |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
Indicates that the server wishes to remove all cookies for the origin of the response URL. HTTP authentication credentials are also cleared out. This affects the entire registered domain, including subdomains. So https://example.com as well as https://stage.example.com, will have cookies cleared. |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head2 execution_contexts |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
Sets or gets the property C<executionContexts> |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
Indicates that the server wishes to reload all browsing contexts for the origin of the response (Location.reload). |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head2 params |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
Returns the L<array object|Module::Generic::Array> used by this header field object containing all the properties set. |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=head2 properties |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
Returns the L<hash object|Module::Generic::hash> used as a repository of properties. |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head2 storage |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
Sets or gets the property C<storage> |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
Indicates that the server wishes to remove all DOM storage for the origin of the response URL. |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=head2 wildcard |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
Sets or gets the special property C<*> (wildcard) |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
Indicates that the server wishes to clear all types of data for the origin of the response. If more data types are added in future versions of this header, they will also be covered by it. |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=head1 AUTHOR |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
Jacques Deguest E<lt>F<jack@deguest.jp>E<gt> |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=head1 SEE ALSO |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Clear-Site-Data> |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
L<HTTP::Promise>, L<HTTP::Promise::Request>, L<HTTP::Promise::Response>, L<HTTP::Promise::Message>, L<HTTP::Promise::Entity>, L<HTTP::Promise::Headers>, L<HTTP::Promise::Body>, L<HTTP::Promise::Body::Form>, L<HTTP::Promise::Body::Form::Data>, L<HTTP::Promise::Body::Form::Field>, L<HTTP::Promise::Status>, L<HTTP::Promise::MIME>, L<HTTP::Promise::Parser>, L<HTTP::Promise::IO>, L<HTTP::Promise::Stream>, L<HTTP::Promise::Exception> |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
Copyright(c) 2022 DEGUEST Pte. Ltd. |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
All rights reserved. |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=cut |