Merged from svn/trunk libcurl version checks to enable build against older versions of libcurl.
svn merge -r 10221:10222 http://www.openscenegraph.org/svn/osg/OpenSceneGraph/trunk/src/osgPlugins/curl/
This commit is contained in:
@@ -123,11 +123,14 @@ osgDB::ReaderWriter::ReadResult EasyCurl::read(const std::string& proxyAddress,
|
||||
// use for https.
|
||||
// curl_easy_setopt(_curl, CURLOPT_KEYPASSWD, password.c_str());
|
||||
|
||||
#if LIBCURL_VERSION_NUM >= 0x070a07
|
||||
if (details->httpAuthentication != _previousHttpAuthentication)
|
||||
{
|
||||
curl_easy_setopt(_curl, CURLOPT_HTTPAUTH, details->httpAuthentication);
|
||||
_previousHttpAuthentication = details->httpAuthentication;
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -136,13 +139,15 @@ osgDB::ReaderWriter::ReadResult EasyCurl::read(const std::string& proxyAddress,
|
||||
curl_easy_setopt(_curl, CURLOPT_USERPWD, 0);
|
||||
_previousPassword.clear();
|
||||
}
|
||||
|
||||
|
||||
#if LIBCURL_VERSION_NUM >= 0x070a07
|
||||
// need to reset if previously set.
|
||||
if (_previousHttpAuthentication!=0)
|
||||
{
|
||||
curl_easy_setopt(_curl, CURLOPT_HTTPAUTH, 0);
|
||||
_previousHttpAuthentication = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
curl_easy_setopt(_curl, CURLOPT_URL, fileName.c_str());
|
||||
@@ -154,6 +159,8 @@ osgDB::ReaderWriter::ReadResult EasyCurl::read(const std::string& proxyAddress,
|
||||
|
||||
if (res==0)
|
||||
{
|
||||
|
||||
#if LIBCURL_VERSION_NUM >= 0x070a07
|
||||
long code;
|
||||
if(!proxyAddress.empty())
|
||||
{
|
||||
@@ -191,13 +198,19 @@ osgDB::ReaderWriter::ReadResult EasyCurl::read(const std::string& proxyAddress,
|
||||
|
||||
return rr;
|
||||
}
|
||||
#endif
|
||||
|
||||
return osgDB::ReaderWriter::ReadResult::FILE_LOADED;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
osg::notify(osg::NOTICE)<<"Error: libcurl read error, file="<<fileName<<" error = "<<curl_easy_strerror(res)<<std::endl;
|
||||
|
||||
#if LIBCURL_VERSION_NUM >= 0x070c00
|
||||
osg::notify(osg::NOTICE)<<"Error: libcurl read error, file="<<fileName<<" error = "<<curl_easy_strerror(res)<<std::endl;
|
||||
#else
|
||||
osg::notify(osg::NOTICE)<<"Error: libcurl read error, file="<<fileName<<" error no = "<<res<<std::endl;
|
||||
#endif
|
||||
return osgDB::ReaderWriter::ReadResult::FILE_NOT_HANDLED;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user