36
35
Request req = parse_request(param);
38
37
if (!MessageId::is_full(req.options.c_str()))
40
cout << "Status: 200 OK\r\n";
41
cout << "Content-Type: text/html\r\n\r\n";
42
cout << error(_("Bad request"), param,
43
_("The given parameter was not of the correct format. "
44
"A mbox request must be formatted like: "
45
"mbox/YYYYMMDD.HHMMSS.hashcode.txt"));
38
error(_("Bad request"), param,
39
_("The given parameter was not of the correct format. "
40
"A mbox request must be formatted like: "
41
"mbox/YYYYMMDD.HHMMSS.hashcode.txt"));
49
43
if (!cfg.raw_email)
51
cout << "Status: 200 OK\r\n";
52
cout << "Content-Type: text/html\r\n\r\n";
53
cout << error(_("Permission Denied"), param,
54
_("Access to raw email text has been disabled. "
55
"Contact the site administrator if this is a problem."));
44
error(_("Permission Denied"), param,
45
_("Access to raw email text has been disabled. "
46
"Contact the site administrator if this is a problem."));
59
48
MessageId id(req.options.c_str());
62
51
Summary source(id);
63
if ((ok = source.load(db, cfg)) != "")
52
// Identical error if missing or not allowed (security)
53
if ((ok = source.load(db, cfg)) != "" || !source.allowed())
65
cout << "Status: 200 OK\r\n";
66
cout << "Content-Type: text/html\r\n\r\n";
67
cout << error(_("Database mbox source pull failure"), ok,
68
_("The specified message does not exist."));
55
if (ok == "") ok = "not in a mailbox"; // fake
56
error(_("Database mbox source pull failure"), ok,
57
_("The specified message does not exist."));
61
error(_("Database mbox source pull failure"), "not found",
62
_("The specified message has been deleted."));
73
65
if ((ok = source.message(cfg.dbdir, message)) != "")
75
cout << "Status: 200 OK\r\n";
76
cout << "Content-Type: text/html\r\n\r\n";
77
cout << error(_("MBox read failure"), ok,
78
_("Unable to open message in the mailbox. "
79
"Perhaps it has been deleted or moved?"));
66
error(_("MBox read failure"), ok,
67
_("Unable to open message in the mailbox. "
68
"Perhaps it has been deleted or moved?"));
83
70
Cache cache(cfg, "mbox", param, req.ext);
84
71
cache.o << message.AsString().c_str();