From: BurnZeZ@feline.systems
To: 9front@9front.org
Subject: hget HEAD change 9fronthg:4a780de821ac
Date: Mon, 15 Oct 2018 09:36:01 +0000 [thread overview]
Message-ID: <c1d0743bb39517be452f6a0d2fd39baf@rebk.znet> (raw)
This change should be a good thing, but in the non-standards compliant
real world, many web servers return errors on HEAD requests, or even a
different contentlength than when sending GET.
I think the real problem with hget is that we may rely on the exit
string in order to determine if the file download was completed. I
wrote my own hget alternative when experimenting with this.
term% fhget -h
usage: fhget [-H header] [-Rtu] file url
By making the output file path explicit, I am able to do,
f=$1
tf=$f.part
If $f already exists, fhget exits with an error.
Otherwise, all it reads from webfs is written to $tf until completion.
Knowing the value of contentlength, if there is some failure but the
size of $tf still ended up matching contentlength (for example, the
entire file was received, but webfs propogates a read error from
/net/tcp/n/data due to packet loss), it can ignore the read error and
perform 'mv $tf $f'. In this way, $f never exists unless the entire
file is believed to have been obtained.
If contentlength is unknown, $tf is moved to $f only when the GET
request is performed without error. If there is an error, $tf is left
as is. If we run fhget with the same args, fhget will request the
entire range starting from whatever the size of $tf is.
I’ve made use of this method since January 2016, and it seems to work,
but I may have overlooked something.
reply other threads:[~2018-10-15 9:36 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c1d0743bb39517be452f6a0d2fd39baf@rebk.znet \
--to=burnzez@feline.systems \
--cc=9front@9front.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).