diff --git a/src/Http/HttpSession.cpp b/src/Http/HttpSession.cpp index c8df9de7..b83b6ce4 100644 --- a/src/Http/HttpSession.cpp +++ b/src/Http/HttpSession.cpp @@ -37,6 +37,15 @@ void HttpSession::Handle_Req_HEAD(ssize_t &content_len){ //对于按需生成流的直播场景并不适用 sendResponse(200, true); } + +void HttpSession::Handle_Req_OPTIONS(ssize_t &content_len) +{ + //暂时对OPTINS进行200 OK回复 + KeyValue headerOut; + headerOut["Content-Type"] = "application/octet-stream"; + + sendResponse(200, true, nullptr, headerOut, nullptr, true); +} ssize_t HttpSession::onRecvHeader(const char *header,size_t len) { typedef void (HttpSession::*HttpCMDHandle)(ssize_t &); @@ -45,6 +54,7 @@ ssize_t HttpSession::onRecvHeader(const char *header,size_t len) { s_func_map.emplace("GET",&HttpSession::Handle_Req_GET); s_func_map.emplace("POST",&HttpSession::Handle_Req_POST); s_func_map.emplace("HEAD",&HttpSession::Handle_Req_HEAD); + s_func_map.emplace("OPTIONS",&HttpSession::Handle_Req_OPTIONS); }, nullptr); _parser.Parse(header);