… | |
… | |
48 | use AnyEvent::Socket (); |
48 | use AnyEvent::Socket (); |
49 | use AnyEvent::Handle (); |
49 | use AnyEvent::Handle (); |
50 | |
50 | |
51 | use base Exporter::; |
51 | use base Exporter::; |
52 | |
52 | |
53 | our $VERSION = '1.05'; |
53 | our $VERSION = '1.1'; |
54 | |
54 | |
55 | our @EXPORT = qw(http_get http_post http_head http_request); |
55 | our @EXPORT = qw(http_get http_post http_head http_request); |
56 | |
56 | |
57 | our $USERAGENT = "Mozilla/5.0 (compatible; AnyEvent::HTTP/$VERSION; +http://software.schmorp.de/pkg/AnyEvent)"; |
57 | our $USERAGENT = "Mozilla/5.0 (compatible; AnyEvent::HTTP/$VERSION; +http://software.schmorp.de/pkg/AnyEvent)"; |
58 | our $MAX_RECURSE = 10; |
58 | our $MAX_RECURSE = 10; |
… | |
… | |
426 | |
426 | |
427 | substr $_, 0, 1, "" |
427 | substr $_, 0, 1, "" |
428 | for values %hdr; |
428 | for values %hdr; |
429 | |
429 | |
430 | my $finish = sub { |
430 | my $finish = sub { |
431 | # TODO: use destroy method, when/if available |
|
|
432 | #$state{handle}->destroy; |
431 | $state{handle}->destroy; |
433 | $state{handle}->on_eof (undef); |
|
|
434 | $state{handle}->on_error (undef); |
|
|
435 | %state = (); |
432 | %state = (); |
436 | |
433 | |
437 | # set-cookie processing |
434 | # set-cookie processing |
438 | if ($arg{cookie_jar}) { |
435 | if ($arg{cookie_jar}) { |
439 | for ($hdr{"set-cookie"}) { |
436 | for ($hdr{"set-cookie"}) { |