mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-26 12:37:09 +08:00
精简代码
This commit is contained in:
parent
12346f77a4
commit
d46b67a5cf
@ -350,7 +350,7 @@ static void accessFile(TcpSession &sender, const Parser &parser, const MediaInfo
|
|||||||
if (cookie) {
|
if (cookie) {
|
||||||
headerOut["Set-Cookie"] = cookie->getCookie((*cookie)[kCookiePathKey].get<string>());
|
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;
|
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);
|
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);
|
auto indexFile = searchIndexFile(strFile);
|
||||||
if (!indexFile.empty()) {
|
if (!indexFile.empty()) {
|
||||||
//发现该文件夹下有index文件
|
//发现该文件夹下有index文件
|
||||||
|
@ -299,9 +299,7 @@ void HttpSession::Handle_Req_GET(int64_t &content_len) {
|
|||||||
if (!strongSelf) {
|
if (!strongSelf) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
strongSelf->sendResponse(status_code.data(), bClose,
|
strongSelf->sendResponse(status_code.data(), bClose, content_type.data(), responseHeader, body);
|
||||||
content_type.empty() ? nullptr : content_type.data(),
|
|
||||||
responseHeader, body);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user