http文件服务器支持跨域

This commit is contained in:
xiongziliang 2018-01-30 17:25:19 +08:00
parent 7974506129
commit 49375fd926

View File

@ -326,6 +326,11 @@ inline HttpSession::HttpCode HttpSession::Handle_Req_GET() {
//分节下载返回Content-Range头
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头部分
sendResponse(pcHttpResult, httpHeader, "");
if (iRangeEnd - iRangeStart < 0) {