gopencils icon indicating copy to clipboard operation
gopencils copied to clipboard

close connection after reading the body

Open ruseinov opened this issue 7 years ago • 0 comments

This closes the connection after reading from the body, otherwise too many open files error pops up when making a lot of requests.

http://craigwickesser.com/2015/01/golang-http-to-many-open-files/

You can also read the godoc that refers to Response.Close property for details:


	// Close records whether the header directed that the connection be
	// closed after reading Body. The value is advice for clients: neither
	// ReadResponse nor Response.Write ever closes a connection.
	Close bool

ruseinov avatar Jan 22 '18 09:01 ruseinov