3
0
Fork 0

* FIXED: Blanck 404 error page server by kiwix-serve (ID: 3417227)

small_fixes
kelson42 14 years ago
parent 447241ff9e
commit 475f7875df

@ -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 = "<h1>Not Found</h1><p>The requested URL " + urlStr + " was not found on this server.</p>" ;
mimeType = "text/html";
httpResponseCode = MHD_HTTP_NOT_FOUND;
}
} else {
if (verboseFlag)
cout << "Failed to find " << urlStr << endl;
content = "<html><head><title>Content not found</title></head><body><h1>Not Found</h1><p>The requested URL " + urlStr + " was not found on this server.</p></body></html>";
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, "<head>", HTMLScripts);
appendToFirstOccurence(content, "<body[^>]*>", HTMLDiv);
}
#endif
/* Compute the lengh */
contentLength = content.size();

Loading…
Cancel
Save