line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CGI::Test::Input::URL; |
2
|
11
|
|
|
11
|
|
40
|
use strict; |
|
11
|
|
|
|
|
16
|
|
|
11
|
|
|
|
|
281
|
|
3
|
11
|
|
|
11
|
|
37
|
use warnings; |
|
11
|
|
|
|
|
11
|
|
|
11
|
|
|
|
|
224
|
|
4
|
|
|
|
|
|
|
#################################################################### |
5
|
|
|
|
|
|
|
# $Id: URL.pm 411 2011-09-26 11:19:30Z nohuhu@nohuhu.org $ |
6
|
|
|
|
|
|
|
# $Name: cgi-test_0-104_t1 $ |
7
|
|
|
|
|
|
|
#################################################################### |
8
|
|
|
|
|
|
|
# |
9
|
|
|
|
|
|
|
# Copyright (c) 2001, Raphael Manfredi |
10
|
|
|
|
|
|
|
# |
11
|
|
|
|
|
|
|
# You may redistribute only under the terms of the Artistic License, |
12
|
|
|
|
|
|
|
# as specified in the README file that comes with the distribution. |
13
|
|
|
|
|
|
|
# |
14
|
|
|
|
|
|
|
# |
15
|
|
|
|
|
|
|
# POST input data to be encoded with "application/x-www-form-urlencoded". |
16
|
|
|
|
|
|
|
# |
17
|
|
|
|
|
|
|
|
18
|
11
|
|
|
11
|
|
34
|
use Carp; |
|
11
|
|
|
|
|
13
|
|
|
11
|
|
|
|
|
645
|
|
19
|
|
|
|
|
|
|
|
20
|
11
|
|
|
11
|
|
43
|
use base qw(CGI::Test::Input); |
|
11
|
|
|
|
|
13
|
|
|
11
|
|
|
|
|
3707
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# |
23
|
|
|
|
|
|
|
# ->new |
24
|
|
|
|
|
|
|
# |
25
|
|
|
|
|
|
|
# Creation routine |
26
|
|
|
|
|
|
|
# |
27
|
|
|
|
|
|
|
sub new |
28
|
|
|
|
|
|
|
{ |
29
|
17
|
|
|
17
|
0
|
59
|
my $this = bless { |
30
|
|
|
|
|
|
|
mime_type => 'application/x-www-form-urlencoded' |
31
|
|
|
|
|
|
|
}, shift; |
32
|
|
|
|
|
|
|
|
33
|
17
|
|
|
|
|
87
|
$this->_init; |
34
|
|
|
|
|
|
|
|
35
|
17
|
|
|
|
|
34
|
return $this; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# DEPRECATED |
39
|
|
|
|
|
|
|
sub make |
40
|
|
|
|
|
|
|
{ # |
41
|
0
|
|
|
0
|
0
|
0
|
my $class = shift; |
42
|
0
|
|
|
|
|
0
|
return $class->new(@_); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# |
46
|
|
|
|
|
|
|
# Defined interface |
47
|
|
|
|
|
|
|
# |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# |
50
|
|
|
|
|
|
|
# ->_build_data |
51
|
|
|
|
|
|
|
# |
52
|
|
|
|
|
|
|
# Rebuild data buffer from input fields. |
53
|
|
|
|
|
|
|
# |
54
|
|
|
|
|
|
|
sub _build_data |
55
|
|
|
|
|
|
|
{ |
56
|
17
|
|
|
17
|
|
18
|
my $this = shift; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# |
59
|
|
|
|
|
|
|
# Note that file uploading fields get handled as any other field, meaning |
60
|
|
|
|
|
|
|
# only the file path will be transmitted. |
61
|
|
|
|
|
|
|
# |
62
|
|
|
|
|
|
|
|
63
|
17
|
|
|
|
|
23
|
my $data = ''; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
# XXX field name encoding of special chars is the same as data? |
66
|
|
|
|
|
|
|
|
67
|
17
|
|
|
|
|
29
|
foreach my $tuple (@{$this->_fields()}, @{$this->_files()}) |
|
17
|
|
|
|
|
41
|
|
|
17
|
|
|
|
|
324
|
|
68
|
|
|
|
|
|
|
{ |
69
|
257
|
|
|
|
|
255
|
my ($name, $value) = @$tuple; |
70
|
257
|
|
|
|
|
241
|
$value =~ s/([^a-zA-Z0-9_. -])/uc sprintf("%%%02x",ord($1))/eg; |
|
30
|
|
|
|
|
136
|
|
71
|
257
|
|
|
|
|
228
|
$value =~ s/ /+/g; |
72
|
257
|
|
|
|
|
191
|
$name =~ s/([^a-zA-Z0-9_.-])/uc sprintf("%%%02x",ord($1))/eg; |
|
0
|
|
|
|
|
0
|
|
73
|
257
|
100
|
|
|
|
327
|
$data .= '&' if length $data; |
74
|
257
|
|
|
|
|
315
|
$data .= $name . '=' . $value; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
17
|
|
|
|
|
58
|
return $data; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
1; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 NAME |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
CGI::Test::Input::URL - POST input encoded as application/x-www-form-urlencoded |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 SYNOPSIS |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
# Inherits from CGI::Test::Input |
89
|
|
|
|
|
|
|
require CGI::Test::Input::URL; |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
my $input = CGI::Test::Input::URL->new(); |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 DESCRIPTION |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
This class represents the input for HTTP POST requests, encoded |
96
|
|
|
|
|
|
|
as C. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Please see L for interface details. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 AUTHORS |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
The original author is Raphael Manfredi. |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Steven Hilton was long time maintainer of this module. |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Current maintainer is Alexander Tokarev Ftokarev@cpan.orgE>. |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 SEE ALSO |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
CGI::Test::Input(3). |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=cut |
113
|
|
|
|
|
|
|
|