From 67d5c42007febb69ecad66c65c6ab292108a9119 Mon Sep 17 00:00:00 2001 From: xiongguangjie Date: Sat, 10 Jun 2023 18:46:30 +0800 Subject: [PATCH] Fix addStreamProxy rtsp url user or pass contain special char result in auth failed (#2545) --- src/Common/Parser.cpp | 6 ++++-- src/{Http => Common}/strCoding.cpp | 0 src/{Http => Common}/strCoding.h | 0 src/Http/HttpClient.h | 2 +- src/Http/HttpFileManager.cpp | 2 +- src/Http/HttpSession.cpp | 2 +- 6 files changed, 7 insertions(+), 5 deletions(-) rename src/{Http => Common}/strCoding.cpp (100%) rename src/{Http => Common}/strCoding.h (100%) diff --git a/src/Common/Parser.cpp b/src/Common/Parser.cpp index a7be567c..3e793039 100644 --- a/src/Common/Parser.cpp +++ b/src/Common/Parser.cpp @@ -10,6 +10,7 @@ #include #include "Parser.h" +#include "strCoding.h" #include "macros.h" #include "Network/sockutil.h" #include "Common/macros.h" @@ -287,9 +288,10 @@ void RtspUrl::setup(bool is_ssl, const string &url, const string &user, const st uint16_t port = is_ssl ? 322 : 554; splitUrl(ip, ip, port); + _url = std::move(url); - _user = std::move(user); - _passwd = std::move(passwd); + _user = strCoding::UrlDecode(std::move(user)); + _passwd = strCoding::UrlDecode(std::move(passwd)); _host = std::move(ip); _port = port; _is_ssl = is_ssl; diff --git a/src/Http/strCoding.cpp b/src/Common/strCoding.cpp similarity index 100% rename from src/Http/strCoding.cpp rename to src/Common/strCoding.cpp diff --git a/src/Http/strCoding.h b/src/Common/strCoding.h similarity index 100% rename from src/Http/strCoding.h rename to src/Common/strCoding.h diff --git a/src/Http/HttpClient.h b/src/Http/HttpClient.h index c82804d4..497f4a1d 100644 --- a/src/Http/HttpClient.h +++ b/src/Http/HttpClient.h @@ -22,7 +22,7 @@ #include "HttpRequestSplitter.h" #include "HttpCookie.h" #include "HttpChunkedSplitter.h" -#include "strCoding.h" +#include "Common/strCoding.h" #include "HttpBody.h" namespace mediakit { diff --git a/src/Http/HttpFileManager.cpp b/src/Http/HttpFileManager.cpp index af032597..7f69297b 100644 --- a/src/Http/HttpFileManager.cpp +++ b/src/Http/HttpFileManager.cpp @@ -20,7 +20,7 @@ #include "Record/HlsMediaSource.h" #include "Common/Parser.h" #include "Common/config.h" -#include "strCoding.h" +#include "Common/strCoding.h" using namespace std; using namespace toolkit; diff --git a/src/Http/HttpSession.cpp b/src/Http/HttpSession.cpp index 7d5689a2..fb7aed7f 100644 --- a/src/Http/HttpSession.cpp +++ b/src/Http/HttpSession.cpp @@ -12,7 +12,7 @@ #include #include #include "Common/config.h" -#include "strCoding.h" +#include "Common/strCoding.h" #include "HttpSession.h" #include "HttpConst.h" #include "Util/base64.h"