lib/rmega/net.rb in rmega-0.2.7 vs lib/rmega/net.rb in rmega-0.3.1
- old
+ new
@@ -31,24 +31,20 @@
uri = URI(url)
req = ::Net::HTTP::Post.new(uri.request_uri)
req.body = data
logger.debug("REQ POST #{url} #{cut_string(data)}")
- # if you don't use Net::Http#start it will not keep the socket open even if you set
- # the connection header BUT setting the connection header to 'keep-alive' its enough
- # to fool MEGA servers and don't let them reset your connection!
req['Connection'] = 'keep-alive'
response = net_http(uri).request(req)
logger.debug("REP #{response.code} #{cut_string(response.body)}")
return response
end
private
def net_http(uri)
- http = ::Net::HTTP.new(uri.host, uri.port)
- http.use_ssl = true if uri.scheme == 'https'
+ http = Rmega::ConnPool.get(uri)
# apply common http options
http.proxy_from_env = false if options.http_proxy_address
options.marshal_dump.each do |name, value|
\ No newline at end of file