The complete guide to Go net/http timeouts
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