diff --git a/ChangeLog b/ChangeLog index 118796df9b..6d5239646c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Tue Jul 29 03:53:28 2003 GOTOU Yuuzou + + * ext/openssl/lib/net/https.rb (use_ssl=): raise ProtocolError if + connection is set up already. + Mon Jul 28 23:23:08 2003 Nobuyoshi Nakada * file.c (Init_File): IO should include File::Const. diff --git a/ext/openssl/lib/net/https.rb b/ext/openssl/lib/net/https.rb index 0f5cb13407..fb7f53c555 100644 --- a/ext/openssl/lib/net/https.rb +++ b/ext/openssl/lib/net/https.rb @@ -137,7 +137,7 @@ module Net SSLIO end - attr_accessor :use_ssl + attr_reader :use_ssl attr_writer :key, :cert attr_writer :ca_file, :ca_path attr_writer :verify_mode, :verify_callback, :verify_depth @@ -150,6 +150,14 @@ module Net default_initialize(*args) @key = @cert = @ca_file = @ca_path = @verify_mode = @verify_callback = @verify_depth = @timeout = @cert_store = nil + @already_connected = false + end + + def use_ssl=(flag) + if @already_connected && !@use_ssl + raise ProtocolError, "connection is alrady set up" + end + @use_ssl = flag end def on_connect @@ -173,6 +181,7 @@ module Net @socket.ssl_connect @peer_cert = @socket.peer_cert end + @already_connected = true end end