Re: how can I protect big big pages ?
Gabe Beged-Dov (begeddov@jfinity.com)
Thu, 15 Apr 1999 07:14:58 -0700
Marc Langheinrich wrote:require LWP::UserAgent;
> $ua = new LWP::UserAgent;
> $ua->max_size(100);
> $request = new HTTP::Request('GET', 'http://localhost/very_large.tar.gz');
>
> $response = $ua->request($request);
> print $response->as_string;
> __END__
>
> This prints the following:
> ...
> X-Content-Range: bytes 0-3802/1315945
>
> [Content follows]
From looking at the source (which can be dangerous as opposed to actually
trying something :-) it looks like max_size is a client side assertion and is
not communicated to the server. The "X-Content-Range" header is added to the
response by LWP.
HTTP explicitly supports partial GET requests via the Range header. It has
quite a few alternate ways to specify the byte range. If you wanted to just
see the first 1K of the page you could add a header like so:
Range: bytes=0-1024
You need to add the range header to your request object explicitly, i.e.
$request->header('Range' => 'bytes=0-1024');
Gabe Beged-Dov
www.jfinity.com