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

Re: Getting the last 1 kb of a file

Thread Previous
From:
Octavian Rasnita
Date:
February 15, 2003 19:54
Subject:
Re: Getting the last 1 kb of a file
Message ID:
01cf01c2d56f$aec90150$c26fe9d5@microsoft.com
Thank you!

I've seen that "range" parameter.
Can I read more about it?

I am wondering if I could say that I want to read from byte 1024 to byte
2048... or other ranges.

Teddy,
Teddy's Center: http://teddy.fcc.ro/
Email: orasnita@home.ro

----- Original Message -----
From: "Gisle Aas" <gisle@ActiveState.com>
To: "Octavian Rasnita" <orasnita@home.ro>
Cc: <libwww@perl.org>
Sent: Saturday, February 15, 2003 11:06 PM
Subject: Re: Getting the last 1 kb of a file


"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


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