summaryrefslogtreecommitdiff
path: root/osdep/HttpClient.cpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2015-04-08 19:03:30 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2015-04-08 19:03:30 -0700
commit7192fe6d15265a8f3ae65631e464837fd396d4b6 (patch)
tree573513ef5e480780bfc4d35a899f683511d65c9f /osdep/HttpClient.cpp
parentd76133046518e71025000ec6322f5b8f1c98529f (diff)
downloadinfinitytier-7192fe6d15265a8f3ae65631e464837fd396d4b6.tar.gz
infinitytier-7192fe6d15265a8f3ae65631e464837fd396d4b6.zip
osdep/ compile fixes, and remove some lingering OS-specific stuff from node/Defaults
Diffstat (limited to 'osdep/HttpClient.cpp')
-rw-r--r--osdep/HttpClient.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/osdep/HttpClient.cpp b/osdep/HttpClient.cpp
index 6b96960b..251320ab 100644
--- a/osdep/HttpClient.cpp
+++ b/osdep/HttpClient.cpp
@@ -25,7 +25,7 @@
* LLC. Start here: http://www.zerotier.com/
*/
-#include "Constants.hpp"
+#include "../node/Constants.hpp"
#include <stdio.h>
#include <stdlib.h>
@@ -56,9 +56,7 @@
#include "HttpClient.hpp"
#include "Thread.hpp"
-#include "Utils.hpp"
-#include "NonCopyable.hpp"
-#include "Defaults.hpp"
+#include "OSUtils.hpp"
namespace ZeroTier {
@@ -82,7 +80,7 @@ static const char *CURL_PATHS[NUM_CURL_PATHS] = { "/usr/bin/curl","/bin/curl","/
// Internal private thread class that performs request, notifies handler,
// and then commits suicide by deleting itself.
-class HttpClient_Private_Request : NonCopyable
+class HttpClient_Private_Request
{
public:
HttpClient_Private_Request(HttpClient *parent,const char *method,const std::string &url,const std::map<std::string,std::string> &headers,unsigned int timeout,void (*handler)(void *,int,const std::string &,const std::string &),void *arg) :
@@ -113,7 +111,7 @@ public:
std::string curlPath;
for(int i=0;i<NUM_CURL_PATHS;++i) {
- if (Utils::fileExists(CURL_PATHS[i])) {
+ if (OSUtils::fileExists(CURL_PATHS[i])) {
curlPath = CURL_PATHS[i];
break;
}
@@ -177,7 +175,7 @@ public:
fcntl(curlStderr[0],F_SETFL,O_NONBLOCK);
int exitCode = -1;
- unsigned long long timesOutAt = Utils::now() + ((unsigned long long)_timeout * 1000ULL);
+ unsigned long long timesOutAt = OSUtils::now() + ((unsigned long long)_timeout * 1000ULL);
bool timedOut = false;
bool tooLong = false;
@@ -198,7 +196,7 @@ public:
if (n > 0) {
_body.append(buf,n);
// Reset timeout when data is read...
- timesOutAt = Utils::now() + ((unsigned long long)_timeout * 1000ULL);
+ timesOutAt = OSUtils::now() + ((unsigned long long)_timeout * 1000ULL);
} else if (n < 0)
break;
if (_body.length() > CURL_MAX_MESSAGE_LENGTH) {
@@ -213,7 +211,7 @@ public:
if (FD_ISSET(curlStdout[0],&errfds)||FD_ISSET(curlStderr[0],&errfds))
break;
- if (Utils::now() >= timesOutAt) {
+ if (OSUtils::now() >= timesOutAt) {
timedOut = true;
break;
}
@@ -283,7 +281,7 @@ public:
return;
}
++scPos;
- unsigned int rcode = Utils::strToUInt(headers.front().substr(scPos,3).c_str());
+ unsigned int rcode = OSUtils::strToUInt(headers.front().substr(scPos,3).c_str());
if ((!rcode)||(rcode > 999)) {
_doH(_arg,-1,_url,"invalid HTTP response (invalid response code)");
delete this;