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.14 by root, Thu Jun 5 17:29:01 2008 UTC vs.
Revision 1.15 by elmex, Fri Jun 6 10:12:44 2008 UTC

44use AnyEvent::Socket (); 44use AnyEvent::Socket ();
45use AnyEvent::Handle (); 45use AnyEvent::Handle ();
46 46
47use base Exporter::; 47use base Exporter::;
48 48
49our $VERSION = '1.0'; 49our $VERSION = '1.1';
50 50
51our @EXPORT = qw(http_get http_request); 51our @EXPORT = qw(http_get http_request);
52 52
53our $USERAGENT = "Mozilla/5.0 (compatible; AnyEvent::HTTP/$VERSION; +http://software.schmorp.de/pkg/AnyEvent)"; 53our $USERAGENT = "Mozilla/5.0 (compatible; AnyEvent::HTTP/$VERSION; +http://software.schmorp.de/pkg/AnyEvent)";
54our $MAX_RECURSE = 10; 54our $MAX_RECURSE = 10;
214 push @{ $CO_SLOT{$_[0]}[1] }, $_[1]; 214 push @{ $CO_SLOT{$_[0]}[1] }, $_[1];
215 215
216 _slot_schedule $_[0]; 216 _slot_schedule $_[0];
217} 217}
218 218
219sub http_request($$$;@) { 219sub http_request($$@) {
220 my $cb = pop; 220 my $cb = pop;
221 my ($method, $url, %arg) = @_; 221 my ($method, $url, %arg) = @_;
222 222
223 my %hdr; 223 my %hdr;
224 224
447 }; 447 };
448 448
449 defined wantarray && AnyEvent::Util::guard { %state = () } 449 defined wantarray && AnyEvent::Util::guard { %state = () }
450} 450}
451 451
452sub http_get($$;@) { 452sub http_get($@) {
453 unshift @_, "GET"; 453 unshift @_, "GET";
454 &http_request 454 &http_request
455} 455}
456 456
457sub http_head($$;@) { 457sub http_head($@) {
458 unshift @_, "HEAD"; 458 unshift @_, "HEAD";
459 &http_request 459 &http_request
460} 460}
461 461
462sub http_post($$$;@) { 462sub http_post($$@) {
463 unshift @_, "POST", "body"; 463 unshift @_, "POST", "body";
464 &http_request 464 &http_request
465} 465}
466 466
467=back 467=back

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines