From a75aebd4bdfd795695653dd20ba6fd67e92613a8 Mon Sep 17 00:00:00 2001 From: mpromonet Date: Sat, 24 Jul 2021 20:09:38 +0200 Subject: [PATCH] overide SETUP handler --- inc/HTTPServer.h | 15 ++++++++++++--- src/HTTPServer.cpp | 5 +++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/inc/HTTPServer.h b/inc/HTTPServer.h index 833ef44..1baaeda 100644 --- a/inc/HTTPServer.h +++ b/inc/HTTPServer.h @@ -150,6 +150,12 @@ class HTTPServer : public RTSPServer FramedSource* m_Source; }; + class HTTPClientSession : public RTSPServer::RTSPClientSession { + public: + HTTPClientSession(HTTPServer& ourServer, u_int32_t sessionId) : RTSPServer::RTSPClientSession(ourServer, sessionId) {} + virtual void handleCmd_SETUP(RTSPServer::RTSPClientConnection* ourClientConnection, char const* urlPreSuffix, char const* urlSuffix, char const* fullRequestStr); + }; + public: static HTTPServer* createNew(UsageEnvironment& env, Port rtspPort, UserAuthenticationDatabase* authDatabase, unsigned reclamationTestSeconds, unsigned int hlsSegment, const std::string webroot) { @@ -185,13 +191,16 @@ class HTTPServer : public RTSPServer } } - RTSPServer::RTSPClientConnection* createNewClientConnection(int clientSocket, struct SOCKETCLIENT clientAddr) + virtual RTSPServer::ClientConnection* createNewClientConnection(int clientSocket, struct SOCKETCLIENT clientAddr) { return new HTTPClientConnection(*this, clientSocket, clientAddr); } + virtual RTSPServer::ClientSession* createNewClientSession(u_int32_t sessionId) { + return new HTTPClientSession(*this, sessionId); + } private: - const unsigned int m_hlsSegment; - std::string m_webroot; + const unsigned int m_hlsSegment; + std::string m_webroot; }; diff --git a/src/HTTPServer.cpp b/src/HTTPServer.cpp index 83caa06..161ca04 100644 --- a/src/HTTPServer.cpp +++ b/src/HTTPServer.cpp @@ -369,6 +369,11 @@ void HTTPServer::HTTPClientConnection::handleHTTPCmd_StreamingGET(char const* ur } } +void HTTPServer::HTTPClientSession::handleCmd_SETUP(RTSPServer::RTSPClientConnection* ourClientConnection, char const* urlPreSuffix, char const* urlSuffix, char const* fullRequestStr) { + envir() << "handleCmd_SETUP:" << fullRequestStr; + RTSPServer::RTSPClientSession::handleCmd_SETUP(ourClientConnection, urlPreSuffix, urlSuffix, fullRequestStr); +} + void HTTPServer::HTTPClientConnection::handleCmd_notFound() { std::ostringstream os; ServerMediaSessionIterator it(fOurServer);