Skip to content

Commit df669f6

Browse files
committed
Simplified syntax in http_client.
1 parent 58358e7 commit df669f6

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/utils/net/http_client.ml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,8 @@ let safe_call f write_log =
123123
(** Internal HTTP call implementation *)
124124
let rec http_call_internal r write_f fretry progress =
125125
fretry ();
126-
let curl = Curl.init () in
127126
try
128-
bracket curl (fun res ->
129-
Curl.cleanup res
130-
) (fun _ ->
127+
bracket (Curl.init ()) Curl.cleanup begin fun curl ->
131128
Curl.set_url curl (Url.to_string r.req_url);
132129
let headers =
133130
("User-Agent", r.req_user_agent) ::
@@ -191,7 +188,7 @@ let rec http_call_internal r write_f fretry progress =
191188
| _ ->
192189
lprintf_nl "HTTP error unknown: %s" (Url.to_string r.req_url);
193190
Error `UnknownError
194-
)
191+
end
195192
with
196193
| ScheduleRetry error ->
197194
lprintf_nl "exception";

0 commit comments

Comments
 (0)