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

Comparing AnyEvent-HTTP/HTTP.pm (file contents):
Revision 1.51 by root, Fri Aug 14 15:21:33 2009 UTC vs.
Revision 1.52 by root, Sat Sep 26 10:13:12 2009 UTC

745=over 4 745=over 4
746 746
747=item AnyEvent::HTTP::set_proxy "proxy-url" 747=item AnyEvent::HTTP::set_proxy "proxy-url"
748 748
749Sets the default proxy server to use. The proxy-url must begin with a 749Sets the default proxy server to use. The proxy-url must begin with a
750string of the form C<http://host:port> (optionally C<https:...>). 750string of the form C<http://host:port> (optionally C<https:...>), croaks
751otherwise.
752
753To clear an already-set proxy, use C<undef>.
751 754
752=item $AnyEvent::HTTP::MAX_RECURSE 755=item $AnyEvent::HTTP::MAX_RECURSE
753 756
754The default value for the C<recurse> request parameter (default: C<10>). 757The default value for the C<recurse> request parameter (default: C<10>).
755 758
776=back 779=back
777 780
778=cut 781=cut
779 782
780sub set_proxy($) { 783sub set_proxy($) {
784 if (length $_[0]) {
781 $PROXY = [$2, $3 || 3128, $1] if $_[0] =~ m%^(https?):// ([^:/]+) (?: : (\d*) )?%ix; 785 $_[0] =~ m%^(https?):// ([^:/]+) (?: : (\d*) )?%ix
786 or Carp::croak "$_[0]: invalid proxy URL";
787 $PROXY = [$2, $3 || 3128, $1]
788 } else {
789 undef $PROXY;
790 }
782} 791}
783 792
784# initialise proxy from environment 793# initialise proxy from environment
794eval {
785set_proxy $ENV{http_proxy}; 795 set_proxy $ENV{http_proxy};
796};
786 797
787=head1 SEE ALSO 798=head1 SEE ALSO
788 799
789L<AnyEvent>. 800L<AnyEvent>.
790 801

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines