--- AnyEvent-HTTP/HTTP.pm 2011/01/24 20:03:24 1.98 +++ AnyEvent-HTTP/HTTP.pm 2011/02/19 06:46:14 1.102 @@ -48,7 +48,7 @@ use base Exporter::; -our $VERSION = '2.03'; +our $VERSION = '2.04'; our @EXPORT = qw(http_get http_post http_head http_request); @@ -181,11 +181,14 @@ =item proxy => [$host, $port[, $scheme]] or undef -Use the given http proxy for all requests. If not specified, then the -default proxy (as specified by C<$ENV{http_proxy}>) is used. +Use the given http proxy for all requests, or no proxy if C is +used. C<$scheme> must be either missing or must be C for HTTP. +If not specified, then the default proxy is used (see +C). + =item body => $string The request body, usually empty. Will be sent as-is (future versions of @@ -531,7 +534,7 @@ \G\s* (?: expires \s*=\s* ([A-Z][a-z][a-z]+,\ [^,;]+) - | ([^=;,[:space:]]+) (?: \s*=\s* (?: "((?:[^\\"]+|\\.)*)" | ([^=;,[:space:]]*) ) )? + | ([^=;,[:space:]]+) (?: \s*=\s* (?: "((?:[^\\"]+|\\.)*)" | ([^;,[:space:]]*) ) )? ) }gcxsi ) { @@ -711,11 +714,11 @@ return $cb->(undef, { @pseudo, Status => 599, Reason => "Too many redirections" }) if $recurse < 0; - my $proxy = $arg{proxy} || $PROXY; + my $proxy = exists $arg{proxy} ? $arg{proxy} : $PROXY; my $timeout = $arg{timeout} || $TIMEOUT; my ($uscheme, $uauthority, $upath, $query, undef) = # ignore fragment - $url =~ m|(?:([^:/?#]+):)?(?://([^/?#]*))?([^?#]*)(?:(\?[^#]*))?(?:#(.*))?|; + $url =~ m|^([^:]+):(?://([^/?#]*))?([^?#]*)(?:(\?[^#]*))?(?:#(.*))?$|; $uscheme = lc $uscheme; @@ -1174,6 +1177,10 @@ To clear an already-set proxy, use C. +When AnyEvent::HTTP is laoded for the first time it will query the +default proxy from the operating system, currently by looking at +C<$ENV{http_proxy>}. + =item AnyEvent::HTTP::cookie_jar_expire $jar[, $session_end] Remove all cookies from the cookie jar that have been expired. If