diff options
| author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2013-12-10 15:30:53 -0800 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2013-12-10 15:30:53 -0800 |
| commit | bf0da9f2f778aeb3eebe200a8cdeecbc6e1f9253 (patch) | |
| tree | 92e9c18362d7dd5a89371a9039128d9347791030 /node/HttpClient.cpp | |
| parent | 612c17240af65243a1fa5d8cc17d3ebdb38a9bee (diff) | |
| download | infinitytier-bf0da9f2f778aeb3eebe200a8cdeecbc6e1f9253.tar.gz infinitytier-bf0da9f2f778aeb3eebe200a8cdeecbc6e1f9253.zip | |
Rest of software updater, ready to test...
Diffstat (limited to 'node/HttpClient.cpp')
| -rw-r--r-- | node/HttpClient.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/node/HttpClient.cpp b/node/HttpClient.cpp index 1d1624db..15c01c44 100644 --- a/node/HttpClient.cpp +++ b/node/HttpClient.cpp @@ -112,6 +112,12 @@ public: return; } + if (!_url.length()) { + _handler(_arg,-1,_url,false,"cannot fetch empty URL"); + delete this; + return; + } + curlArgs[0] = const_cast <char *>(curlPath.c_str()); curlArgs[1] = const_cast <char *>("-D"); curlArgs[2] = const_cast <char *>("-"); // append headers before output @@ -171,9 +177,11 @@ public: if (FD_ISSET(curlStdout[0],&readfds)) { int n = (int)::read(curlStdout[0],buf,sizeof(buf)); - if (n > 0) + if (n > 0) { _body.append(buf,n); - else if (n < 0) + // Reset timeout when data is read... + timesOutAt = Utils::now() + ((unsigned long long)_timeout * 1000ULL); + } else if (n < 0) break; if (_body.length() > CURL_MAX_MESSAGE_LENGTH) { ::kill(pid,SIGKILL); |
