From 1bbab1fcc716c6bc7b92655046c1924e9b5e21da Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 14 Oct 2008 16:57:37 +0000 Subject: [PATCH] From Jason Beverage, "Here is a small change to the CURL plugin to distinguish between a 400 level error and a 500 level error. If a 400 level error occurs, a FILE_NOT_FOUND ReadResult is appropriate. If a 500 level error occurs (such a 503, Service unavailable), the application might want to try to load the file again in a few seconds/minutes. This submission returns ERROR_IN_READING_FILE if a 500 level error occurs so that clients can easily distinguish between the errors. The actual error code is also added to the "message" of the ReadResult so if a client needs more information, they can just parse the message to retrieve the error code." --- src/osgPlugins/curl/ReaderWriterCURL.cpp | 28 +++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/src/osgPlugins/curl/ReaderWriterCURL.cpp b/src/osgPlugins/curl/ReaderWriterCURL.cpp index 67230f55e..38984592b 100644 --- a/src/osgPlugins/curl/ReaderWriterCURL.cpp +++ b/src/osgPlugins/curl/ReaderWriterCURL.cpp @@ -163,10 +163,32 @@ osgDB::ReaderWriter::ReadResult EasyCurl::read(const std::string& proxyAddress, curl_easy_getinfo(_curl, CURLINFO_RESPONSE_CODE, &code); } - if (code>=400) + //If the code is greater than 400, there was an error + if (code >= 400) { - osg::notify(osg::NOTICE)<<"Error: libcurl read error, file="<