Server.downloadFile with signed Amazon S3 URL
-
I'm trying to download a signed Amazon S3 URL using
Server.downloadFile(), but the request always fails. The same URL downloads correctly in the browser, so it seems an issue on HISE. The link is extremely long because it contains X-Amz-Security-Token, X-Amz-Date, X-Amz-SignedHeaders, X-Amz-Signature, etc. -
@bendurso I'm guessing that link doesn't go directly to a file but redirects and maybe that is causing the issue.
-
@d-healey The link is the final one. But your comment led me to think the link was different, so I checked it and realized that the download link in Chrome transforms the " into %22 and the spaces into %20.
I can replace the spaces. But how do I transform the " into %22?
Because this doesnt workString.replace(""", "%22");update: ohh, like this:
String.replace("\"", "%22");Now the link is identical.. but still doesnt work :(
-
@bendurso The link contains 1359 characters. Maybe that could be the issue? Is there max limit for the link length?
-
@bendurso said in Server.downloadFile with signed Amazon S3 URL:
The link contains 1359 characters. Maybe that could be the issue? Is there max limit for the link length?
Could be, I'm not sure. I believe HISE is using cURL to do the download so you can test that by running it manually in a terminal.
-
@d-healey Thanks, yes it works with curl in terminal.
In HISE, I'm clearing the HttpHeader before starting the download, as I read in the forum, and I'm making sure not to repeat the base URL (just using https://).
It works with links from other servers, but it doesn’t seem to work with signed S3 URLs.
-
@bendurso Does it work in a private browser session?
-
@d-healey yeap :)
-
@bendurso I'm stumped then... You could use cURL directly from in HISE by calling it as a process - @aaronventure posted about this a while back I think.
-
@David-Healey Thanks. It worked with cURL as a background process. I read that if the user has a Windows version prior to 2019 wont work. Should I use powershell for Windows for better compatibility right?
-
@bendurso said in Server.downloadFile with signed Amazon S3 URL:
Thanks. It worked with cURL as a background process.
I'd really like to know why it doesn't work with the standard downloadFile call.
@bendurso said in Server.downloadFile with signed Amazon S3 URL:
Should I use powershell for Windows for better compatibility right?
I don't know, I think powershell needs permissions doesn't it?