summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorgotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-07-28 19:06:31 +0000
committergotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-07-28 19:06:31 +0000
commitea837fc6feab1b2f1b5400b79b87879aa160f42b (patch)
tree3d4eb433d72fe4c1d7704966ba6d28fe83bfc1c8 /ext
parente156194ce6ebdef607657d07ec8795acdbd4a52d (diff)
* ext/openssl/lib/net/https.rb (use_ssl=): raise ProtocolError if
connection is set up already. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4198 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/openssl/lib/net/https.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/ext/openssl/lib/net/https.rb b/ext/openssl/lib/net/https.rb
index 0f5cb13..fb7f53c 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