pusher/pusher-http-ruby

Cluster should only override default if non-nil

gorner opened this issue · 3 comments

https://github.com/pusher/pusher-http-ruby/blob/master/lib/pusher/client.rb#L38:

if options.has_key?(:host)
  merged_options[:host] = options[:host]
elsif options.has_key?(:cluster)
  merged_options[:host] = "api-#{options[:cluster]}.pusher.com"
else
  merged_options[:host] = "api.pusherapp.com"
end

The result of this is if an app attempts to pull a cluster from a config but it was not set (i.e. if it's a local config file that hasn't been updated yet), the app will attempt to make requests to api-.pusher.com.

The elsif should instead check that options[:cluster] is non-nil before using it.

stale commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you'd like this issue to stay open please leave a comment indicating how this issue is affecting you. Thank you.

Sorry about that, I just enabled stalebot, but I am looking into this issue.

This was fixed in #170 and released as part of the latest release, 2.0.0.