ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent-HTTP/README
(Generate patch)

Comparing AnyEvent-HTTP/README (file contents):
Revision 1.27 by root, Sun Aug 28 09:31:29 2016 UTC vs.
Revision 1.28 by root, Mon Apr 27 12:14:12 2020 UTC

151 151
152 Currently, if your proxy requires authorization, you have to 152 Currently, if your proxy requires authorization, you have to
153 specify an appropriate "Proxy-Authorization" header in every 153 specify an appropriate "Proxy-Authorization" header in every
154 request. 154 request.
155 155
156 Note that this module will prefer an existing persistent
157 connection, even if that connection was made using another
158 proxy. If you need to ensure that a new connection is made in
159 this case, you can either force "persistent" to false or e.g.
160 use the proxy address in your "sessionid".
161
156 body => $string 162 body => $string
157 The request body, usually empty. Will be sent as-is (future 163 The request body, usually empty. Will be sent as-is (future
158 versions of this module might offer more options). 164 versions of this module might offer more options).
159 165
160 cookie_jar => $hash_ref 166 cookie_jar => $hash_ref
189 The default for this option is "low", which could be interpreted 195 The default for this option is "low", which could be interpreted
190 as "give me the page, no matter what". 196 as "give me the page, no matter what".
191 197
192 See also the "sessionid" parameter. 198 See also the "sessionid" parameter.
193 199
194 session => $string 200 sessionid => $string
195 The module might reuse connections to the same host internally. 201 The module might reuse connections to the same host internally
196 Sometimes (e.g. when using TLS), you do not want to reuse 202 (regardless of other settings, such as "tcp_connect" or
197 connections from other sessions. This can be achieved by setting 203 "proxy"). Sometimes (e.g. when using TLS or a specfic proxy),
198 this parameter to some unique ID (such as the address of an 204 you do not want to reuse connections from other sessions. This
199 object storing your state data, or the TLS context) - only 205 can be achieved by setting this parameter to some unique ID
200 connections using the same unique ID will be reused. 206 (such as the address of an object storing your state data or the
207 TLS context, or the proxy IP) - only connections using the same
208 unique ID will be reused.
201 209
202 on_prepare => $callback->($fh) 210 on_prepare => $callback->($fh)
203 In rare cases you need to "tune" the socket before it is used to 211 In rare cases you need to "tune" the socket before it is used to
204 connect (for example, to bind it on a given IP address). This 212 connect (for example, to bind it on a given IP address). This
205 parameter overrides the prepare callback passed to 213 parameter overrides the prepare callback passed to
214 AnyEvent::HTTP establishes connections. Normally it uses 222 AnyEvent::HTTP establishes connections. Normally it uses
215 AnyEvent::Socket::tcp_connect to do this, but you can provide 223 AnyEvent::Socket::tcp_connect to do this, but you can provide
216 your own "tcp_connect" function - obviously, it has to follow 224 your own "tcp_connect" function - obviously, it has to follow
217 the same calling conventions, except that it may always return a 225 the same calling conventions, except that it may always return a
218 connection guard object. 226 connection guard object.
227
228 The connections made by this hook will be treated as equivalent
229 to connections made the built-in way, specifically, they will be
230 put into and taken from the persistent connection cache. If your
231 $tcp_connect function is incompatible with this kind of re-use,
232 consider switching off "persistent" connections and/or providing
233 a "sessionid" identifier.
219 234
220 There are probably lots of weird uses for this function, 235 There are probably lots of weird uses for this function,
221 starting from tracing the hosts "http_request" actually tries to 236 starting from tracing the hosts "http_request" actually tries to
222 connect, to (inexact but fast) host => IP address caching or 237 connect, to (inexact but fast) host => IP address caching or
223 even socks protocol support. 238 even socks protocol support.
297 312
298 persistent => $boolean 313 persistent => $boolean
299 Try to create/reuse a persistent connection. When this flag is 314 Try to create/reuse a persistent connection. When this flag is
300 set (default: true for idempotent requests, false for all 315 set (default: true for idempotent requests, false for all
301 others), then "http_request" tries to re-use an existing 316 others), then "http_request" tries to re-use an existing
302 (previously-created) persistent connection to the host and, 317 (previously-created) persistent connection to same host (i.e.
318 identical URL scheme, hostname, port and sessionid) and, failing
303 failing that, tries to create a new one. 319 that, tries to create a new one.
304 320
305 Requests failing in certain ways will be automatically retried 321 Requests failing in certain ways will be automatically retried
306 once, which is dangerous for non-idempotent requests, which is 322 once, which is dangerous for non-idempotent requests, which is
307 why it defaults to off for them. The reason for this is because 323 why it defaults to off for them. The reason for this is because
308 the bozos who designed HTTP/1.1 made it impossible to 324 the bozos who designed HTTP/1.1 made it impossible to
309 distinguish between a fatal error and a normal connection 325 distinguish between a fatal error and a normal connection
310 timeout, so you never know whether there was a problem with your 326 timeout, so you never know whether there was a problem with your
311 request or not. 327 request or not.
312 328
313 When reusing an existent connection, many parameters (such as 329 When reusing an existent connection, many parameters (such as
314 TLS context) will be ignored. See the "session" parameter for a 330 TLS context) will be ignored. See the "sessionid" parameter for
315 workaround. 331 a workaround.
316 332
317 keepalive => $boolean 333 keepalive => $boolean
318 Only used when "persistent" is also true. This parameter decides 334 Only used when "persistent" is also true. This parameter decides
319 whether "http_request" tries to handshake a HTTP/1.0-style 335 whether "http_request" tries to handshake a HTTP/1.0-style
320 keep-alive connection (as opposed to only a HTTP/1.1 persistent 336 keep-alive connection (as opposed to only a HTTP/1.1 persistent
400 416
401 A cookie jar is initially an empty hash-reference that is managed by 417 A cookie jar is initially an empty hash-reference that is managed by
402 this module. Its format is subject to change, but currently it is as 418 this module. Its format is subject to change, but currently it is as
403 follows: 419 follows:
404 420
405 The key "version" has to contain 1, otherwise the hash gets emptied. 421 The key "version" has to contain 2, otherwise the hash gets cleared.
406 All other keys are hostnames or IP addresses pointing to 422 All other keys are hostnames or IP addresses pointing to
407 hash-references. The key for these inner hash references is the 423 hash-references. The key for these inner hash references is the
408 server path for which this cookie is meant, and the values are again 424 server path for which this cookie is meant, and the values are again
409 hash-references. Each key of those hash-references is a cookie name, 425 hash-references. Each key of those hash-references is a cookie name,
410 and the value, you guessed it, is another hash-reference, this time 426 and the value, you guessed it, is another hash-reference, this time
415 431
416 Here is an example of a cookie jar with a single cookie, so you have 432 Here is an example of a cookie jar with a single cookie, so you have
417 a chance of understanding the above paragraph: 433 a chance of understanding the above paragraph:
418 434
419 { 435 {
420 version => 1, 436 version => 2,
421 "10.0.0.1" => { 437 "10.0.0.1" => {
422 "/" => { 438 "/" => {
423 "mythweb_id" => { 439 "mythweb_id" => {
424 _expires => 1293917923, 440 _expires => 1293917923,
425 value => "ooRung9dThee3ooyXooM1Ohm", 441 value => "ooRung9dThee3ooyXooM1Ohm",

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines