This commit is contained in:
kelson42 2010-01-23 15:22:46 +00:00
parent 474c4e9a7a
commit 8c3d009115

View File

@ -150,7 +150,7 @@ static int accessHandlerCallback(void *cls,
string mimeType = ""; string mimeType = "";
unsigned int contentLength = 0; unsigned int contentLength = 0;
if (!strcmp(url, "/search")) { if (!strcmp(url, "/search") && hasSearchIndex) {
const char* pattern = MHD_lookup_connection_value(connection, MHD_GET_ARGUMENT_KIND, "pattern"); const char* pattern = MHD_lookup_connection_value(connection, MHD_GET_ARGUMENT_KIND, "pattern");
std::string urlStr; std::string urlStr;
std::string titleStr; std::string titleStr;
@ -195,7 +195,7 @@ static int accessHandlerCallback(void *cls,
} }
/* Rewrite the content (add the search box) */ /* Rewrite the content (add the search box) */
if (mimeType == "text/html") { if (hasSearchIndex && mimeType == "text/html") {
appendToFirstOccurence(content, "<head>", HTMLScripts); appendToFirstOccurence(content, "<head>", HTMLScripts);
appendToFirstOccurence(content, "<body[^>]*>", HTMLDiv); appendToFirstOccurence(content, "<body[^>]*>", HTMLDiv);
contentLength = content.size(); contentLength = content.size();