Skip to content

Commit 9afbef1

Browse files
authored
document EASY_HOOK and setopt (#215)
* add documentation to setopt * document EASY_HOOK
1 parent f491b96 commit 9afbef1

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

src/Curl/Curl.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,19 @@ function with_handle(f, handle::Union{Multi, Easy})
9393
end
9494
end
9595

96+
"""
97+
setopt(easy::Easy, option::Integer, value)
98+
99+
Sets options on libcurl's "easy" interface. `option` corresponds to libcurl options on https://curl.se/libcurl/c/curl_easy_setopt.html
100+
"""
96101
setopt(easy::Easy, option::Integer, value) =
97102
@check curl_easy_setopt(easy.handle, option, value)
103+
104+
"""
105+
setopt(multi::Multi, option::Integer, value)
106+
107+
Sets options on libcurl's "multi" interface. `option` corresponds to libcurl options on https://curl.se/libcurl/c/curl_multi_setopt.html
108+
"""
98109
setopt(multi::Multi, option::Integer, value) =
99110
@check curl_multi_setopt(multi.handle, option, value)
100111

src/Downloads.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,15 @@ end
6363

6464
const DOWNLOAD_LOCK = ReentrantLock()
6565
const DOWNLOADER = Ref{Union{Downloader, Nothing}}(nothing)
66+
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
70+
`Downloader` via `Curl.setopt`
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`.
74+
"""
6675
const EASY_HOOK = Ref{Union{Function, Nothing}}(nothing)
6776

6877
"""

0 commit comments

Comments
 (0)