{'Path'} = 'rtsp://admin:p%40ss@host/x'; $path = $mon->Path(); check('encoded password path', $path, 'rtsp://host/x'); check('encoded password Pass', $mon->{'Pass'}, 'p@ss'); check('encoded password User', $mon->{'User'}, 'admin'); // 2) plain credentials $mon = new FakeMon(); $mon->{'Path'} = 'rtsp://admin:secret@host/x'; check('plain credentials path', $mon->Path(), 'rtsp://host/x'); // 3) no credentials, host:port unchanged $mon = new FakeMon(); $mon->{'Path'} = 'rtsp://host:554/x'; check('host:port unchanged', $mon->Path(), 'rtsp://host:554/x'); // 4) both credentials and port, encoded user and password $mon = new FakeMon(); $mon->{'Path'} = 'rtsp://us%3Aer:pa%2Fss@h:554/live'; check('encoded user+pass with port', $mon->Path(), 'rtsp://h:554/live'); if ($failures) { echo "$failures failure(s)\n"; exit(1); } echo "all passed\n"; exit(0);