html files would still be indexed even when filtered out by indexedmimetypes because the handler cache was searched before using the config data
This commit is contained in:
parent
a15d6c0540
commit
c7c3f2e269
@ -140,24 +140,31 @@ void returnMimeHandler(Dijon::Filter *handler)
|
|||||||
Dijon::Filter *getMimeHandler(const string &mtype, RclConfig *cfg,
|
Dijon::Filter *getMimeHandler(const string &mtype, RclConfig *cfg,
|
||||||
bool filtertypes)
|
bool filtertypes)
|
||||||
{
|
{
|
||||||
if (mtype.empty())
|
LOGDEB2(("getMimeHandler: mtype [%s] filtertypes %d\n",
|
||||||
return false;
|
mtype.c_str(), filtertypes));
|
||||||
|
|
||||||
// Do we already have one ?
|
// Get handler definition for mime type. We do this even if an
|
||||||
map<string, Dijon::Filter *>::iterator it = o_handlers.find(mtype);
|
// appropriate handler object may be in the cache (indexed by mime
|
||||||
if (it != o_handlers.end()) {
|
// type). This is fast, and necessary to conform to the
|
||||||
Dijon::Filter *h = it->second;
|
// configuration, (ie: text/html might be filtered out by
|
||||||
o_handlers.erase(it);
|
// indexedmimetypes but an html handler could still be in the
|
||||||
LOGDEB2(("getMimeHandler: found in cache\n"));
|
// cache because it was needed by some other interning stack).
|
||||||
return h;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get handler definition for mime type
|
|
||||||
string hs;
|
string hs;
|
||||||
hs = cfg->getMimeHandlerDef(mtype, filtertypes);
|
hs = cfg->getMimeHandlerDef(mtype, filtertypes);
|
||||||
|
|
||||||
if (!hs.empty()) {
|
if (!hs.empty()) { // Got a handler definition line
|
||||||
// Break definition into type and name/command string
|
|
||||||
|
// Do we already have a handler object in the cache ?
|
||||||
|
map<string, Dijon::Filter *>::iterator it = o_handlers.find(mtype);
|
||||||
|
if (it != o_handlers.end()) {
|
||||||
|
Dijon::Filter *h = it->second;
|
||||||
|
o_handlers.erase(it);
|
||||||
|
LOGDEB2(("getMimeHandler: found in cache\n"));
|
||||||
|
return h;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Not in cache. Break definition into type and name/command
|
||||||
|
// string and instanciate handler object
|
||||||
string::size_type b1 = hs.find_first_of(" \t");
|
string::size_type b1 = hs.find_first_of(" \t");
|
||||||
string handlertype = hs.substr(0, b1);
|
string handlertype = hs.substr(0, b1);
|
||||||
if (!stringlowercmp("internal", handlertype)) {
|
if (!stringlowercmp("internal", handlertype)) {
|
||||||
@ -194,8 +201,8 @@ Dijon::Filter *getMimeHandler(const string &mtype, RclConfig *cfg,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Finally, unhandled files are either ignored or their name is
|
// Finally, unhandled files are either ignored or their name and
|
||||||
// indexed, depending on configuration
|
// generic metadata is indexed, depending on configuration
|
||||||
bool indexunknown = false;
|
bool indexunknown = false;
|
||||||
cfg->getConfParam("indexallfilenames", &indexunknown);
|
cfg->getConfParam("indexallfilenames", &indexunknown);
|
||||||
if (indexunknown) {
|
if (indexunknown) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user