Skip to content

Commit

Permalink
Set a download speed timeout in the curl session
Browse files Browse the repository at this point in the history
This will abort the download if it’s slower than 10KB/sec for 60 seconds
with CURLE_OPERATION_TIMEDOUT

The limits are copied from flatpak/flatpak@d6b10c2

This seems it could be useful in CI which may want to proactively kill a
pipeline if a download timeouts
  • Loading branch information
bbhtt committed Oct 16, 2023
1 parent 4fa7ddf commit 1660e9f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/builder-flatpak-utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -1154,6 +1154,8 @@ flatpak_create_curl_session (const char *user_agent)
curl_easy_setopt (curl_session, CURLOPT_FOLLOWLOCATION, 1);
curl_easy_setopt (curl_session, CURLOPT_MAXREDIRS, 50);
curl_easy_setopt (curl_session, CURLOPT_NOPROGRESS, 0);
curl_easy_setopt (curl_session, CURLOPT_LOW_SPEED_TIME, 60L);
curl_easy_setopt (curl_session, CURLOPT_LOW_SPEED_LIMIT, 10000L);
curl_easy_setopt (curl_session, CURLOPT_USERAGENT, user_agent);

return curl_session;
Expand Down

0 comments on commit 1660e9f

Please sign in to comment.