… | |
… | |
129 | this is not an overall timeout. |
129 | this is not an overall timeout. |
130 | |
130 | |
131 | Default timeout is 5 minutes. |
131 | Default timeout is 5 minutes. |
132 | |
132 | |
133 | proxy => [$host, $port[, $scheme]] or undef |
133 | proxy => [$host, $port[, $scheme]] or undef |
134 | Use the given http proxy for all requests. If not specified, |
134 | Use the given http proxy for all requests, or no proxy if |
135 | then the default proxy (as specified by $ENV{http_proxy}) is |
|
|
136 | used. |
135 | "undef" is used. |
137 | |
136 | |
138 | $scheme must be either missing or must be "http" for HTTP. |
137 | $scheme must be either missing or must be "http" for HTTP. |
|
|
138 | |
|
|
139 | If not specified, then the default proxy is used (see |
|
|
140 | "AnyEvent::HTTP::set_proxy"). |
139 | |
141 | |
140 | body => $string |
142 | body => $string |
141 | The request body, usually empty. Will be sent as-is (future |
143 | The request body, usually empty. Will be sent as-is (future |
142 | versions of this module might offer more options). |
144 | versions of this module might offer more options). |
143 | |
145 | |
… | |
… | |
365 | AnyEvent::HTTP::set_proxy "proxy-url" |
367 | AnyEvent::HTTP::set_proxy "proxy-url" |
366 | Sets the default proxy server to use. The proxy-url must begin with |
368 | Sets the default proxy server to use. The proxy-url must begin with |
367 | a string of the form "http://host:port", croaks otherwise. |
369 | a string of the form "http://host:port", croaks otherwise. |
368 | |
370 | |
369 | To clear an already-set proxy, use "undef". |
371 | To clear an already-set proxy, use "undef". |
|
|
372 | |
|
|
373 | When AnyEvent::HTTP is laoded for the first time it will query the |
|
|
374 | default proxy from the operating system, currently by looking at |
|
|
375 | "$ENV{http_proxy"}. |
370 | |
376 | |
371 | AnyEvent::HTTP::cookie_jar_expire $jar[, $session_end] |
377 | AnyEvent::HTTP::cookie_jar_expire $jar[, $session_end] |
372 | Remove all cookies from the cookie jar that have been expired. If |
378 | Remove all cookies from the cookie jar that have been expired. If |
373 | $session_end is given and true, then additionally remove all session |
379 | $session_end is given and true, then additionally remove all session |
374 | cookies. |
380 | cookies. |
… | |
… | |
457 | This section contaisn some more elaborate "real-world" examples or code |
463 | This section contaisn some more elaborate "real-world" examples or code |
458 | snippets. |
464 | snippets. |
459 | |
465 | |
460 | HTTP/1.1 FILE DOWNLOAD |
466 | HTTP/1.1 FILE DOWNLOAD |
461 | Downloading files with HTTP can be quite tricky, especially when |
467 | Downloading files with HTTP can be quite tricky, especially when |
462 | something goes wrong and you want tor esume. |
468 | something goes wrong and you want to resume. |
463 | |
469 | |
464 | Here is a function that initiates and resumes a download. It uses the |
470 | Here is a function that initiates and resumes a download. It uses the |
465 | last modified time to check for file content changes, and works with |
471 | last modified time to check for file content changes, and works with |
466 | many HTTP/1.0 servers as well, and usually falls back to a complete |
472 | many HTTP/1.0 servers as well, and usually falls back to a complete |
467 | re-download on older servers. |
473 | re-download on older servers. |