in reply to How to only download first 200 bytes of an image ?

HTTP/1.1 (and maybe earlier) allow you to specify a Range header to specify which parts of the document you wish to download. The server may ignore the Range request and return the entire document. In that event, you could simply close the connection once you've received enough bytes.

Replies are listed 'Best First'.
Re^2: How to only download first 200 bytes of an image ?
by Joost (Canon) on Sep 13, 2007 at 20:31 UTC
    Note that if the image is small enough, you may be better off to just receive the whole image anyway, since closing and re-opening a connection may be slower than receiving a few hundred extra bytes (many modern HTTP implementations keep the connection open for consecutive requests by default, though I'm not sure if LWP::UserAgent does).

    To OP: check the content-length header.