From 475f7875dfcab7a92996451d1fb6038c75a3bfa4 Mon Sep 17 00:00:00 2001 From: kelson42 Date: Sat, 21 Jan 2012 23:54:38 +0000 Subject: [PATCH] * FIXED: Blanck 404 error page server by kiwix-serve (ID: 3417227) --- src/server/kiwix-serve.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/server/kiwix-serve.cpp b/src/server/kiwix-serve.cpp index e401a9a..738d8c4 100644 --- a/src/server/kiwix-serve.cpp +++ b/src/server/kiwix-serve.cpp @@ -268,17 +268,19 @@ static int accessHandlerCallback(void *cls, try { found = reader->getContentByUrl(urlStr, content, contentLength, mimeType); - if (verboseFlag) { - if (found) { + if (found) { + if (verboseFlag) { cout << "Found " << urlStr << endl; cout << "content size: " << contentLength << endl; cout << "mimeType: " << mimeType << endl; - } else { - cout << "Failed to find " << urlStr << endl; - content = "

Not Found

The requested URL " + urlStr + " was not found on this server.

" ; - mimeType = "text/html"; - httpResponseCode = MHD_HTTP_NOT_FOUND; } + } else { + if (verboseFlag) + cout << "Failed to find " << urlStr << endl; + + content = "Content not found

Not Found

The requested URL " + urlStr + " was not found on this server.

"; + mimeType = "text/html"; + httpResponseCode = MHD_HTTP_NOT_FOUND; } } catch (const std::exception& e) { std::cerr << e.what() << std::endl; @@ -289,12 +291,10 @@ static int accessHandlerCallback(void *cls, } /* Rewrite the content (add the search box) */ -#ifdef _WIN32 if (hasSearchIndex && mimeType.find("text/html") != string::npos) { appendToFirstOccurence(content, "", HTMLScripts); appendToFirstOccurence(content, "]*>", HTMLDiv); } -#endif /* Compute the lengh */ contentLength = content.size();