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

pull/9/head
kelson42 15 years ago
parent 447241ff9e
commit 475f7875df

@ -268,18 +268,20 @@ static int accessHandlerCallback(void *cls,
try {
found = reader->getContentByUrl(urlStr, content, contentLength, mimeType);
if (verboseFlag) {
if (found) {
if (verboseFlag) {
cout << "Found " << urlStr << endl;
cout << "content size: " << contentLength << endl;
cout << "mimeType: " << mimeType << endl;
}
} else {
if (verboseFlag)
cout << "Failed to find " << urlStr << endl;
content = "<h1>Not Found</h1><p>The requested URL " + urlStr + " was not found on this server.</p>" ;
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