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

This commit is contained in:
xiongziliang 2020-06-30 09:16:02 +08:00
parent bbcb4d41f7
commit 41c75fb66a
4 changed files with 13 additions and 0 deletions

View File

@ -122,6 +122,8 @@ rootPath=./www
sendBufSize=65536
#https服务器监听端口
sslport=443
#是否显示文件夹菜单,开启后可以浏览文件夹
dirMenu=1
[multicast]
#rtp组播截止组播ip地址

View File

@ -100,11 +100,15 @@ const string kCharSet = HTTP_FIELD"charSet";
const string kRootPath = HTTP_FIELD"rootPath";
//http 404错误提示内容
const string kNotFound = HTTP_FIELD"notFound";
//是否显示文件夹菜单
const string kDirMenu = HTTP_FIELD"dirMenu";
onceToken token([](){
mINI::Instance()[kSendBufSize] = 64 * 1024;
mINI::Instance()[kMaxReqSize] = 4*1024;
mINI::Instance()[kKeepAliveSecond] = 15;
mINI::Instance()[kDirMenu] = true;
#if defined(_WIN32)
mINI::Instance()[kCharSet] = "gb2312";
#else

View File

@ -193,6 +193,8 @@ extern const string kCharSet;
extern const string kRootPath;
//http 404错误提示内容
extern const string kNotFound;
//是否显示文件夹菜单
extern const string kDirMenu;
}//namespace Http
////////////SHELL配置///////////

View File

@ -195,6 +195,11 @@ static string searchIndexFile(const string &dir){
}
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 last_dir_name;
if(strPathPrefix.back() == '/'){