/plushcap/analysis/cloudflare/the-complete-guide-to-golang-net-http-timeouts

The complete guide to Go net/http timeouts

What's this blog post about?

This article discusses timeouts when writing an HTTP server or client in Go. It explains the concept of Deadlines and how they can be used to implement timeouts on both the server and client side. The author also covers server timeouts, including ReadTimeout and WriteTimeout, as well as client-side timeouts such as Timeout field of http.Client, net.Dialer.Timeout, http.Transport.TLSHandshakeTimeout, and others. Additionally, it touches on how to cancel a request using Request.Cancel or Context in Go 1.7. The article emphasizes the importance of setting timeouts to prevent resource leaks and getting stuck during network operations.

Company
Cloudflare

Date published
June 29, 2016

Author(s)
Filippo Valsorda

Word count
1552

Hacker News points
None found.

Language
English


By Matt Makai. 2021-2024.