Closed jgstew closed 3 years ago
After spending time with the URLDownloader and URLGetter source code, it might be easier to just reimplement this in pure python instead of trying to address these issues there, especially since the issues are across both processors.
I ended up creating a mostly pure python downloader that doesn't use cURL:
I am also not sure exactly how to implement the prefetch_filename
logic, partly from a standpoint of changing when the header prefetching happens in the process in order to do so. I also need to figure out how to get the headers needed to do so. Effectively, the headers are always prefetched, but later in the process.
Considering this issue complete even though the prefetch_filename
is still the old curl method.
Working to file a pull request to get this included in AutoPkgLib https://github.com/autopkg/autopkg/issues/734
Some remote servers don't properly support etag / last modified even if they provide them.
It would be ideal if you could prefetch the headers for the URL, then do the comparison in python to determine if the download is new or not for the cases where the remote server does NOT do this properly. You could also use the Content-Size header in the case of check-file-size-only flag instead of downloading the file first.
It would also be ideal if URLGetter / URLDownloader would have the option to use something other than xattr to store the etag/last modified header values so that this part worked correctly cross platform. One possible option is to check the last run values in the last run receipt and compare to the current values.
Another option all together is to implement something to replace URLDownloader that works with pure python instead of subprocessing cURL.
Related: