@@ -3249,25 +3249,36 @@ def download_target(self, target, destination_directory,
3249
3249
3250
3250
custom_download_handler:
3251
3251
A user provided function performing the actual target file download.
3252
- In order to comply with the TUF specification, the function signature
3253
- should have the form :
3252
+ In order to comply with the TUF specification, the function implementation
3253
+ should match the following description :
3254
3254
3255
- 'def download_handler_func(url, required_length)'
3255
+ def download_handler_func(url, required_length)
3256
+ <Purpose>
3257
+ Given the 'url' and 'required_length' of the desired file, open a connection
3258
+ to 'url', download it, and return the contents of the file. Also ensure
3259
+ the length of the downloaded file matches 'required_length' exactly.
3256
3260
3257
- The function implementation should provide the following functionality:
3261
+ <Arguments>
3262
+ url:
3263
+ A URL string that represents the location of the file.
3258
3264
3259
- 'Given the 'url' and 'required_length' of the desired file, open a
3260
- connection to 'url', download it, and return the contents of the file.
3261
- Also ensure the length of the downloaded file matches 'required_length'
3262
- exactly'
3265
+ required_length:
3266
+ An integer value representing the length of the file. This is an exact
3267
+ limit.
3263
3268
3264
- Raise 'securesystemslib.exceptions.DownloadLengthMismatchError', if
3265
- STRICT_REQUIRED_LENGTH is True and total_downloaded is not equal
3266
- required_length.
3269
+ <Side Effects>
3270
+ A temprorary file object is created to store the contents of 'url'.
3267
3271
3268
- Raise 'tuf.exceptions.SlowRetrievalError', if the total downloaded was
3269
- done in less than the acceptable download speed (as set in
3270
- tuf.settings.py).
3272
+ <Exceptions>
3273
+ DownloadLengthMismatchError, if there was a
3274
+ mismatch of observed vs expected lengths while downloading the file.
3275
+
3276
+ SlowRetrievalError, if the total downloaded was
3277
+ done in less than the acceptable download speed (as set in
3278
+ tuf.settings.py).
3279
+
3280
+ <Returns>
3281
+ A temporay file object that points to the contents of 'url'.
3271
3282
3272
3283
If None, tuf.download.safe_download is used.
3273
3284
0 commit comments