Permalink
Browse files

Perform a case-insensitive check of the HTTPS URI scheme

  • Loading branch information...
1 parent 690ca6b commit cf77be5249890396a482728bc7fdaf1ed6bfddac @drbrain drbrain committed Apr 3, 2011
Showing with 23 additions and 2 deletions.
  1. +5 −0 History.txt
  2. +2 −2 lib/net/http/persistent.rb
  3. +16 −0 test/test_net_http_persistent.rb
View
@@ -1,3 +1,8 @@
+=== 1.7.1
+
+* Bug Fix
+ * Perform a case-insensitive check of the URI scheme for HTTPS URIs
+
=== 1.7 / 2011-03-29
* Minor Enhancement
@@ -42,7 +42,7 @@ class Net::HTTP::Persistent
##
# The version of Net::HTTP::Persistent use are using
- VERSION = '1.7'
+ VERSION = '1.7.1'
##
# Error class for errors raised by Net::HTTP::Persistent. Various
@@ -233,7 +233,7 @@ def connection_for uri
unless connection = connections[connection_id] then
connections[connection_id] = Net::HTTP.new(*net_http_args)
connection = connections[connection_id]
- ssl connection if uri.scheme == 'https'
+ ssl connection if uri.scheme.downcase == 'https'
end
unless connection.started? then
@@ -289,6 +289,22 @@ def test_connection_for_socket_options
assert_equal expected, socket.io.instance_variable_get(:@setsockopts)
end
+ def test_connection_for_ssl
+ uri = URI.parse 'https://example.com/path'
+ c = @http.connection_for uri
+
+ assert c.started?
+ assert c.use_ssl?
+ end
+
+ def test_connection_for_ssl_case
+ uri = URI.parse 'HTTPS://example.com/path'
+ c = @http.connection_for uri
+
+ assert c.started?
+ assert c.use_ssl?
+ end
+
def test_error_message
c = basic_connection
reqs[c.object_id] = 5

0 comments on commit cf77be5

Please sign in to comment.