Commit 41c75fb6 by xiongziliang

新增是否开启浏览http目录的配置选项:#367

parent bbcb4d41
...@@ -122,6 +122,8 @@ rootPath=./www ...@@ -122,6 +122,8 @@ rootPath=./www
sendBufSize=65536 sendBufSize=65536
#https服务器监听端口 #https服务器监听端口
sslport=443 sslport=443
#是否显示文件夹菜单,开启后可以浏览文件夹
dirMenu=1
[multicast] [multicast]
#rtp组播截止组播ip地址 #rtp组播截止组播ip地址
......
...@@ -100,11 +100,15 @@ const string kCharSet = HTTP_FIELD"charSet"; ...@@ -100,11 +100,15 @@ const string kCharSet = HTTP_FIELD"charSet";
const string kRootPath = HTTP_FIELD"rootPath"; const string kRootPath = HTTP_FIELD"rootPath";
//http 404错误提示内容 //http 404错误提示内容
const string kNotFound = HTTP_FIELD"notFound"; const string kNotFound = HTTP_FIELD"notFound";
//是否显示文件夹菜单
const string kDirMenu = HTTP_FIELD"dirMenu";
onceToken token([](){ onceToken token([](){
mINI::Instance()[kSendBufSize] = 64 * 1024; mINI::Instance()[kSendBufSize] = 64 * 1024;
mINI::Instance()[kMaxReqSize] = 4*1024; mINI::Instance()[kMaxReqSize] = 4*1024;
mINI::Instance()[kKeepAliveSecond] = 15; mINI::Instance()[kKeepAliveSecond] = 15;
mINI::Instance()[kDirMenu] = true;
#if defined(_WIN32) #if defined(_WIN32)
mINI::Instance()[kCharSet] = "gb2312"; mINI::Instance()[kCharSet] = "gb2312";
#else #else
......
...@@ -193,6 +193,8 @@ extern const string kCharSet; ...@@ -193,6 +193,8 @@ extern const string kCharSet;
extern const string kRootPath; extern const string kRootPath;
//http 404错误提示内容 //http 404错误提示内容
extern const string kNotFound; extern const string kNotFound;
//是否显示文件夹菜单
extern const string kDirMenu;
}//namespace Http }//namespace Http
////////////SHELL配置/////////// ////////////SHELL配置///////////
......
...@@ -195,6 +195,11 @@ static string searchIndexFile(const string &dir){ ...@@ -195,6 +195,11 @@ static string searchIndexFile(const string &dir){
} }
static bool makeFolderMenu(const string &httpPath, const string &strFullPath, string &strRet) { static bool makeFolderMenu(const string &httpPath, const string &strFullPath, string &strRet) {
GET_CONFIG(bool, dirMenu, Http::kDirMenu);
if(!dirMenu){
//不允许浏览文件夹
return false;
}
string strPathPrefix(strFullPath); string strPathPrefix(strFullPath);
string last_dir_name; string last_dir_name;
if(strPathPrefix.back() == '/'){ if(strPathPrefix.back() == '/'){
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论