class Google::Cloud::Storage::File::SignerV4
def canonical_and_signed_headers headers, virtual_hosted_style, bucket_bound_hostname
def canonical_and_signed_headers headers, virtual_hosted_style, bucket_bound_hostname if virtual_hosted_style && bucket_bound_hostname raise "virtual_hosted_style: #{virtual_hosted_style} and bucket_bound_hostname: " \ "#{bucket_bound_hostname} params cannot both be passed together" end canonical_headers = headers || {} headers_arr = canonical_headers.map do |k, v| [k.downcase, v.strip.gsub(/[^\S\t]+/, " ").gsub(/\t+/, " ")] end canonical_headers = headers_arr.to_h canonical_headers["host"] = host_name virtual_hosted_style, bucket_bound_hostname canonical_headers = canonical_headers.sort_by(&:first).to_h canonical_headers_str = canonical_headers.map { |k, v| "#{k}:#{v}\n" }.join signed_headers_str = canonical_headers.keys.join ";" [canonical_headers_str, signed_headers_str] end