lib/cc/cli/version_checker.rb in codeclimate-0.70.6 vs lib/cc/cli/version_checker.rb in codeclimate-0.71.0
- old
+ new
@@ -64,14 +64,16 @@
@http_response ||=
begin
uri = URI.parse(ENV.fetch("CODECLIMATE_VERSIONS_URL", DEFAULT_VERSIONS_URL))
uri.query = { version: version, uid: global_config.uuid }.to_query
- request = Net::HTTP::Get.new(uri, "User-Agent" => user_agent)
+ http = Net::HTTP.new(uri.host, uri.port)
+ http.open_timeout = 5
+ http.read_timeout = 5
+ http.ssl_timeout = 5
+ http.use_ssl = uri.scheme == "https"
- Net::HTTP.start(uri.host, uri.port, open_timeout: 5, read_timeout: 5, ssl_timeout: 5, use_ssl: uri.scheme == "https") do |http|
- http.request(request)
- end
+ http.get(uri, "User-Agent" => user_agent)
end
end
def cache!(data)
global_cache.latest_version = data["latest"]