summary |
shortlog |
log |
commit | commitdiff |
review |
tree
raw |
patch |
inline | side by side (from parent 1:
da0bcf1)
Prior to this commit, apt_key always sent auth basic header when source
came from http(s). This might fail for some webservers (e.g. Amazon S3)
when empty auth basic is sent.
Now apt_key only sends the auth basic header when userinfo can
be parsed from the URL.
- user_pass = parsedValue.userinfo.nil? ? nil : parsedValue.userinfo.split(':')
- parsedValue.userinfo = ''
- key = open(parsedValue, :http_basic_authentication => user_pass).read
+ # Only send basic auth if URL contains userinfo
+ # Some webservers (e.g. Amazon S3) return code 400 if empty basic auth is sent
+ if parsedValue.userinfo.nil?
+ key = parsedValue.read
+ else
+ user_pass = parsedValue.userinfo.split(':')
+ parsedValue.userinfo = ''
+ key = open(parsedValue, :http_basic_authentication => user_pass).read
+ end
rescue OpenURI::HTTPError, Net::FTPPermError => e
fail("#{e.message} for #{resource[:source]}")
rescue SocketError
rescue OpenURI::HTTPError, Net::FTPPermError => e
fail("#{e.message} for #{resource[:source]}")
rescue SocketError