@@ -65,12 +65,12 @@ const DOWNLOAD_LOCK = ReentrantLock()
65
65
const DOWNLOADER = Ref {Union{Downloader, Nothing}} (nothing )
66
66
67
67
"""
68
- `EASY_HOOK` is a modifable global hook to used as the default `easy_hook` on
69
- new `Downloader` objects. This supplies a mechanism to set options for the
68
+ `EASY_HOOK` is a modifable global hook to used as the default `easy_hook` on
69
+ new `Downloader` objects. This supplies a mechanism to set options for the
70
70
`Downloader` via `Curl.setopt`
71
71
72
- It is expected to be function taking two arguments: an `Easy` struct and an
73
- `info` NamedTuple with names `url`, `method` and `headers`.
72
+ It is expected to be function taking two arguments: an `Easy` struct and an
73
+ `info` NamedTuple with names `url`, `method` and `headers`.
74
74
"""
75
75
const EASY_HOOK = Ref {Union{Function, Nothing}} (nothing )
76
76
@@ -205,9 +205,11 @@ If the `headers` keyword argument is provided, it must be a vector or dictionary
205
205
whose elements are all pairs of strings. These pairs are passed as headers when
206
206
downloading URLs with protocols that supports them, such as HTTP/S.
207
207
208
- The `timeout` keyword argument specifies a timeout for the download in seconds,
209
- with a resolution of milliseconds. By default no timeout is set, but this can
210
- also be explicitly requested by passing a timeout value of `Inf`.
208
+ The `timeout` keyword argument specifies a timeout for the download to complete in
209
+ seconds, with a resolution of milliseconds. By default no timeout is set, but this
210
+ can also be explicitly requested by passing a timeout value of `Inf`. Separately,
211
+ if 20 seconds elapse without receiving any data, the download will timeout. See
212
+ extended help for how to disable this timeout.
211
213
212
214
If the `progress` keyword argument is provided, it must be a callback function
213
215
which will be called whenever there are updates about the size and status of the
@@ -226,6 +228,20 @@ verbose option is ignored and instead the data that would have been printed to
226
228
The `type` argument indicates what kind of event has occurred, and is one of:
227
229
`TEXT`, `HEADER IN`, `HEADER OUT`, `DATA IN`, `DATA OUT`, `SSL DATA IN` or `SSL
228
230
DATA OUT`. The `message` argument is the description of the debug event.
231
+
232
+ ## Extended Help
233
+
234
+ For further customization, use a [`Downloader`](@ref) and
235
+ [`easy_hook`s](https://github.com/JuliaLang/Downloads.jl#mutual-tls-using-downloads).
236
+ For example, to disable the 20 second timeout when no data is received, you may
237
+ use the following:
238
+
239
+ ```jl
240
+ downloader = Downloads.Downloader()
241
+ downloader.easy_hook = (easy, info) -> Downloads.Curl.setopt(easy, Downloads.Curl.CURLOPT_LOW_SPEED_TIME, 0)
242
+
243
+ Downloads.download("https://httpbingo.julialang.org/delay/30"; downloader)
244
+ ```
229
245
"""
230
246
function download (
231
247
url :: AbstractString ,
435
451
"""
436
452
default_downloader!(
437
453
downloader = <none>
438
- )
454
+ )
439
455
440
456
downloader :: Downloader
441
457
0 commit comments