Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Composer] Cache client-side timeouts when a remote host is unreachable #5400

Merged
merged 1 commit into from
Jul 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions composer/lib/dependabot/composer/metadata_finder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require "excon"
require "dependabot/metadata_finders"
require "dependabot/metadata_finders/base"
require "dependabot/shared_helpers"
require "dependabot/registry_client"
require "dependabot/composer/version"

module Dependabot
Expand Down Expand Up @@ -48,11 +48,7 @@ def look_up_source_from_packagist
def packagist_listing
return @packagist_listing unless @packagist_listing.nil?

response = Excon.get(
"https://packagist.org/p/#{dependency.name.downcase}.json",
idempotent: true,
**SharedHelpers.excon_defaults
)
response = Dependabot::RegistryClient.get(url: "https://packagist.org/p/#{dependency.name.downcase}.json")

return nil unless response.status == 200

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,12 @@ def registry_version_details
def fetch_registry_versions_from_url(url)
cred = registry_credentials.find { |c| url.include?(c["registry"]) }

response = Excon.get(
url,
idempotent: true,
user: cred&.fetch("username", nil),
password: cred&.fetch("password", nil),
**SharedHelpers.excon_defaults
response = Dependabot::RegistryClient.get(
url: url,
options: {
user: cred&.fetch("username", nil),
password: cred&.fetch("password", nil)
}
)

parse_registry_response(response, url)
Expand Down