diff --git a/src/server/kiwix-serve.cpp b/src/server/kiwix-serve.cpp index 9dc89c1..82f1207 100644 --- a/src/server/kiwix-serve.cpp +++ b/src/server/kiwix-serve.cpp @@ -126,23 +126,6 @@ static void appendToFirstOccurence(string &content, const string regex, const st regfree(®exp); } -static char charFromHex(std::string a) { - std::istringstream Blat (a); - int Z; - Blat >> std::hex >> Z; - return char (Z); -} - -static void unescapeUrl(string &url) { - std::string::size_type pos; - std::string hex; - while (std::string::npos != (pos = url.find('%'))) { - hex = url.substr(pos + 1, 2); - url.replace(pos, 3, 1, charFromHex(hex)); - } - return; -} - static int accessHandlerCallback(void *cls, struct MHD_Connection * connection, const char * url, @@ -198,8 +181,7 @@ static int accessHandlerCallback(void *cls, /* urlstr */ std::string urlStr = string(url); - unescapeUrl(urlStr); - + /* Mutex Lock */ pthread_mutex_lock(&readerLock); @@ -208,7 +190,7 @@ static int accessHandlerCallback(void *cls, cout << "Loading '" << urlStr << "'... " << endl; try { - reader->getContent(urlStr, content, contentLength, mimeType); + reader->getContentByUrl(urlStr, content, contentLength, mimeType); if (verboseFlag) { cout << "content size: " << contentLength << endl;