diff --git a/.cproject b/.cproject index c5bd7ca1..9fad0060 100644 --- a/.cproject +++ b/.cproject @@ -2,18 +2,15 @@ - + - - - @@ -25,7 +22,7 @@ - + - + - + @@ -162,13 +161,10 @@ - - - @@ -246,6 +242,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Http/HttpClient.cpp b/src/Http/HttpClient.cpp index 26d7d9a6..f69ce0ed 100644 --- a/src/Http/HttpClient.cpp +++ b/src/Http/HttpClient.cpp @@ -55,7 +55,7 @@ void HttpClient::sendRequest(const string &strUrl){ _header.emplace(string("User-Agent"),"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36"); if(!_body.empty()){ - _header.emplace(string("Content-Length"),std::to_string(_body.size())); + _header.emplace(string("Content-Length"),to_string(_body.size())); _header.emplace(string("Content-Type"),"application/x-www-form-urlencoded; charset=UTF-8"); } diff --git a/src/Http/HttpClientImp.cpp b/src/Http/HttpClientImp.cpp index 33625f50..2a6f2172 100644 --- a/src/Http/HttpClientImp.cpp +++ b/src/Http/HttpClientImp.cpp @@ -27,10 +27,19 @@ void HttpClientImp::sendRequest(const string& url) { #else _sslBox.reset(new SSL_Box(false)); _sslBox->setOnDecData([this](const char *data, uint32_t len){ +#ifdef ANDROID + public_onRecvBytes(data,len); +#else//ANDROID HttpClient::onRecvBytes(data,len); +#endif//ANDROID }); _sslBox->setOnEncData([this](const char *data, uint32_t len){ + +#ifdef ANDROID + public_send(data,len); +#else//ANDROID HttpClient::send(data,len); +#endif//ANDROID }); #endif //ENABLE_OPENSSL diff --git a/src/Http/HttpClientImp.h b/src/Http/HttpClientImp.h index 22f54696..962f7df8 100644 --- a/src/Http/HttpClientImp.h +++ b/src/Http/HttpClientImp.h @@ -23,6 +23,15 @@ public: HttpClientImp(); virtual ~HttpClientImp(); virtual void sendRequest(const string &url) override; + +#ifdef ANDROID + void public_onRecvBytes(const char *data,int len){ + HttpClient::onRecvBytes(data,len); + } + void public_send(const char *data, uint32_t len){ + HttpClient::send(data,len); + } +#endif //ANDROID private: #ifdef ENABLE_OPENSSL virtual void onRecvBytes(const char *data,int size) override;