From 73874003c3128b537dff270df8df947fd7152386 Mon Sep 17 00:00:00 2001 From: Andriy Utkin Date: Wed, 6 Nov 2024 18:15:26 +0000 Subject: [PATCH] www: Urlencode RTSP credentials when running ffprobe to test connection --- www/lib/lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/www/lib/lib.php b/www/lib/lib.php index 69755d5f..811c7b00 100644 --- a/www/lib/lib.php +++ b/www/lib/lib.php @@ -776,13 +776,13 @@ public function checkConnection() { switch($this->info['protocol']) { case 'IP-RTSP': - $path = 'rtsp://'.((empty($this->info['rtsp_username'])) ? '' : $this->info['rtsp_username'].':'.$this->info['rtsp_password'].'@').$this->info['ipAddr'].':'.$this->info['port'].$this->info['rtsp']; + $path = 'rtsp://'.((empty($this->info['rtsp_username'])) ? '' : urlencode($this->info['rtsp_username']).':'.urlencode($this->info['rtsp_password']).'@').$this->info['ipAddr'].':'.$this->info['port'].$this->info['rtsp']; $rtp_args_menu = array("-rtsp_flags +prefer_tcp", "-rtsp_transport tcp", "-rtsp_transport +udp+udp_multicast"); $args = $rtp_args_menu[$this->info['rtsp_rtp_prefer_tcp']]; break; case 'IP-MJPEG': //FIXME: This is the old logic for testing MJPEG. Testing for MJPEG is currently not supported by the bundled ffprobe method used for RTSP - $path = 'http://'.((empty($this->info['rtsp_username'])) ? '' : $this->info['rtsp_username'].':'.$this->info['rtsp_password'].'@').((empty($this->info['ipAddrMjpeg'])) ? $this->info['ipAddr'] : $this->info['ipAddrMjpeg']).':'.$this->info['portMjpeg'].$this->info['mjpeg_path']; + $path = 'http://'.((empty($this->info['rtsp_username'])) ? '' : urlencode($this->info['rtsp_username']).':'.urlencode($this->info['rtsp_password']).'@').((empty($this->info['ipAddrMjpeg'])) ? $this->info['ipAddr'] : $this->info['ipAddrMjpeg']).':'.$this->info['portMjpeg'].$this->info['mjpeg_path']; $headers = @get_headers($path); if (!$headers) { $this->info['connection_status']['success'] = false; return; } preg_match("/([0-9]{3})/", $headers[0], $response_code);