Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

120
Vistas
Timeout when using HttpCompletionOption.ResponseHeadersRead?

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:

  • the timeout of the client.GetAsync call is 5s (because of client.Timeout = TimeSpan.FromSeconds(5))? and because HttpCompletionOption.ResponseHeadersRead is used, client.GetAsync is successfully completed once the headers are downloaded
  • the stream processing is not affected by the client.Timeout = TimeSpan.FromSeconds(5) configuration
  • stream processing does not have a timeout / time limit (on the client side at least). so even for a very large file (say 1GB), it would theoretically be ok for the stream processing to take many minutes

Thanks.

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?

over 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda