Downloading from debian repos without Packages.xz file fails silently because the status line isn't checked (i.e. the current code ignores 404 or any other fatal code entirely)
debpkgindex.d calls downloadIfNecessary for remote roots. downloadIfNecessary iters xz,gz,bz2 to find a suitable Package.* file, it calls utils.d's downloadFile which in turn simply wraps download which is where the trouble is.
download calls HTTP.perform from std.net.curl, perform however seems to not care about the status code. From the documentation, and a casual look at curl.d, I'd say that when using perform one needs to set callback handlers for everything manually. e.g. https://github.com/dlang/phobos/blob/master/std/net/curl.d#L1075 is where .get and friends get their exception thrown, perform has no such convenience magic, and the docs for .get explicitly state that a statusexception may be raised.
Some printfdebugging seems to support that theory. Setting a status line callback in download
Downloading from debian repos without Packages.xz file fails silently because the status line isn't checked (i.e. the current code ignores 404 or any other fatal code entirely)
debpkgindex.d calls
downloadIfNecessaryfor remote roots.downloadIfNecessaryiters xz,gz,bz2 to find a suitable Package.* file, it calls utils.d'sdownloadFilewhich in turn simply wrapsdownloadwhich is where the trouble is.downloadcallsHTTP.performfrom std.net.curl, perform however seems to not care about the status code. From the documentation, and a casual look at curl.d, I'd say that when using perform one needs to set callback handlers for everything manually. e.g. https://github.com/dlang/phobos/blob/master/std/net/curl.d#L1075 is where .get and friends get their exception thrown, perform has no such convenience magic, and the docs for .get explicitly state that a statusexception may be raised.Some printfdebugging seems to support that theory. Setting a status line callback in
downloadit definitely gets code 404 but ignores it.
To that end I think all that's needed to fix this is to enforce the status code, as seen in curl.d's
_basicHTTP.Config I am using:
The text was updated successfully, but these errors were encountered: