Wondering if anyone could help me in understanding timeouts when HttpCompletionOption.ResponseHeadersRead is used. Given the code below:
using (HttpClient client = new HttpClient())
{
client.Timeout = TimeSpan.FromSeconds(5);
const string url = "https://url";
using (HttpResponseMessage response = await client.GetAsync(url, HttpCompletionOption.ResponseHeadersRead))
using (Stream stream = await response.Content.ReadAsStreamAsync())
{
... do some processing on stream ...
}
}
Is my understanding correct that:
client.Timeout = TimeSpan.FromSeconds(5))? and because HttpCompletionOption.ResponseHeadersRead is used, client.GetAsync is successfully completed once the headers are downloadedclient.Timeout = TimeSpan.FromSeconds(5) configurationThanks.
Sorry, one other related question, say the stream processing consisted of a CopyTo call:
await stream.CopyToAsync(destStream);
Does the default CopyToAsync call above (no cancellation token) have any sort of time restriction?