… | |
… | |
46 | use AnyEvent::Util (); |
46 | use AnyEvent::Util (); |
47 | use AnyEvent::Handle (); |
47 | use AnyEvent::Handle (); |
48 | |
48 | |
49 | use base Exporter::; |
49 | use base Exporter::; |
50 | |
50 | |
51 | our $VERSION = 2.2; |
51 | our $VERSION = 2.21; |
52 | |
52 | |
53 | our @EXPORT = qw(http_get http_post http_head http_request); |
53 | our @EXPORT = qw(http_get http_post http_head http_request); |
54 | |
54 | |
55 | our $USERAGENT = "Mozilla/5.0 (compatible; U; AnyEvent-HTTP/$VERSION; +http://software.schmorp.de/pkg/AnyEvent)"; |
55 | our $USERAGENT = "Mozilla/5.0 (compatible; U; AnyEvent-HTTP/$VERSION; +http://software.schmorp.de/pkg/AnyEvent)"; |
56 | our $MAX_RECURSE = 10; |
56 | our $MAX_RECURSE = 10; |
… | |
… | |
846 | # send request |
846 | # send request |
847 | $hdl->push_write ( |
847 | $hdl->push_write ( |
848 | "$method $rpath HTTP/1.1\015\012" |
848 | "$method $rpath HTTP/1.1\015\012" |
849 | . (join "", map "\u$_: $hdr{$_}\015\012", grep defined $hdr{$_}, keys %hdr) |
849 | . (join "", map "\u$_: $hdr{$_}\015\012", grep defined $hdr{$_}, keys %hdr) |
850 | . "\015\012" |
850 | . "\015\012" |
851 | . (delete $arg{body}) |
851 | . $arg{body} |
852 | ); |
852 | ); |
853 | |
853 | |
854 | # return if error occurred during push_write() |
854 | # return if error occurred during push_write() |
855 | return unless %state; |
855 | return unless %state; |
856 | |
856 | |