2014-01-18 14:48:52 +01:00
|
|
|
#include "MediocreSimpleStaticFileHandler.H"
|
|
|
|
|
2014-01-25 17:47:37 +01:00
|
|
|
std::string
|
|
|
|
MediocreSimpleStaticFileHandler::cleanpath (const char * const path)
|
|
|
|
{
|
2014-01-23 02:19:33 +01:00
|
|
|
//adds no security at all
|
2014-01-26 12:53:04 +01:00
|
|
|
return "static/"+std::string(path);
|
2014-01-23 02:19:33 +01:00
|
|
|
}
|
2014-01-18 14:48:52 +01:00
|
|
|
|
2014-01-25 17:47:37 +01:00
|
|
|
int
|
|
|
|
MediocreSimpleStaticFileHandler::answer_pathreq(const char * const path,
|
2014-01-23 02:19:33 +01:00
|
|
|
struct mg_connection *conn)
|
|
|
|
{
|
|
|
|
mg_send_file(conn,cleanpath(path).c_str());
|
|
|
|
return 0;
|
2014-01-18 14:48:52 +01:00
|
|
|
}
|
|
|
|
|