| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# Net::ICAP::Request -- Request object for ICAP |
|
2
|
|
|
|
|
|
|
# |
|
3
|
|
|
|
|
|
|
# (c) 2012, Arthur Corliss |
|
4
|
|
|
|
|
|
|
# |
|
5
|
|
|
|
|
|
|
# $Revision: 0.03 $ |
|
6
|
|
|
|
|
|
|
# |
|
7
|
|
|
|
|
|
|
# This software is licensed under the same terms as Perl, itself. |
|
8
|
|
|
|
|
|
|
# Please see http://dev.perl.org/licenses/ for more information. |
|
9
|
|
|
|
|
|
|
# |
|
10
|
|
|
|
|
|
|
##################################################################### |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
##################################################################### |
|
13
|
|
|
|
|
|
|
# |
|
14
|
|
|
|
|
|
|
# Environment definitions |
|
15
|
|
|
|
|
|
|
# |
|
16
|
|
|
|
|
|
|
##################################################################### |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
package Net::ICAP::Request; |
|
19
|
|
|
|
|
|
|
|
|
20
|
2
|
|
|
2
|
|
23940
|
use 5.008003; |
|
|
2
|
|
|
|
|
7
|
|
|
|
2
|
|
|
|
|
83
|
|
|
21
|
|
|
|
|
|
|
|
|
22
|
2
|
|
|
2
|
|
11
|
use strict; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
56
|
|
|
23
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
60
|
|
|
24
|
2
|
|
|
2
|
|
10
|
use vars qw($VERSION @ISA @_properties @_methods); |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
209
|
|
|
25
|
2
|
|
|
2
|
|
1025
|
use Class::EHierarchy qw(:all); |
|
|
2
|
|
|
|
|
8672
|
|
|
|
2
|
|
|
|
|
423
|
|
|
26
|
2
|
|
|
2
|
|
706
|
use Net::ICAP::Common qw(:std :debug :req); |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
381
|
|
|
27
|
2
|
|
|
2
|
|
602
|
use Net::ICAP::Message; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
118
|
|
|
28
|
2
|
|
|
2
|
|
14
|
use Paranoid::Debug; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
147
|
|
|
29
|
2
|
|
|
2
|
|
1806
|
use URI; |
|
|
2
|
|
|
|
|
13774
|
|
|
|
2
|
|
|
|
|
3310
|
|
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
($VERSION) = ( q$Revision: 0.03 $ =~ /(\d+(?:\.(\d+))+)/sm ); |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
@ISA = qw(Net::ICAP::Message Class::EHierarchy); |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
@_properties = ( |
|
36
|
|
|
|
|
|
|
[ CEH_RESTR | CEH_ARRAY, '_valid_methods', [qw(REQMOD RESPMOD OPTIONS)] ], |
|
37
|
|
|
|
|
|
|
[ CEH_RESTR | CEH_SCALAR, '_method' ], |
|
38
|
|
|
|
|
|
|
[ CEH_RESTR | CEH_SCALAR, '_url' ], |
|
39
|
|
|
|
|
|
|
); |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
##################################################################### |
|
42
|
|
|
|
|
|
|
# |
|
43
|
|
|
|
|
|
|
# Module code follows |
|
44
|
|
|
|
|
|
|
# |
|
45
|
|
|
|
|
|
|
##################################################################### |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub _initialize ($;@) { |
|
48
|
|
|
|
|
|
|
|
|
49
|
11
|
|
|
11
|
|
1436
|
my $obj = shift; |
|
50
|
11
|
|
|
|
|
21
|
my %args = @_; |
|
51
|
11
|
|
|
|
|
12
|
my $rv = 1; |
|
52
|
|
|
|
|
|
|
|
|
53
|
11
|
|
|
|
|
28
|
pdebug( "entering w/$obj and @{[ keys %args ]}", ICAPDEBUG1 ); |
|
|
11
|
|
|
|
|
38
|
|
|
54
|
11
|
|
|
|
|
92
|
pIn(); |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# Set internal state if args were passed |
|
57
|
11
|
100
|
|
|
|
76
|
$rv = $obj->method( $args{method} ) if exists $args{method}; |
|
58
|
11
|
100
|
66
|
|
|
30
|
$rv = $obj->url( $args{url} ) if exists $args{url} and $rv; |
|
59
|
|
|
|
|
|
|
|
|
60
|
11
|
|
|
|
|
24
|
pOut(); |
|
61
|
11
|
|
|
|
|
71
|
pdebug( "leaving w/rv: $rv", ICAPDEBUG1 ); |
|
62
|
|
|
|
|
|
|
|
|
63
|
11
|
|
|
|
|
96
|
return $rv; |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub _validHeaders ($) { |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
# Purpose: Returns a list of valid ICAP headers |
|
69
|
|
|
|
|
|
|
# Returns: Array |
|
70
|
|
|
|
|
|
|
# Usage: @val = $obj->_validHeaders; |
|
71
|
|
|
|
|
|
|
|
|
72
|
51
|
|
|
51
|
|
56
|
my $obj = shift; |
|
73
|
|
|
|
|
|
|
|
|
74
|
51
|
|
|
|
|
170
|
return ( qw(Host Authorization Allow From Referer User-Agent Preview), |
|
75
|
|
|
|
|
|
|
$obj->SUPER::_validHeaders ); |
|
76
|
|
|
|
|
|
|
} |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub method ($;$) { |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
# Purpose: Gets/sets method |
|
81
|
|
|
|
|
|
|
# Returns: Boolean/String |
|
82
|
|
|
|
|
|
|
# Usage: $rv = $obj->method($method); |
|
83
|
|
|
|
|
|
|
# Usage: $method = $obj->method; |
|
84
|
|
|
|
|
|
|
|
|
85
|
17
|
|
|
17
|
1
|
21
|
my $obj = shift; |
|
86
|
17
|
|
|
|
|
19
|
my $method = shift; |
|
87
|
17
|
100
|
|
|
|
32
|
my $m = defined $method ? $method : 'undef'; |
|
88
|
17
|
|
|
|
|
19
|
my ( $r, $rv ); |
|
89
|
|
|
|
|
|
|
|
|
90
|
17
|
|
|
|
|
48
|
pdebug( "entering w/$m", ICAPDEBUG1 ); |
|
91
|
17
|
|
|
|
|
137
|
pIn(); |
|
92
|
|
|
|
|
|
|
|
|
93
|
17
|
100
|
|
|
|
98
|
if ( defined $method ) { |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
# Write mode |
|
96
|
6
|
50
|
|
|
|
15
|
if ( grep { $_ eq $method } $obj->property('_valid_methods') ) { |
|
|
18
|
|
|
|
|
192
|
|
|
97
|
6
|
|
|
|
|
14
|
$rv = $obj->property( '_method', $method ); |
|
98
|
|
|
|
|
|
|
} else { |
|
99
|
0
|
|
|
|
|
0
|
$obj->error("invalid method passed: $method"); |
|
100
|
0
|
|
|
|
|
0
|
$rv = 0; |
|
101
|
|
|
|
|
|
|
} |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
} else { |
|
104
|
11
|
|
|
|
|
29
|
$rv = $obj->property('_method'); |
|
105
|
|
|
|
|
|
|
} |
|
106
|
|
|
|
|
|
|
|
|
107
|
17
|
50
|
|
|
|
563
|
$r = defined $rv ? $rv : 'undef'; |
|
108
|
17
|
|
|
|
|
35
|
pOut(); |
|
109
|
17
|
|
|
|
|
110
|
pdebug( "leaving w/rv: $r", ICAPDEBUG1 ); |
|
110
|
|
|
|
|
|
|
|
|
111
|
17
|
|
|
|
|
171
|
return $rv; |
|
112
|
|
|
|
|
|
|
} |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
sub url ($;$) { |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
# Purpose: Gets/sets URL |
|
117
|
|
|
|
|
|
|
# Returns: Boolean/String |
|
118
|
|
|
|
|
|
|
# Usage: $rv = $obj->url($url); |
|
119
|
|
|
|
|
|
|
# Usage: $method = $obj->url; |
|
120
|
|
|
|
|
|
|
|
|
121
|
23
|
|
|
23
|
1
|
32
|
my $obj = shift; |
|
122
|
23
|
|
|
|
|
24
|
my $url = shift; |
|
123
|
23
|
100
|
|
|
|
44
|
my $u = defined $url ? $url : 'undef'; |
|
124
|
23
|
|
|
|
|
25
|
my ( $r, $rv ); |
|
125
|
|
|
|
|
|
|
|
|
126
|
23
|
|
|
|
|
75
|
pdebug( "entering w/$u", ICAPDEBUG1 ); |
|
127
|
23
|
|
|
|
|
215
|
pIn(); |
|
128
|
|
|
|
|
|
|
|
|
129
|
23
|
100
|
|
|
|
130
|
if ( defined $url ) { |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
# Write mode |
|
132
|
6
|
|
|
|
|
18
|
$rv = $obj->property( '_url', $url ); |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
} else { |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
# Read mode |
|
137
|
17
|
|
|
|
|
73
|
$rv = $obj->property('_url'); |
|
138
|
|
|
|
|
|
|
} |
|
139
|
|
|
|
|
|
|
|
|
140
|
23
|
50
|
|
|
|
766
|
$r = defined $rv ? $rv : 'undef'; |
|
141
|
23
|
|
|
|
|
49
|
pOut(); |
|
142
|
23
|
|
|
|
|
162
|
pdebug( "leaving w/rv: $r", ICAPDEBUG1 ); |
|
143
|
|
|
|
|
|
|
|
|
144
|
23
|
|
|
|
|
247
|
return $rv; |
|
145
|
|
|
|
|
|
|
} |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
sub authority ($) { |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
# Purpose: Returns the authority section of the URL |
|
150
|
|
|
|
|
|
|
# Returns: String |
|
151
|
|
|
|
|
|
|
# Usage: $auth = $obj->authority; |
|
152
|
|
|
|
|
|
|
|
|
153
|
0
|
|
|
0
|
1
|
0
|
my $obj = shift; |
|
154
|
0
|
|
|
|
|
0
|
my $url = $obj->property('_url'); |
|
155
|
0
|
|
|
|
|
0
|
my ( $uri, $r, $rv ); |
|
156
|
|
|
|
|
|
|
|
|
157
|
0
|
|
|
|
|
0
|
pdebug( 'entering', ICAPDEBUG1 ); |
|
158
|
0
|
|
|
|
|
0
|
pIn(); |
|
159
|
|
|
|
|
|
|
|
|
160
|
0
|
0
|
0
|
|
|
0
|
if ( defined $url and length $url ) { |
|
161
|
0
|
|
|
|
|
0
|
$uri = URI->new($url); |
|
162
|
0
|
|
|
|
|
0
|
$rv = $uri->authority; |
|
163
|
|
|
|
|
|
|
} |
|
164
|
|
|
|
|
|
|
|
|
165
|
0
|
0
|
|
|
|
0
|
$r = defined $rv ? $rv : 'undef'; |
|
166
|
0
|
|
|
|
|
0
|
pOut(); |
|
167
|
0
|
|
|
|
|
0
|
pdebug( "leaving w/rv: $r", ICAPDEBUG1 ); |
|
168
|
|
|
|
|
|
|
|
|
169
|
0
|
|
|
|
|
0
|
return $rv; |
|
170
|
|
|
|
|
|
|
} |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
sub service ($) { |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
# Purpose: Returns the service section of the URL |
|
175
|
|
|
|
|
|
|
# Returns: String |
|
176
|
|
|
|
|
|
|
# Usage: $auth = $obj->service; |
|
177
|
|
|
|
|
|
|
|
|
178
|
0
|
|
|
0
|
1
|
0
|
my $obj = shift; |
|
179
|
0
|
|
|
|
|
0
|
my $url = $obj->property('_url'); |
|
180
|
0
|
|
|
|
|
0
|
my ( $uri, $r, $rv ); |
|
181
|
|
|
|
|
|
|
|
|
182
|
0
|
|
|
|
|
0
|
pdebug( 'entering', ICAPDEBUG1 ); |
|
183
|
0
|
|
|
|
|
0
|
pIn(); |
|
184
|
|
|
|
|
|
|
|
|
185
|
0
|
0
|
0
|
|
|
0
|
if ( defined $url and length $url ) { |
|
186
|
0
|
|
|
|
|
0
|
$uri = URI->new($url); |
|
187
|
0
|
|
|
|
|
0
|
$rv = $uri->path; |
|
188
|
|
|
|
|
|
|
} |
|
189
|
|
|
|
|
|
|
|
|
190
|
0
|
0
|
|
|
|
0
|
$r = defined $rv ? $rv : 'undef'; |
|
191
|
0
|
|
|
|
|
0
|
pOut(); |
|
192
|
0
|
|
|
|
|
0
|
pdebug( "leaving w/rv: $r", ICAPDEBUG1 ); |
|
193
|
|
|
|
|
|
|
|
|
194
|
0
|
|
|
|
|
0
|
return $rv; |
|
195
|
|
|
|
|
|
|
} |
|
196
|
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
sub query ($;$) { |
|
198
|
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
# Purpose: Returns the query section of the URL |
|
200
|
|
|
|
|
|
|
# Returns: String |
|
201
|
|
|
|
|
|
|
# Usage: $auth = $obj->query; |
|
202
|
|
|
|
|
|
|
# Usage: $auth = $obj->query($query_arg); |
|
203
|
|
|
|
|
|
|
|
|
204
|
0
|
|
|
0
|
1
|
0
|
my $obj = shift; |
|
205
|
0
|
|
|
|
|
0
|
my $qname = shift; |
|
206
|
0
|
|
|
|
|
0
|
my $url = $obj->property('_url'); |
|
207
|
0
|
|
|
|
|
0
|
my ( $uri, %q, $r, $rv ); |
|
208
|
|
|
|
|
|
|
|
|
209
|
0
|
|
|
|
|
0
|
pdebug( 'entering', ICAPDEBUG1 ); |
|
210
|
0
|
|
|
|
|
0
|
pIn(); |
|
211
|
|
|
|
|
|
|
|
|
212
|
0
|
0
|
0
|
|
|
0
|
if ( defined $url and length $url ) { |
|
213
|
0
|
|
|
|
|
0
|
$uri = URI->new($url); |
|
214
|
0
|
|
|
|
|
0
|
$rv = $uri->query; |
|
215
|
|
|
|
|
|
|
|
|
216
|
0
|
0
|
0
|
|
|
0
|
if ( defined $qname and length $qname ) { |
|
217
|
0
|
|
|
|
|
0
|
%q = $uri->query_form; |
|
218
|
0
|
|
|
|
|
0
|
$rv = $q{$qname}; |
|
219
|
|
|
|
|
|
|
} |
|
220
|
|
|
|
|
|
|
} |
|
221
|
|
|
|
|
|
|
|
|
222
|
0
|
0
|
|
|
|
0
|
$r = defined $rv ? $rv : 'undef'; |
|
223
|
0
|
|
|
|
|
0
|
pOut(); |
|
224
|
0
|
|
|
|
|
0
|
pdebug( "leaving w/rv: $r", ICAPDEBUG1 ); |
|
225
|
|
|
|
|
|
|
|
|
226
|
0
|
|
|
|
|
0
|
return $rv; |
|
227
|
|
|
|
|
|
|
} |
|
228
|
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
sub sanityCheck ($) { |
|
230
|
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
# Purpose: Checks for required information |
|
232
|
|
|
|
|
|
|
# Returns: Boolean |
|
233
|
|
|
|
|
|
|
# Usage: $rv = $obj->sanityCheck; |
|
234
|
|
|
|
|
|
|
|
|
235
|
11
|
|
|
11
|
1
|
13
|
my $obj = shift; |
|
236
|
11
|
|
|
|
|
13
|
my $rv = 1; |
|
237
|
11
|
|
|
|
|
10
|
my $t; |
|
238
|
|
|
|
|
|
|
|
|
239
|
11
|
|
|
|
|
26
|
$t = $obj->property('_method'); |
|
240
|
11
|
50
|
33
|
|
|
330
|
unless ( defined $t and length $t ) { |
|
241
|
0
|
|
|
|
|
0
|
$obj->error('missing a valid request method'); |
|
242
|
0
|
|
|
|
|
0
|
$rv = 0; |
|
243
|
|
|
|
|
|
|
} |
|
244
|
|
|
|
|
|
|
|
|
245
|
11
|
|
|
|
|
26
|
$t = $obj->property('_url'); |
|
246
|
11
|
50
|
33
|
|
|
324
|
unless ( defined $t and length $t ) { |
|
247
|
0
|
|
|
|
|
0
|
$obj->error('missing a valid request URL'); |
|
248
|
0
|
|
|
|
|
0
|
$rv = 0; |
|
249
|
|
|
|
|
|
|
} |
|
250
|
|
|
|
|
|
|
|
|
251
|
11
|
|
|
|
|
26
|
$t = $obj->property('_version'); |
|
252
|
11
|
50
|
33
|
|
|
349
|
unless ( defined $t and length $t ) { |
|
253
|
0
|
|
|
|
|
0
|
$obj->error('missing a valid ICAP protocol version'); |
|
254
|
0
|
|
|
|
|
0
|
$rv = 0; |
|
255
|
|
|
|
|
|
|
} |
|
256
|
|
|
|
|
|
|
|
|
257
|
11
|
|
|
|
|
30
|
$t = $obj->header('Host'); |
|
258
|
11
|
50
|
33
|
|
|
47
|
unless ( defined $t and length $t ) { |
|
259
|
0
|
|
|
|
|
0
|
$obj->error('missing mandatory Host header'); |
|
260
|
0
|
|
|
|
|
0
|
$rv = 0; |
|
261
|
|
|
|
|
|
|
} |
|
262
|
|
|
|
|
|
|
|
|
263
|
11
|
50
|
|
|
|
20
|
$obj->error('failed sanity check') unless $rv; |
|
264
|
11
|
50
|
|
|
|
29
|
$obj->error('failed sanity check') unless $rv; |
|
265
|
|
|
|
|
|
|
|
|
266
|
11
|
|
|
|
|
30
|
return $rv; |
|
267
|
|
|
|
|
|
|
} |
|
268
|
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
sub parse ($$) { |
|
270
|
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
# Purpose: Parses message from passed input |
|
272
|
|
|
|
|
|
|
# Returns: Boolean |
|
273
|
|
|
|
|
|
|
# Usage: $rv = $obj->parse($input); |
|
274
|
|
|
|
|
|
|
|
|
275
|
10
|
|
|
10
|
1
|
1305
|
my $obj = shift; |
|
276
|
10
|
|
|
|
|
13
|
my $input = shift; |
|
277
|
10
|
50
|
|
|
|
20
|
my $i = defined $input ? $input : 'undef'; |
|
278
|
10
|
|
|
|
|
11
|
my $rv = 0; |
|
279
|
10
|
|
|
|
|
9
|
my ( $line, $m, $u, $v ); |
|
280
|
|
|
|
|
|
|
|
|
281
|
10
|
|
|
|
|
47
|
pdebug( "entering w/$obj, $i", ICAPDEBUG1 ); |
|
282
|
10
|
|
|
|
|
82
|
pIn(); |
|
283
|
|
|
|
|
|
|
|
|
284
|
10
|
50
|
|
|
|
72
|
if ( defined $input ) { |
|
285
|
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
# Purge internal state |
|
287
|
10
|
|
|
|
|
34
|
$obj->property( '_method', undef ); |
|
288
|
10
|
|
|
|
|
455
|
$obj->property( '_url', undef ); |
|
289
|
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
# Parse |
|
291
|
10
|
|
|
|
|
390
|
$rv = $obj->SUPER::parse($input); |
|
292
|
|
|
|
|
|
|
|
|
293
|
10
|
100
|
|
|
|
32
|
if ($rv) { |
|
294
|
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
# Extract request specific fields |
|
296
|
5
|
|
|
|
|
13
|
$line = $obj->property('_start'); |
|
297
|
5
|
|
|
|
|
186
|
( $m, $u, $v ) = ( $line =~ /^(\S+)\s+(\S+)\s+(\S+)$/sm ); |
|
298
|
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
# Save the extracted information |
|
300
|
5
|
|
33
|
|
|
16
|
$rv = $obj->method($m) && $obj->url($u) && $obj->version($v); |
|
301
|
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
# Perform basic sanity checks |
|
303
|
5
|
50
|
|
|
|
24
|
$rv = $obj->sanityCheck if $rv; |
|
304
|
|
|
|
|
|
|
} |
|
305
|
|
|
|
|
|
|
} |
|
306
|
|
|
|
|
|
|
|
|
307
|
10
|
50
|
|
|
|
20
|
$rv = 0 unless defined $rv; |
|
308
|
|
|
|
|
|
|
|
|
309
|
10
|
|
|
|
|
24
|
pOut(); |
|
310
|
10
|
|
|
|
|
64
|
pdebug( "leaving w/rv: $rv", ICAPDEBUG1 ); |
|
311
|
|
|
|
|
|
|
|
|
312
|
10
|
|
|
|
|
112
|
return $rv; |
|
313
|
|
|
|
|
|
|
} |
|
314
|
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
sub generate ($$) { |
|
316
|
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
# Purpose: Generates an ICAP request |
|
318
|
|
|
|
|
|
|
# Returns: String |
|
319
|
|
|
|
|
|
|
# Usage: $request = $obj->generate($ref); |
|
320
|
|
|
|
|
|
|
|
|
321
|
6
|
|
|
6
|
1
|
307
|
my $obj = shift; |
|
322
|
6
|
|
|
|
|
7
|
my $out = shift; |
|
323
|
6
|
|
|
|
|
9
|
my ( $url, $host, $rv ); |
|
324
|
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
# Generate Host header from URL |
|
326
|
6
|
|
|
|
|
12
|
$url = $obj->url; |
|
327
|
6
|
50
|
|
|
|
18
|
if ( defined $url ) { |
|
328
|
6
|
|
|
|
|
25
|
($host) = ( $url =~ m#^icap://([^:/]+)#smi ); |
|
329
|
6
|
|
|
|
|
20
|
$obj->header( 'Host', $host ); |
|
330
|
|
|
|
|
|
|
} |
|
331
|
|
|
|
|
|
|
|
|
332
|
6
|
50
|
|
|
|
11
|
if ( $obj->sanityCheck ) { |
|
333
|
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
# Build start line |
|
335
|
6
|
|
|
|
|
14
|
$obj->property( '_start', join ' ', $obj->method, $obj->url, |
|
336
|
|
|
|
|
|
|
ICAP_VERSION ); |
|
337
|
6
|
|
|
|
|
259
|
$rv = $obj->SUPER::generate($out); |
|
338
|
|
|
|
|
|
|
} |
|
339
|
|
|
|
|
|
|
|
|
340
|
6
|
|
|
|
|
29
|
return $rv; |
|
341
|
|
|
|
|
|
|
} |
|
342
|
|
|
|
|
|
|
|
|
343
|
|
|
|
|
|
|
1; |
|
344
|
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
__END__ |