やり方
trusterd.conf.rbを編集する。
callbackをtrueにしてHTTP2サーバーを生成する。
s = HTTP2::Server.new({
:port => 8080,
:document_root => "#{root_dir}/htdocs",
:server_name => SERVER_DESCRIPTION,
:worker => "auto",
:key => "#{root_dir}/ssl/key.pem",
:crt => "#{root_dir}/ssl/cert.pem",
:callback => true,
})
callbackの設定
s.set_map_to_strage_cb {
if s.request.uri == "/py_exec"
# PyCall.py_exec("print('Hello,This is trusterd!')")
puts "test!"
# 表示はindex.html
s.request.filename = "#{root_dir}/htdocs/index.html"
end
試す
ChromeやFirefoxで
https://127.0.0.1:8080/py_exec