Add LLWeb::curlEscape

Since curl 7.21.2 - (October 13 2010), curl_escape (a deprecated
function that will be removed in the future) changed it's behavior
and no longer escapes the characters '-', '.', '_' and '~'.

The only reasonable solution for us is to stop using it and
use our own version that mimics the old behavior. The only
other alternative would be to rename every .xml file with
escaped characters in their name upon installation, depending
on the behavior of the installed libcurl (on standalone anyway).
However, if you add to that in the future curl_escape has to
be replaced with curl_easy_escape, which is far from easy to
call as it requires a CURL to be passed for which LL invented
a wrapper in libllmessage, but did hide that (Curl::Easy is
only defined in a .cpp file), then we're better of just using
our own function, which I named LLWeb::curlEscape.
This commit is contained in:
Aleric Inglewood
2011-05-02 20:15:50 +02:00
parent 094587aefd
commit 1ced64e0b4
8 changed files with 36 additions and 63 deletions

View File

@@ -187,10 +187,7 @@ void LLWLParamManager::loadPreset(const std::string & name,bool propagate)
{
// bugfix for SL-46920: preventing filenames that break stuff.
char * curl_str = curl_escape(name.c_str(), name.size());
std::string escaped_filename(curl_str);
curl_free(curl_str);
curl_str = NULL;
std::string escaped_filename = LLWeb::curlEscape(name);
escaped_filename += ".xml";
@@ -244,10 +241,7 @@ void LLWLParamManager::loadPreset(const std::string & name,bool propagate)
void LLWLParamManager::savePreset(const std::string & name)
{
// bugfix for SL-46920: preventing filenames that break stuff.
char * curl_str = curl_escape(name.c_str(), name.size());
std::string escaped_filename(curl_str);
curl_free(curl_str);
curl_str = NULL;
std::string escaped_filename = LLWeb::curlEscape(name);
escaped_filename += ".xml";
@@ -531,10 +525,7 @@ bool LLWLParamManager::removeParamSet(const std::string& name, bool delete_from_
std::string path_name(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/skies", ""));
// use full curl escaped name
char * curl_str = curl_escape(name.c_str(), name.size());
std::string escaped_name(curl_str);
curl_free(curl_str);
curl_str = NULL;
std::string escaped_name = LLWeb::curlEscape(name);
gDirUtilp->deleteFilesInDir(path_name, escaped_name + ".xml");
}