Skip to content

Commit

Permalink
Merge pull request ONLYOFFICE#433 from ONLYOFFICE/feature/k61
Browse files Browse the repository at this point in the history
Add timeout to curl/wget
  • Loading branch information
K0R0L committed Nov 23, 2020
2 parents 7fd59fb + a4df8a5 commit f97723d
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Common/FileDownloader/FileDownloader_curl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,17 @@ int download_external(const std::wstring& sUrl, const std::wstring& sOutput)

case 0: // child process
{
const char* nargs[8];
const char* nargs[10];
nargs[0] = "/usr/bin/curl";
nargs[1] = "--url";
nargs[2] = sUrlA.c_str();
nargs[3] = "--output";
nargs[4] = sOutputA.c_str();
nargs[5] = "--silent";
nargs[6] = "-L";
nargs[7] = NULL;
nargs[7] = "--connect-timeout";
nargs[8] = "10";
nargs[9] = NULL;

const char* nenv[3];
nenv[0] = "LD_PRELOAD=";
Expand Down Expand Up @@ -123,13 +125,15 @@ int download_external(const std::wstring& sUrl, const std::wstring& sOutput)

case 0: // child process
{
const char* nargs[6];
const char* nargs[8];
nargs[0] = "/usr/bin/wget";
nargs[1] = sUrlValidateA.c_str();
nargs[2] = "-O";
nargs[3] = sOutputA.c_str();
nargs[4] = "-q";
nargs[5] = NULL;
nargs[5] = "--connect-timeout=10";
nargs[6] = "--tries=2";
nargs[7] = NULL;

const char* nenv[2];
nenv[0] = "LD_PRELOAD=";
Expand Down

0 comments on commit f97723d

Please sign in to comment.