Land #8634, Ensure HTTP client sends a Host header if it is passed with a request

bug/bundler_fix
Brent Cook 2017-06-30 11:03:58 -04:00
commit 658b79414b
No known key found for this signature in database
GPG Key ID: 1FFAA0B24B708F96
1 changed files with 4 additions and 1 deletions

View File

@ -173,7 +173,10 @@ class ClientRequest
req << set_version
# Set a default Host header if one wasn't passed in
unless opts['headers'] && opts['headers'].keys.map { |x| x.downcase }.include?('host')
if opts['headers'] && opts['headers'].keys.map(&:downcase).include?('host')
host = opts['headers'].keys.each { |k| break opts['headers'][k] if k =~ /host/i }
req << set_formatted_header('Host', host)
else
req << set_host_header
end