Skip to content

Commit

Permalink
URL encode username and password in RTSP URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
jaminh committed Oct 6, 2023
1 parent 3c3fa58 commit 95eb1e2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/amcrest/special.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# vim:sw=4:ts=4:et
import logging
import shutil
import urllib.parse
from typing import Optional

from urllib3.exceptions import HTTPError
Expand Down Expand Up @@ -95,7 +96,10 @@ def _build_rtsp_url(
else:
port = ":{}".format(port_num)

return f"rtsp://{self._user}:{self._password}@{self._host}{port}/{cmd}"
username = urllib.parse.quote(self._user, safe='')
password = urllib.parse.quote(self._password, safe='')

return f"rtsp://{username}:{password}@{self._host}{port}/{cmd}"

# pylint: disable=pointless-string-statement
"""
Expand Down

0 comments on commit 95eb1e2

Please sign in to comment.