aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2016-05-08 16:14:50 +0900
committerKazuki Yamaguchi <k@rhe.jp>2016-05-08 16:14:50 +0900
commit622e71b515e34393dc8be072f464bbe75cea9566 (patch)
treeb58bebc16074dcc9836f53fd741809e4bcd8bb90
parent91986110370ba6d53a67376dda36c7e7efd9494e (diff)
downloadplum-topic/openssl-1.1.0.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.rb8
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)