[英]Getting Connection reset by peer - SSL_connect error while uploading file to another app
Currently I have a rails application. 目前我有一个rails应用程序。 Now I have to implement functionality to upload a file to another application.
现在我必须实现将文件上传到另一个应用程序的功能。
The given application uses 3-legged oauth for security. 给定的应用程序使用3脚oauth来保证安全。 They have following architecture
他们有以下架构
I have able to create the FileID. 我能够创建FileID。 But while making PUT call (uploading file) getting the
Errno::ECONNRESET: Connection reset by peer - SSL_connect
error. 但是在进行PUT调用(上传文件)时,获取
Errno::ECONNRESET: Connection reset by peer - SSL_connect
错误。
So how can I upload the file in chunk. 那么如何以块的形式上传文件呢? Here is my sample code for uploading file.
这是我上传文件的示例代码。
file_data = File.open("/home/test/Downloads/RechargeReceipt.pdf") {|io| io.read}
file_data_64 = Base64.encode64(file_data)
access_token.put("/org/files/3156906966",
{ 'Content' => file_data_64 }.to_json,
{
'Accept' => 'application/vnd.axiom.v3+json',
'Content-Type' => 'application/octet-stream'
}
)
I am using rails 4. 我正在使用rails 4。
There is an issue while passing the body parameters. 传递body参数时出现问题。
data = File.read(params[:file].path)
access_token.put("/org/files/#{file_id}",
data,
{
'Accept' => JohnDeere::ACCEPT,
'Content-Type' => content_type
}
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.