-3
如何通过ruby在rails上编写此代码?如何在RoR中编写此脚本
curl -k --cert path/cert.cer --key path/private.key -F "file=path/pkcs7.file" https://server.com/test > resp.txt
UPDATE: 我'用宝石路边,我的解决方案:
http = Curl.post("https://server.com/test", signed_data) do|http|
http.cert = "path/included_key.pem" # in linux: cat path/cert.cer path/private.key > path/included_key.pem, more info http://stackoverflow.com/questions/991758/how-to-get-an-openssl-pem-file-from-key-and-crt-files
http.certpassword = '198512' # is optional
http.headers["Content-Type"] = 'application/pkcs7-mime' # is optional, needs for me
http.ssl_verify_peer = false # is equal -k flag in curl
end
Rails.logger.info http.body_str
轨道是一个框架。你不能在rails中编码。你可能使用网络在ruby中编写代码:http library –
我写了这个脚本,你可以在主题 – vmamaev
中看到它的好处。所以你现在的问题是什么?如何将结果保存在文本文件中? –