|
a/src/internfile/mimehandler.cpp |
|
b/src/internfile/mimehandler.cpp |
|
... |
|
... |
22 |
#include <iostream>
|
22 |
#include <iostream>
|
23 |
#include <string>
|
23 |
#include <string>
|
24 |
#include <vector>
|
24 |
#include <vector>
|
25 |
using namespace std;
|
25 |
using namespace std;
|
26 |
|
26 |
|
|
|
27 |
#include "cstr.h"
|
27 |
#include "mimehandler.h"
|
28 |
#include "mimehandler.h"
|
28 |
#include "debuglog.h"
|
29 |
#include "debuglog.h"
|
29 |
#include "rclconfig.h"
|
30 |
#include "rclconfig.h"
|
30 |
#include "smallut.h"
|
31 |
#include "smallut.h"
|
31 |
|
32 |
|
|
... |
|
... |
108 |
static Dijon::Filter *mhFactory(RclConfig *config, const string &mime)
|
109 |
static Dijon::Filter *mhFactory(RclConfig *config, const string &mime)
|
109 |
{
|
110 |
{
|
110 |
LOGDEB2(("mhFactory(%s)\n", mime.c_str()));
|
111 |
LOGDEB2(("mhFactory(%s)\n", mime.c_str()));
|
111 |
string lmime(mime);
|
112 |
string lmime(mime);
|
112 |
stringtolower(lmime);
|
113 |
stringtolower(lmime);
|
113 |
if ("text/plain" == lmime) {
|
114 |
if (cstr_textplain == lmime) {
|
114 |
LOGDEB2(("mhFactory(%s): returning MimeHandlerText\n", mime.c_str()));
|
115 |
LOGDEB2(("mhFactory(%s): returning MimeHandlerText\n", mime.c_str()));
|
115 |
return new MimeHandlerText(config, lmime);
|
116 |
return new MimeHandlerText(config, lmime);
|
116 |
} else if ("text/html" == lmime) {
|
117 |
} else if ("text/html" == lmime) {
|
117 |
LOGDEB2(("mhFactory(%s): returning MimeHandlerHtml\n", mime.c_str()));
|
118 |
LOGDEB2(("mhFactory(%s): returning MimeHandlerHtml\n", mime.c_str()));
|
118 |
return new MimeHandlerHtml(config, lmime);
|
119 |
return new MimeHandlerHtml(config, lmime);
|
|
... |
|
... |
176 |
h->params.insert(h->params.end(), it, cmdtoks.end());
|
177 |
h->params.insert(h->params.end(), it, cmdtoks.end());
|
177 |
|
178 |
|
178 |
// Handle additional attributes. We substitute the semi-colons
|
179 |
// Handle additional attributes. We substitute the semi-colons
|
179 |
// with newlines and use a ConfSimple
|
180 |
// with newlines and use a ConfSimple
|
180 |
string value;
|
181 |
string value;
|
181 |
if (attrs.get("charset", value))
|
182 |
if (attrs.get(cstr_charset, value))
|
182 |
h->cfgFilterOutputCharset = stringtolower((const string&)value);
|
183 |
h->cfgFilterOutputCharset = stringtolower((const string&)value);
|
183 |
if (attrs.get("mimetype", value))
|
184 |
if (attrs.get(cstr_mimetype, value))
|
184 |
h->cfgFilterOutputMtype = stringtolower((const string&)value);
|
185 |
h->cfgFilterOutputMtype = stringtolower((const string&)value);
|
185 |
|
186 |
|
186 |
#if 0
|
187 |
#if 0
|
187 |
string scmd;
|
188 |
string scmd;
|
188 |
for (it = h->params.begin(); it != h->params.end(); it++) {
|
189 |
for (it = h->params.begin(); it != h->params.end(); it++) {
|
|
... |
|
... |
274 |
|
275 |
|
275 |
#ifdef INDEX_UNKNOWN_TEXT_AS_PLAIN
|
276 |
#ifdef INDEX_UNKNOWN_TEXT_AS_PLAIN
|
276 |
// If the type is an unknown text/xxx, index as text/plain and
|
277 |
// If the type is an unknown text/xxx, index as text/plain and
|
277 |
// hope for the best (this wouldn't work too well with text/rtf...)
|
278 |
// hope for the best (this wouldn't work too well with text/rtf...)
|
278 |
if (mtype.find("text/") == 0) {
|
279 |
if (mtype.find("text/") == 0) {
|
279 |
h = mhFactory("text/plain");
|
280 |
h = mhFactory(cstr_textplain);
|
280 |
goto out;
|
281 |
goto out;
|
281 |
}
|
282 |
}
|
282 |
#endif
|
283 |
#endif
|
283 |
|
284 |
|
284 |
// Finally, unhandled files are either ignored or their name and
|
285 |
// Finally, unhandled files are either ignored or their name and
|