77
74
MaxLineLength: Initial max_line_length attribute value
78
75
MaxHeaderLines: Initial max_header_lines attribute value
77
The C<Host> option is also the default for C<IO::Socket::INET>'s
78
C<PeerAddr>. The C<PeerPort> defaults to 80 if not provided.
80
The C<Listen> option provided by C<IO::Socket::INET>'s constructor
81
method is not allowed.
83
If unable to connect to the given HTTP server then the constructor
84
returns C<undef> and $@ contains the reason. After a successful
85
connect, a C<Net:HTTP> object is returned.
82
89
Get/set the default value of the C<Host> header to send. The $host
147
158
Returns true if successful.
149
=item $s->format_chunk($data)
151
Returns the string to be written for the given chunk of data.
153
=item $s->write_chunk_eof(%trailers)
160
=item $s->format_chunk_eof( %trailers )
162
Returns the string to be written for signaling EOF when a
163
C<Transfer-Encoding> of C<chunked> is used.
165
=item $s->write_chunk_eof( %trailers )
155
167
Will write eof marker for chunked data and optional trailers. Note
156
168
that trailers should not really be used unless is was signaled
159
171
Returns true if successful.
161
=item $s->format_chunk_eof(%trailers)
163
Returns the string to be written for signaling EOF.
165
173
=item ($code, $mess, %headers) = $s->read_response_headers( %opts )
167
Read response headers from server. The $code is the 3 digit HTTP
168
status code (see L<HTTP::Status>) and $mess is the textual message
169
that came with it. Headers are then returned as key/value pairs.
170
Since key letter casing is not normalized and the same key can occur
171
multiple times, assigning these values directly to a hash might be
175
Read response headers from server and return it. The $code is the 3
176
digit HTTP status code (see L<HTTP::Status>) and $mess is the textual
177
message that came with it. Headers are then returned as key/value
178
pairs. Since key letter casing is not normalized and the same key can
179
even occur multiple times, assigning these values directly to a hash
180
is not wise. Only the $code is returned if this method is called in
174
183
As a side effect this method updates the 'peer_http_version'
177
The method will raise exceptions (die) if the server does not speak
180
186
Options might be passed in as key/value pairs. There are currently
181
187
only two options supported; C<laxed> and C<junk_out>.
183
The C<laxed> option will make C<read_response_headers> more forgiving
189
The C<laxed> option will make read_response_headers() more forgiving
184
190
towards servers that have not learned how to speak HTTP properly. The
185
<laxed> option is a boolean flag, and is enabled by passing in a TRUE
191
C<laxed> option is a boolean flag, and is enabled by passing in a TRUE
186
192
value. The C<junk_out> option can be used to capture bad header lines
187
193
when C<laxed> is enabled. The value should be an array reference.
188
194
Bad header lines will be pushed onto the array.
196
The C<laxed> option must be specified in order to communicate with
197
pre-HTTP/1.0 servers that don't describe the response outcome or the
198
data they send back with a header block. For these servers
199
peer_http_version is set to "0.9" and this method returns (200,
202
The method will raise an exception (die) if the server does not speak
203
proper HTTP or if the C<max_line_length> or C<max_header_length>
204
limits are reached. If the C<laxed> option is turned on and
205
C<max_line_length> and C<max_header_length> checks are turned off,
206
then no exception will be raised and this method will always
207
return a response code.
190
209
=item $n = $s->read_entity_body($buf, $size);
192
211
Reads chunks of the entity body content. Basically the same interface
193
as for read() and sysread(), but buffer offset is not supported yet.
194
This method should only be called after a successful
212
as for read() and sysread(), but the buffer offset argument is not
213
supported yet. This method should only be called after a successful
195
214
read_response_headers() call.
197
The return value will be C<undef> on errors, 0 on EOF, -1 if no data
198
could be returned this time, and otherwise the number of bytes added
216
The return value will be C<undef> on read errors, 0 on EOF, -1 if no data
217
could be returned this time, otherwise the number of bytes assigned
218
to $buf. The $buf set to "" when the return value is -1.
201
This method might raise exceptions (die) if the server does not speak
220
This method will raise exceptions (die) if the server does not speak
221
proper HTTP. This can only happen when reading chunked data.
204
223
=item %headers = $s->get_trailers