xh segfaults on download
I'm trying to set this up on my Kindle Keyboard running a 3.4.3 (recently jailbroken).
Running from your latest release v1.0.0-beta.4.
From the kindle, if I try to use xh -o outfile url I get a Segmentation Fault. I believe I've tried it will all the options you use in your example download script in local. I can run 'xh --help` and the binary does run, it just fails when I try to download. I can see if there is a verbose option that might help, but what is your source for xh? I wonder if there are other / newer / different versions that might be more compatible with my older device.
I wrote a small python script to verify I CAN download PNGs, at least from a local server via http. Maybe your 'xh' isn't compatible with Kindle 3.x devices? If I get this all running, I can share my python download script to possibly replace xh which is likely a bit more cross-device compatible.
I also encountered issues using xh; this was related to certificates and on a Kindle K4 though. It looks like someone managed to get this project working on a Kindle Keyboard before.
If you are fine with using HTTP, perhaps you could use curl instead? Below is a snippet I am using for a similar project:
curl --silent --show-error --fail --globoff \
--user-agent "$KINDLE_ID" \
--request POST \
--user "${SERVER_USERNAME}:${SERVER_PASSWORD}" \
--output "$filename" \
"$url"