From: Eric Wong Date: 2018-01-10T19:26:22+00:00 Subject: [ruby-core:84822] Re: [Ruby trunk Bug#14349] Net::HTTP doesn't reuse connections when used via ::new rohitpaulk@gmail.com wrote: > From [Net::HTTP's docs](http://ruby-doc.org/stdlib-2.5.0/libdoc/net/http/rdoc/Net/HTTP.html#class-Net::HTTP-label-How+to+use+Net-3A-3AHTTP): > > If you wish to re-use a connection across multiple HTTP > > requests without automatically closing it you can use ::new > > instead of ::start. request will automatically open a > > connection to the server if one is not currently open. You > > can manually close the connection with finish. I guess this is a documentation bug and it should mention #start along with ::new. Perhaps you can help reword this? > I've attached a patch that I think solves the issue. With the > patch, sockets will still get closed after single requests > through methods like `Net::HTTP.get`, since they use the block > form for `start`. What Jeremy said; this may cause unintended resource exhaustion on the client side. It may not be a big problem on the C Ruby GC; but it may be on other VMs. Unsubscribe: