Skip to content

Commit

Permalink
Merge pull request #17 from rightscale/release4.3_gw
Browse files Browse the repository at this point in the history
Diff in Right_Http_connection
  • Loading branch information
danielrife committed Feb 7, 2013
2 parents 972f53d + c03daef commit faeac34
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions lib/right_http_connection.rb
Expand Up @@ -409,6 +409,11 @@ def start(request_params)
=end
def request(request_params, &block)
# Re-establish the connection if any of auth params has changed
same_auth_params_as_before = [:cert, :key, :cert_file, :key_file, :ca_file].select do |param|
request_params[param] != get_param(param)
end.empty?

current_params = @params.merge(request_params)
exception = get_param(:exception, current_params) || RuntimeError

Expand All @@ -417,9 +422,10 @@ def request(request_params, &block)
loop do
current_params[:protocol] ||= (current_params[:port] == 443 ? 'https' : 'http')
# (re)open connection to server if none exists or params has changed
same_server_as_before = @server == current_params[:server] &&
@port == current_params[:port] &&
@protocol == current_params[:protocol]
same_server_as_before = @server == current_params[:server] &&
@port == current_params[:port] &&
@protocol == current_params[:protocol] &&
same_auth_params_as_before

# if we are inside a delay between retries: no requests this time!
# (skip this step if the endpoint has changed)
Expand All @@ -443,6 +449,7 @@ def request(request_params, &block)
@http.started? &&
same_server_as_before
start(current_params)
same_auth_params_as_before = true
end

# Detect if the body is a streamable object like a file or socket. If so, stream that
Expand Down

0 comments on commit faeac34

Please sign in to comment.