On Mon, 2009-06-22 at 01:00 -0400, Amit Misra wrote: > I am trying to use the 'range' option in curl to get only the first 8k > bytes or a file from a web server. > It does not seeem to work. Do I need some kind of server support to do > this?
The server certainly does need to cooperate in order for the Range: header to work. Per HTTP/1.1, servers are allowed to ignore the Range header and just deliver the full content, although more or less all of the commonly-used http servers will respect Range when it's feasible to do so (static files on disk, for example). What server are you observing this to not work with, and can you post a trace of the HTTP protocol exchange? Anyway, if you want the first 8kB specifically then you can just close the connection once you've read the amount of data you want. (It would still be a good idea to send the Range header as well, so as not to waste the server's resources, but from your point of view it wouldn't be necessary.) p.
