Skip to content

Commit

Permalink
Authenticate repository detection calls if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
felixsch committed Dec 28, 2023
1 parent 5e77736 commit 6d3afc2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/rmt/mirror.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,15 @@ def detect_repository_type
}

search.each do |key, url|
request = RMT::HttpRequest.new(url, method: :head, followlocation: true)
# Current CDN authenticates via a key append to the request path
# e.g.
# https://update.suse.com/SUSE/product/some-product
# becomes
# https://update.suse.com/SUSE/product/some-product?authenication_tokensiduhashasdyashdaysdasud
uri = URI.join(url)
uri.query = @repository.auth_token if @repository.auth_token

request = RMT::HttpRequest.new(uri, method: :head, followlocation: true)
request.on_success do
return key
end
Expand Down

0 comments on commit 6d3afc2

Please sign in to comment.