Grokking Advanced Go
Vote

0% completed

​

Server and Client Timeouts

How long will an http.Server wait for a client that opens a connection and then sends one byte per minute? How long will an http.Client wait for a server that accepts a request and never answers? The next program reads the defaults, and the zeros in its output are the answer.

Output:

ReadHeaderTimeout: 0s ReadTimeout: 0s WriteTimeout: 0s IdleTimeout: 0s DefaultClient.Timeout: 0s ResponseHeaderTimeout: 0s TLSHandshakeTimeout: 10s IdleConnTimeout: 1m30s

A zero timeout in net/http means no limit. The function `http.ListenAndServe

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content