From f7b77cdbfdfed9f086a26c43aa514dc2bb17672c Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Tue, 30 Jan 2018 17:25:19 +0800 Subject: [PATCH] =?UTF-8?q?http=E6=96=87=E4=BB=B6=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E5=99=A8=E6=94=AF=E6=8C=81=E8=B7=A8=E5=9F=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Http/HttpSession.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Http/HttpSession.cpp b/src/Http/HttpSession.cpp index 912dd2c5..c11cd902 100644 --- a/src/Http/HttpSession.cpp +++ b/src/Http/HttpSession.cpp @@ -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) {