diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2016-05-08 16:14:50 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2016-05-08 16:14:50 +0900 |
commit | 622e71b515e34393dc8be072f464bbe75cea9566 (patch) | |
tree | b58bebc16074dcc9836f53fd741809e4bcd8bb90 | |
parent | 91986110370ba6d53a67376dda36c7e7efd9494e (diff) | |
download | plum-622e71b515e34393dc8be072f464bbe75cea9566.tar.gz |
examples/static_server: call ctx.tmp_ecdh_callback only when neededtopic/openssl-1.1.0
Same as the previous commit.
-rw-r--r-- | examples/static_server.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/examples/static_server.rb b/examples/static_server.rb index e468b7e..a56cffa 100644 --- a/examples/static_server.rb +++ b/examples/static_server.rb @@ -26,9 +26,11 @@ ctx.alpn_select_cb = -> protocols { raise "Client does not support HTTP/2: #{protocols}" unless protocols.include?("h2") "h2" } -ctx.tmp_ecdh_callback = -> (sock, ise, keyl) { - OpenSSL::PKey::EC.new("prime256v1") -} +if ctx.respond_to?(:tmp_ecdh_callback) && !ctx.respond_to?(:set_ecdh_curves) + ctx.tmp_ecdh_callback = -> (sock, ise, keyl) { + OpenSSL::PKey::EC.new("prime256v1") + } +end ctx.cert = OpenSSL::X509::Certificate.new File.read(".crt.local") ctx.key = OpenSSL::PKey::RSA.new File.read(".key.local") tcp_server = TCPServer.new("0.0.0.0", 40443) |