don't rely on exception for http 416
authorJoey Hess <joeyh@joeyh.name>
Thu, 19 Nov 2020 18:03:00 +0000 (14:03 -0400)
committerJoey Hess <joeyh@joeyh.name>
Thu, 19 Nov 2020 18:44:42 +0000 (14:44 -0400)
commitb90b9b936d17d59050263467e8e4590bf56508f0
tree004af0ce90fe51356aaba5ea61eb842eba7a94a9
parent3991c8e43d1191a367d1894d8a0591a68daed571
don't rely on exception for http 416

Fix a bug that could make resuming a download from the web fail when the
entire content of the file is actually already present locally.

What a mess that Request can throw exceptions or not, depending on how
it's configured. Makes it very hard if you need to handle some specific
http status codes in a function like this! Implementing everything two
ways did not seem appealing, if possible at all, so I decided to
override the Request if it did come configured to throw exception on
non-2xx http status. Other exceptions, like from http-client-restricted,
or due to a redirect to a non-http url, still get thrown.

This commit was sponsored by Luke Shumaker on Patreon.
CHANGELOG
Utility/Url.hs
doc/bugs/download_failed__58___Requested_Range_Not_Satisfiable.mdwn
doc/bugs/download_failed__58___Requested_Range_Not_Satisfiable/comment_1_44bc0678a9978b62ab133d64d3614610._comment [new file with mode: 0644]