16
16
You can get it from RAA or Ruby's CVS repository.
19
$Id: https.rb 11708 2007-02-12 23:01:19Z shyouhei $
19
$Id: https.rb 14371 2007-12-20 16:21:22Z gotoyuzo $
21
21
2001-11-06: Contiributed to Ruby/OpenSSL project.
22
22
2004-03-06: Some code is merged in to net/http.
102
102
require 'openssl'
107
106
remove_method :use_ssl?
112
alias use_ssl use_ssl? # for backward compatibility
114
111
# Turn on/off SSL.
115
112
# This flag must be set before starting session.
116
113
# If you change use_ssl value after session started,
117
114
# a Net::HTTP object raises IOError.
118
115
def use_ssl=(flag)
119
116
flag = (flag ? true : false)
120
raise IOError, "use_ssl value changed, but session already started" \
121
if started? and @use_ssl != flag
122
if flag and not @ssl_context
123
@ssl_context = OpenSSL::SSL::SSLContext.new
117
if started? and @use_ssl != flag
118
raise IOError, "use_ssl value changed, but session already started"
128
def self.ssl_context_accessor(name)
129
module_eval(<<-End, __FILE__, __LINE__ + 1)
131
return nil unless @ssl_context
136
@ssl_context ||= OpenSSL::SSL::SSLContext.new
137
@ssl_context.#{name} = val
142
ssl_context_accessor :key
143
ssl_context_accessor :cert
144
ssl_context_accessor :ca_file
145
ssl_context_accessor :ca_path
146
ssl_context_accessor :verify_mode
147
ssl_context_accessor :verify_callback
148
ssl_context_accessor :verify_depth
149
ssl_context_accessor :cert_store
152
return nil unless @ssl_context
156
def ssl_timeout=(sec)
157
raise ArgumentError, 'Net::HTTP#ssl_timeout= called but use_ssl=false' \
159
@ssl_context ||= OpenSSL::SSL::SSLContext.new
160
@ssl_context.timeout = sec
163
alias timeout= ssl_timeout= # for backward compatibility
124
ssl_version key cert ca_file ca_path cert_store ciphers
125
verify_mode verify_callback verify_depth ssl_timeout
127
attr_accessor *SSL_ATTRIBUTES
166
return nil if not use_ssl? or not @socket
130
if not use_ssl? or not @socket
167
133
@socket.io.peer_cert