From ff33a8a81b3e08d03e00408e79e3cdb0ff922120 Mon Sep 17 00:00:00 2001 From: Thulinma Date: Thu, 24 Sep 2020 19:45:33 +0200 Subject: [PATCH 1/2] UDP socket rebinding fix + clarified debug message when switching address family --- lib/socket.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/socket.cpp b/lib/socket.cpp index 7e2abfae..bdefbb4f 100644 --- a/lib/socket.cpp +++ b/lib/socket.cpp @@ -1570,8 +1570,6 @@ int Socket::Server::getSocket(){ /// \param nonblock Whether the socket should be nonblocking. Socket::UDPConnection::UDPConnection(bool nonblock){ boundPort = 0; - boundAddr = ""; - boundMulti = ""; family = AF_INET6; sock = socket(AF_INET6, SOCK_DGRAM, 0); if (sock == -1){ @@ -1592,6 +1590,7 @@ Socket::UDPConnection::UDPConnection(bool nonblock){ /// Copies a UDP socket, re-allocating local copies of any needed structures. /// The data/data_size/data_len variables are *not* copied over. Socket::UDPConnection::UDPConnection(const UDPConnection &o){ + boundPort = 0; family = AF_INET6; sock = socket(AF_INET6, SOCK_DGRAM, 0); if (sock == -1){ @@ -1675,7 +1674,7 @@ void Socket::UDPConnection::SetDestination(std::string destIp, uint32_t port){ if (!destAddr){return;} memcpy(destAddr, rp->ai_addr, rp->ai_addrlen); if (family != rp->ai_family){ - INFO_MSG("Socket is wrong type (%s), re-opening as %s", addrFam(family), addrFam(rp->ai_family)); + INFO_MSG("Switching UDP socket from %s to %s", addrFam(family), addrFam(rp->ai_family)); close(); family = rp->ai_family; sock = socket(family, SOCK_DGRAM, 0); From 158058c4d541456e983d93cfc0df90f47d5b06cf Mon Sep 17 00:00:00 2001 From: Thulinma Date: Thu, 24 Sep 2020 18:01:24 +0200 Subject: [PATCH 2/2] Fixed RTSP support in HTTP::Parser --- lib/http_parser.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/http_parser.cpp b/lib/http_parser.cpp index 222c474d..bf90585d 100644 --- a/lib/http_parser.cpp +++ b/lib/http_parser.cpp @@ -708,6 +708,9 @@ bool HTTP::Parser::parse(std::string &HTTPbuffer, Util::DataCallback &cb){ } return false; }else{ + if (protocol.substr(0, 4) == "RTSP" || method.substr(0,4) == "RTSP"){ + return true; + } unsigned int toappend = HTTPbuffer.size(); bool shouldAppend = true; if (bodyCallback){