Do not make connections persistent by default

This commit is contained in:
Marcel Molina 2008-06-06 03:36:58 -05:00
Родитель e715329dc2
Коммит d6471ec40c
2 изменённых файлов: 7 добавлений и 7 удалений

Просмотреть файл

@ -49,7 +49,7 @@ module AWS
else else
http.start(&requester) http.start(&requester)
end end
rescue Errno::EPIPE, Timeout::Error, Errno::EPIPE, Errno::EINVAL rescue Errno::EPIPE, Timeout::Error, Errno::EINVAL
@http = create_connection @http = create_connection
attempts == 3 ? raise : (attempts += 1; retry) attempts == 3 ? raise : (attempts += 1; retry)
end end
@ -178,7 +178,7 @@ module AWS
# will be implicitly set to 443, unless specified otherwise. Defaults to false. # will be implicitly set to 443, unless specified otherwise. Defaults to false.
# * <tt>:persistent</tt> - Whether to use a persistent connection to the server. Having this on provides around a two fold # * <tt>:persistent</tt> - Whether to use a persistent connection to the server. Having this on provides around a two fold
# performance increase but for long running processes some firewalls may find the long lived connection suspicious and close the connection. # performance increase but for long running processes some firewalls may find the long lived connection suspicious and close the connection.
# If you run into connection errors, try setting <tt>:persistent</tt> to false. Defaults to true. # If you run into connection errors, try setting <tt>:persistent</tt> to false. Defaults to false.
# * <tt>:proxy</tt> - If you need to connect through a proxy, you can specify your proxy settings by specifying a <tt>:host</tt>, <tt>:port</tt>, <tt>:user</tt>, and <tt>:password</tt> # * <tt>:proxy</tt> - If you need to connect through a proxy, you can specify your proxy settings by specifying a <tt>:host</tt>, <tt>:port</tt>, <tt>:user</tt>, and <tt>:password</tt>
# with the <tt>:proxy</tt> option. # with the <tt>:proxy</tt> option.
# The <tt>:host</tt> setting is required if specifying a <tt>:proxy</tt>. # The <tt>:host</tt> setting is required if specifying a <tt>:proxy</tt>.
@ -278,7 +278,7 @@ module AWS
end end
def extract_persistent! def extract_persistent!
self[:persistent] = options.has_key?(:persitent) ? options[:persitent] : true self[:persistent] = options.has_key?(:persitent) ? options[:persitent] : false
end end
def extract_proxy_settings! def extract_proxy_settings!

Просмотреть файл

@ -27,12 +27,12 @@ class ConnectionTest < Test::Unit::TestCase
assert_equal 'https://', connection.protocol assert_equal 'https://', connection.protocol
end end
def test_connection_is_persistent_by_default def test_connection_is_not_persistent_by_default
connection = Connection.new(@keys) connection = Connection.new(@keys)
assert connection.persistent?
connection = Connection.new(@keys.merge(:persistent => false))
assert !connection.persistent? assert !connection.persistent?
connection = Connection.new(@keys.merge(:persistent => true))
assert connection.persistent?
end end
def test_server_and_port_are_passed_onto_connection def test_server_and_port_are_passed_onto_connection