line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
##---------------------------------------------------------------------------- |
2
|
|
|
|
|
|
|
## Asynchronous HTTP Request and Promise - ~/lib/HTTP/Promise/Headers/TE.pm |
3
|
|
|
|
|
|
|
## Version v0.1.0 |
4
|
|
|
|
|
|
|
## Copyright(c) 2022 DEGUEST Pte. Ltd. |
5
|
|
|
|
|
|
|
## Author: Jacques Deguest <jack@deguest.jp> |
6
|
|
|
|
|
|
|
## Created 2022/05/08 |
7
|
|
|
|
|
|
|
## Modified 2022/05/08 |
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::TE; |
15
|
|
|
|
|
|
|
BEGIN |
16
|
|
|
|
|
|
|
{ |
17
|
3
|
|
|
3
|
|
3344
|
use strict; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
99
|
|
18
|
3
|
|
|
3
|
|
18
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
81
|
|
19
|
3
|
|
|
3
|
|
16
|
use warnings::register; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
407
|
|
20
|
3
|
|
|
3
|
|
16
|
use parent qw( HTTP::Promise::Headers::Accept ); |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
16
|
|
21
|
3
|
|
|
3
|
|
272
|
our $VERSION = 'v0.1.0'; |
22
|
|
|
|
|
|
|
}; |
23
|
|
|
|
|
|
|
|
24
|
3
|
|
|
3
|
|
19
|
use strict; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
58
|
|
25
|
3
|
|
|
3
|
|
15
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
263
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub init |
28
|
|
|
|
|
|
|
{ |
29
|
3
|
|
|
3
|
1
|
3605
|
my $self = shift( @_ ); |
30
|
3
|
50
|
|
|
|
37
|
$self->SUPER::init( @_ ) || return( $self->pass_error ); |
31
|
3
|
|
|
|
|
16
|
$self->_field_name( 'TE' ); |
32
|
3
|
|
|
|
|
2316
|
return( $self ); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |
36
|
|
|
|
|
|
|
# NOTE: POD |
37
|
|
|
|
|
|
|
__END__ |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=encoding utf-8 |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 NAME |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
HTTP::Promise::Headers::TE - TE Header Field |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 SYNOPSIS |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
use HTTP::Promise::Headers::TE; |
48
|
|
|
|
|
|
|
my $te = HTTP::Promise::Headers::TE->new || |
49
|
|
|
|
|
|
|
die( HTTP::Promise::Headers::TE->error, "\n" ); |
50
|
|
|
|
|
|
|
my $e = $te->add( 'gzip' ); |
51
|
|
|
|
|
|
|
# Set deflate with a weight of 0.5 |
52
|
|
|
|
|
|
|
my $e1 = $te->add( 'deflate' => 0.5 ); |
53
|
|
|
|
|
|
|
my $e2 = $te->get( $e1 ); |
54
|
|
|
|
|
|
|
# $e1 and $e2 are the same |
55
|
|
|
|
|
|
|
my $e2 = $te->get( 'deflate' ); |
56
|
|
|
|
|
|
|
say $e2->value; # 0.5 |
57
|
|
|
|
|
|
|
$e2->value(0.7); # Change it to 0.7 |
58
|
|
|
|
|
|
|
say "$te"; |
59
|
|
|
|
|
|
|
# gzip, deflate;q=0.7 |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 VERSION |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
v0.1.0 |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 DESCRIPTION |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
This class inherits all its features from L<HTTP::Promise::Headers::Accept> |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
The following description is taken from Mozilla documentation. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Example: |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
TE: deflate |
74
|
|
|
|
|
|
|
TE: gzip |
75
|
|
|
|
|
|
|
TE: trailers |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
# Multiple directives, weighted with the quality value syntax: |
78
|
|
|
|
|
|
|
TE: trailers, deflate;q=0.5 |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 METHODS |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
See L<HTTP::Promise::Headers::Accept> |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 AUTHOR |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Jacques Deguest E<lt>F<jack@deguest.jp>E<gt> |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 SEE ALSO |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
See also L<rfc7230, section 4.3|https://tools.ietf.org/html/rfc7230#section-4.3> and L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/TE> |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
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> |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Copyright(c) 2022 DEGUEST Pte. Ltd. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
All rights reserved. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=cut |