Does net/http have connection pool?

6,492 views
Skip to first unread message

Boris Solovyov

unread,
Feb 6, 2013, 9:54:13 PM2/6/13
to golang-nuts
Hi,

Does net/http package pool and reuse connections? In my clients, I see the program hold http connections open to a server even when I have called Response.Body.Close(). If there is no pool (I cannot find one) then maybe I have a bug and I am not closing all.

Feng Shen

unread,
Feb 6, 2013, 10:20:17 PM2/6/13
to golan...@googlegroups.com

Patrick Mylund Nielsen

unread,
Feb 6, 2013, 10:20:31 PM2/6/13
to Boris Solovyov, golang-nuts
It does indeed. See http.Transport and its methods: http://golang.org/pkg/net/http/#Transport


On Thu, Feb 7, 2013 at 3:54 AM, Boris Solovyov <boris.s...@gmail.com> wrote:
Hi,

Does net/http package pool and reuse connections? In my clients, I see the program hold http connections open to a server even when I have called Response.Body.Close(). If there is no pool (I cannot find one) then maybe I have a bug and I am not closing all.

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Boris Solovyov

unread,
Feb 6, 2013, 10:27:27 PM2/6/13
to golang-nuts
Thanks! This seems like major feature of net/http that users should know about, but is buried in obscure docs, "Transport can also cache connections for future re-use." Can package maintainers add short sentence like that to main net/http docs please?
Reply all
Reply to author
Forward
Message has been deleted
Message has been deleted
0 new messages