精简代码

This commit is contained in:
xiongziliang
2019-11-30 11:56:40 +08:00
parent 12346f77a4
commit d46b67a5cf
2 changed files with 3 additions and 5 deletions

View File

@@ -350,7 +350,7 @@ static void accessFile(TcpSession &sender, const Parser &parser, const MediaInfo
if (cookie) {
headerOut["Set-Cookie"] = cookie->getCookie((*cookie)[kCookiePathKey].get<string>());
}
cb("401 Unauthorized", "", headerOut, std::make_shared<HttpStringBody>(errMsg));
cb("401 Unauthorized", "text/html", headerOut, std::make_shared<HttpStringBody>(errMsg));
return;
}
@@ -380,7 +380,7 @@ void HttpFileManager::onAccessPath(TcpSession &sender, Parser &parser, const Htt
auto strFile = File::absolutePath(enableVhost ? mediaInfo._vhost + parser.Url() : parser.Url(), rootPath);
//访问的是文件夹
if (strFile.back() == '/' || File::is_dir(strFile.data())) {
if (File::is_dir(strFile.data())) {
auto indexFile = searchIndexFile(strFile);
if (!indexFile.empty()) {
//发现该文件夹下有index文件