I am working on a link checker, in general I can perform HEAD
requests, however some sites seem to disable this verb, so on failure I need to also perform a G
Couldn't you use a WebClient to open a stream and read just the few bytes you require?
using (var client = new WebClient())
{
using (var stream = client.OpenRead(uri))
{
const int chunkSize = 100;
var buffer = new byte[chunkSize];
int bytesRead;
while ((bytesRead = stream.Read(buffer, 0, buffer.Length)) > 0)
{
//check response here
}
}
}
I am not sure how WebClient opens the stream internally. But it seems to allow partial reading of data.