Skip to content

Commit

Permalink
Add CURLOPT_SSL_VERIFYHOST an PEER so that SSL works.. not sure why S…
Browse files Browse the repository at this point in the history
…SL doesn't work. Add more debug and fix logic inversion on status result.
  • Loading branch information
Isaac Connor committed Aug 11, 2023
1 parent c5eec8f commit 7122514
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/zm_monitor_rtsp2web.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ int Monitor::RTSP2WebManager::check_RTSP2Web() {
curl_easy_setopt(curl, CURLOPT_URL,endpoint.c_str());
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
CURLcode res = curl_easy_perform(curl);
curl_easy_cleanup(curl);

Expand Down Expand Up @@ -118,18 +121,20 @@ int Monitor::RTSP2WebManager::add_to_RTSP2Web() {
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, postData.c_str());
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);

if (res != CURLE_OK) {
Error("Failed to curl_easy_perform adding rtsp stream");
Error("Failed to curl_easy_perform adding rtsp stream %s", curl_easy_strerror(res));
return -1;
}

Debug(1, "Adding stream response: %s", remove_newlines(response).c_str());
//scan for missing session or handle id "No such session" "no such handle"
if (response.find("\"status\": 1") != std::string::npos) {
Warning("RTSP2Web failed adding stream");
if (response.find("\"status\": 1") == std::string::npos) {
Warning("RTSP2Web failed adding stream, response: %s", response.c_str());
return -2;
}

Expand All @@ -148,6 +153,8 @@ int Monitor::RTSP2WebManager::remove_from_RTSP2Web() {
curl_easy_setopt(curl, CURLOPT_URL,endpoint.c_str());
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);

CURLcode res = curl_easy_perform(curl);
if (res != CURLE_OK) {
Expand Down

0 comments on commit 7122514

Please sign in to comment.