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.94 by root, Tue Jan 11 23:49:37 2011 UTC vs.
Revision 1.96 by root, Tue Jan 18 09:33:35 2011 UTC

46use AnyEvent::Util (); 46use AnyEvent::Util ();
47use AnyEvent::Handle (); 47use AnyEvent::Handle ();
48 48
49use base Exporter::; 49use base Exporter::;
50 50
51our $VERSION = '2.01'; 51our $VERSION = '2.02';
52 52
53our @EXPORT = qw(http_get http_post http_head http_request); 53our @EXPORT = qw(http_get http_post http_head http_request);
54 54
55our $USERAGENT = "Mozilla/5.0 (compatible; U; AnyEvent-HTTP/$VERSION; +http://software.schmorp.de/pkg/AnyEvent)"; 55our $USERAGENT = "Mozilla/5.0 (compatible; U; AnyEvent-HTTP/$VERSION; +http://software.schmorp.de/pkg/AnyEvent)";
56our $MAX_RECURSE = 10; 56our $MAX_RECURSE = 10;
546 # quoted 546 # quoted
547 $value = $3; 547 $value = $3;
548 $value =~ s/\\(.)/$1/gs; 548 $value =~ s/\\(.)/$1/gs;
549 } 549 }
550 550
551 push @kv, lc $name, $value; 551 push @kv, @kv ? lc $name : $name, $value;
552 552
553 last unless /\G\s*;/gc; 553 last unless /\G\s*;/gc;
554 } 554 }
555 555
556 last unless @kv; 556 last unless @kv;
1332This section contaisn some more elaborate "real-world" examples or code 1332This section contaisn some more elaborate "real-world" examples or code
1333snippets. 1333snippets.
1334 1334
1335=head2 HTTP/1.1 FILE DOWNLOAD 1335=head2 HTTP/1.1 FILE DOWNLOAD
1336 1336
1337Downloading files with HTTP cna be quite tricky, especially when something 1337Downloading files with HTTP can be quite tricky, especially when something
1338goes wrong and you want tor esume. 1338goes wrong and you want tor esume.
1339 1339
1340Here is a function that initiates and resumes a download. It uses the 1340Here is a function that initiates and resumes a download. It uses the
1341last modified time to check for file content changes, and works with many 1341last modified time to check for file content changes, and works with many
1342HTTP/1.0 servers as well, and usually falls back to a complete re-download 1342HTTP/1.0 servers as well, and usually falls back to a complete re-download

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines