develooper Front page | perl.libwww | Postings from February 2003

Re: Getting the last 1 kb of a file

Thread Previous | Thread Next
From:
Gisle Aas
Date:
February 15, 2003 13:08
Subject:
Re: Getting the last 1 kb of a file
Message ID:
lrwuk1p83g.fsf@caliper.activestate.com
"Octavian Rasnita" <orasnita@home.ro> writes:

> Please tell me how to get the last 1 kb of the file avoiding to download all
> the file.
> 
> I've read the POD documentation for LWP::UserAgent, but I couldn't find
> anything helpful.

You need to read the HTTP spec[1] or some other source decribing the HTTP protocol.
This should work on servers that implement it:

   my $res = $ua->get("http://....",
                      Range => "bytes=-1024",
                     );

[1] http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35.1

> Thank you very much.

Your welcome!

Regards,
Gisle

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About