Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Jun : Re: Page reading from given offset
| Subject: | Re: Page reading from given offset |
| Posted by: | "Remy Lebeau (TeamB)" (no.spam@no.spam.com) |
| Date: | Thu, 22 Jun 2006 09:43:13 |
"Michael" <lab51@introscopy.tpu.ru> wrote in message
news:449a5447@newsgroups.borland.com...
> Hello. There is the page from which I want to read data. I need only
> five bytes to be read from this page. Can I read only these five bytes
> (from given offset), without readings whole page (for example, with
> IdHttp.Get method)?
If the server supports both HTTP v1.1 and byte ranges, then yes. Otherwise
no.
In TIdHTTP, make sure the ProtocolVersion property is set to pv1_1, and then
set the Request.ContentRangeStart/End properties accordingly, before you
call Get(). If the request returns the data, the
Response.ContentRangeStart/End properties will indicate the actual range of
bytes that were returned. If they are both 0, then the full data was
returned instead of a range. Also, the server will include an
'Accept-Range' header for any response if byte ranges are supported for the
requested resource. You can use Head() (don't set the ContentRangeStart/End
properties for this request) to determine whether byte ranges are supported
before then using Get() to download the data according.
Gambit
none