| 410 | } |
| 411 | |
| 412 | bool RtspConnection::HandleAuthentication() |
| 413 | { |
| 414 | if (auth_info_ != nullptr && !has_auth_) { |
| 415 | std::string cmd = rtsp_request_->MethodToString[rtsp_request_->GetMethod()]; |
| 416 | std::string url = rtsp_request_->GetRtspUrl(); |
| 417 | |
| 418 | if (_nonce.size() > 0 && (auth_info_->GetResponse(_nonce, cmd, url) == rtsp_request_->GetAuthResponse())) { |
| 419 | _nonce.clear(); |
| 420 | has_auth_ = true; |
| 421 | } |
| 422 | else { |
| 423 | std::shared_ptr<char> res(new char[4096], std::default_delete<char[]>()); |
| 424 | _nonce = auth_info_->GetNonce(); |
| 425 | int size = rtsp_request_->BuildUnauthorizedRes(res.get(), 4096, auth_info_->GetRealm().c_str(), _nonce.c_str()); |
| 426 | SendRtspMessage(res, size); |
| 427 | return false; |
| 428 | } |
| 429 | } |
| 430 | |
| 431 | return true; |
| 432 | } |
| 433 | |
| 434 | void RtspConnection::SendOptions(ConnectionMode mode) |
| 435 | { |
nothing calls this directly
no test coverage detected