My old app was working well after compiling with b4a 11.0. But after recompile this app with b4a 11.5 or b4a 11.8, mya app can't upload file to s3 server. I use class aws_s3 version 1.7
sending file:
If s3Map.IsInitialized Then
If CurFileName.Contains(".mp4") Or CurFileName.Contains("Answers") Then
FileToSend=CurFileName
Log("s3:" & CurFileName)
Dim s3Set As Map
Dim wfidPos As Int=CurFileName.IndexOf("-")
Dim wfidStr As String=""
If wfidPos>0 Then
wfidStr=CurFileName.SubString2(0, wfidPos)
s3Set=s3Map.Get(wfidStr)
Else
ToastMessageShow("wrong filename",False)
End If
Dim s3 As AWS_S3
s3.Initialize
s3.AWS_URI_Is_Path_Style = True
s3.AWS_Region = "ru-1"
s3.AWS_Access_Key_ID = s3Set.Get("USER")
s3.AWS_Secret_Access_Key = s3Set.Get("KEY")
s3.AWS_End_Point = s3Set.Get("HOST")
s3.AWS_S3_Bucket_Name = s3Set.Get("BUCKET")
s3.AWS_S3_File_Name = wfidStr & "/" & CurFileName
s3.AWS_S3_HttpMethod = "PUT"
s3.AWS_S3_Query_map.Initialize
s3.AWS_S3_Query_map.Clear
'************************************************************************************
Private wrk_in As InputStream
wrk_in = File.OpenInput(File.DirInternal,CurFileName)
Private wrk_out As OutputStream
wrk_out.InitializeToBytesArray(1000)
File.Copy2(wrk_in, wrk_out)
wrk_in.Close
wrk_out.Close
s3.AWS_S3_Payload = wrk_out.ToBytesArray
s3.AWS_S3_OtherHeader_map.Initialize
s3.AWS_S3_OtherHeader_map.Clear
s3.AWS_S3_OtherHeader_map.Put("Content-Type", "application/x-www-form-urlencoded")
s3.AWS_S3_OtherHeader_map.Put("Content-Length", NumberFormat2(s3.AWS_S3_Payload.Length, 1, 0, 0, False))
s3.AWS_S3_OtherHeader_map.Put("x-amz-meta-author", "me")
s3.AWS_S3_OtherHeader_map.Put("Expect", "100-continue")
'Set up httpjob
AWS_job.Initialize("AWS_job", Me)
AWS_job.PutBytes(s3.URI, s3.AWS_S3_Payload)
'Retrieve full header map
Private wk_hdr_map As Map
wk_hdr_map.Initialize
wk_hdr_map = s3.FullHeaderMap
Private wrk_ptr As Int
For wrk_ptr = 0 To wk_hdr_map.Size - 1
'If not host header...
If wk_hdr_map.GetKeyAt(wrk_ptr) <> "host" Then
'Add it to httpjob
AWS_job.GetRequest.SetHeader(wk_hdr_map.GetKeyAt(wrk_ptr), wk_hdr_map.GetValueAt(wrk_ptr))
End If
Next
AWS_job.GetRequest.SetHeader("Authorization", s3.Authorization)
End If
There i have timeout error:
Case "AWS_job"
If Job.Success = True Then
SentFileCount=SentFileCount+1
ToastMessageShow("Sent " & SentFileCount & " backed files",False)
If FileToSend.Contains(".mp4") Then
File.Delete(File.DirInternal,FileToSend)
CallSubDelayed(Me,"FindAndSendFile")
End If
Else
Log("Error: " & Job.ErrorMessage)
End If
ResponseError. Reason: java.net.SocketTimeoutException: timeout, Response: Error: java.net.SocketTimeoutException: timeout