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.45 by root, Fri Jul 17 16:56:36 2009 UTC vs.
Revision 1.46 by root, Sat Jul 25 01:29:09 2009 UTC

48use AnyEvent::Socket (); 48use AnyEvent::Socket ();
49use AnyEvent::Handle (); 49use AnyEvent::Handle ();
50 50
51use base Exporter::; 51use base Exporter::;
52 52
53our $VERSION = '1.4'; 53our $VERSION = '1.41';
54 54
55our @EXPORT = qw(http_get http_post http_head http_request); 55our @EXPORT = qw(http_get http_post http_head http_request);
56 56
57our $USERAGENT = "Mozilla/5.0 (compatible; U; AnyEvent-HTTP/$VERSION; +http://software.schmorp.de/pkg/AnyEvent)"; 57our $USERAGENT = "Mozilla/5.0 (compatible; U; AnyEvent-HTTP/$VERSION; +http://software.schmorp.de/pkg/AnyEvent)";
58our $MAX_RECURSE = 10; 58our $MAX_RECURSE = 10;
312 push @{ $CO_SLOT{$_[0]}[1] }, $_[1]; 312 push @{ $CO_SLOT{$_[0]}[1] }, $_[1];
313 313
314 _slot_schedule $_[0]; 314 _slot_schedule $_[0];
315} 315}
316 316
317our $qr_nl = qr<\015?\012>; 317our $qr_nl = qr{\015?\012};
318our $qr_nlnl = qr<\015?\012\015?\012>; 318our $qr_nlnl = qr{(?<![^\012])\015?\012};
319 319
320our $TLS_CTX_LOW = { cache => 1, sslv2 => 1 }; 320our $TLS_CTX_LOW = { cache => 1, sslv2 => 1 };
321our $TLS_CTX_HIGH = { cache => 1, verify => 1, verify_peername => "https" }; 321our $TLS_CTX_HIGH = { cache => 1, verify => 1, verify_peername => "https" };
322 322
323sub http_request($$@) { 323sub http_request($$@) {
491 URL => ",$url" 491 URL => ",$url"
492 ); 492 );
493 493
494 # headers, could be optimized a bit 494 # headers, could be optimized a bit
495 $state{handle}->unshift_read (line => $qr_nlnl, sub { 495 $state{handle}->unshift_read (line => $qr_nlnl, sub {
496 for ("$_[1]\012") { 496 for ("$_[1]") {
497 y/\015//d; # weed out any \015, as they show up in the weirdest of places. 497 y/\015//d; # weed out any \015, as they show up in the weirdest of places.
498 498
499 # things seen, not parsed: 499 # things seen, not parsed:
500 # p3pP="NON CUR OTPi OUR NOR UNI" 500 # p3pP="NON CUR OTPi OUR NOR UNI"
501 501

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines