Commit 49375fd9 by xiongziliang

http文件服务器支持跨域

parent 79745061
...@@ -326,6 +326,11 @@ inline HttpSession::HttpCode HttpSession::Handle_Req_GET() { ...@@ -326,6 +326,11 @@ inline HttpSession::HttpCode HttpSession::Handle_Req_GET() {
//分节下载返回Content-Range头 //分节下载返回Content-Range头
httpHeader.emplace("Content-Range",StrPrinter<<"bytes " << iRangeStart << "-" << iRangeEnd << "/" << tFileStat.st_size<< endl); httpHeader.emplace("Content-Range",StrPrinter<<"bytes " << iRangeStart << "-" << iRangeEnd << "/" << tFileStat.st_size<< endl);
} }
auto Origin = m_parser["Origin"];
if(!Origin.empty()){
httpHeader["Access-Control-Allow-Origin"] = Origin;
httpHeader["Access-Control-Allow-Credentials"] = "true";
}
//先回复HTTP头部分 //先回复HTTP头部分
sendResponse(pcHttpResult, httpHeader, ""); sendResponse(pcHttpResult, httpHeader, "");
if (iRangeEnd - iRangeStart < 0) { if (iRangeEnd - iRangeStart < 0) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论