--- AnyEvent-HTTP/README 2011/01/18 17:50:20 1.18 +++ AnyEvent-HTTP/README 2012/11/14 22:22:24 1.24 @@ -108,7 +108,8 @@ recurse => $count (default: $MAX_RECURSE) Whether to recurse requests or not, e.g. on redirects, - authentication retries and so on, and how often to do so. + authentication and other retries and so on, and how often to do + so. headers => hashref The request headers to use. Currently, "http_request" may @@ -123,6 +124,9 @@ if the default AnyEvent string gets blocked by webservers sooner or later. + Also, make sure that your headers names and values do not + contain any embedded newlines. + timeout => $seconds The time-out to use for various stages - each connect attempt will reset the timeout, as will read or write activity, i.e. @@ -131,12 +135,14 @@ Default timeout is 5 minutes. proxy => [$host, $port[, $scheme]] or undef - Use the given http proxy for all requests. If not specified, - then the default proxy (as specified by $ENV{http_proxy}) is - used. + Use the given http proxy for all requests, or no proxy if + "undef" is used. $scheme must be either missing or must be "http" for HTTP. + If not specified, then the default proxy is used (see + "AnyEvent::HTTP::set_proxy"). + body => $string The request body, usually empty. Will be sent as-is (future versions of this module might offer more options). @@ -333,7 +339,7 @@ timeout of 30 seconds. http_request - GET => "https://www.google.com", + HEAD => "https://www.google.com", headers => { "user-agent" => "MySearchClient 1.0" }, timeout => 30, sub { @@ -368,6 +374,10 @@ To clear an already-set proxy, use "undef". + When AnyEvent::HTTP is laoded for the first time it will query the + default proxy from the operating system, currently by looking at + "$ENV{http_proxy"}. + AnyEvent::HTTP::cookie_jar_expire $jar[, $session_end] Remove all cookies from the cookie jar that have been expired. If $session_end is given and true, then additionally remove all session @@ -421,7 +431,7 @@ The default value for the "recurse" request parameter (default: 10). $AnyEvent::HTTP::TIMEOUT - The default timeout for conenction operations (default: 300). + The default timeout for connection operations (default: 300). $AnyEvent::HTTP::USERAGENT The default value for the "User-Agent" header (the default is @@ -459,7 +469,7 @@ HTTP/1.1 FILE DOWNLOAD Downloading files with HTTP can be quite tricky, especially when - something goes wrong and you want tor esume. + something goes wrong and you want to resume. Here is a function that initiates and resumes a download. It uses the last modified time to check for file content changes, and works with @@ -485,7 +495,7 @@ warn -s _; if (stat $fh and -s _) { $ofs = -s _; - warn "-s is ", $ofs;#d# + warn "-s is ", $ofs; $hdr{"if-unmodified-since"} = AnyEvent::HTTP::format_date +(stat _)[9]; $hdr{"range"} = "bytes=$ofs-"; }