This patch modifies the parseRTSPRequestString section to return the entire string between the first / after the host:port and the urlSuffix section. It then conditionally pieces these together based on the request type to handle the fact that SETUP requests have track information appended.
Signed-off-by: Mike Williams <m...@mikebwilliams.com> --- liveMedia/RTSPCommon.cpp | 11 +++-------- liveMedia/RTSPServer.cpp | 40 ++++++++++++++++++++++++++-------------- 2 files changed, 29 insertions(+), 22 deletions(-) diff --git a/liveMedia/RTSPCommon.cpp b/liveMedia/RTSPCommon.cpp index dbc16fc..f872d2e 100644 --- a/liveMedia/RTSPCommon.cpp +++ b/liveMedia/RTSPCommon.cpp @@ -92,15 +92,10 @@ Boolean parseRTSPRequestString(char const* reqStr, while (k2 <= k) resultURLSuffix[n++] = reqStr[k2++]; resultURLSuffix[n] = '\0'; - // Also look for the URL 'pre-suffix' before this: - unsigned k3 = (k1 == 0) ? 0 : --k1; - while (k3 > i && reqStr[k3] != '/') --k3; - // the URL pre-suffix comes from [k3+1,k1] - // Copy "resultURLPreSuffix": - if (k1 - k3 + 1 > resultURLPreSuffixMaxSize) return False; // there's no room - n = 0; k2 = k3+1; - while (k2 <= k1) resultURLPreSuffix[n++] = reqStr[k2++]; + if (k1 - i + 1> resultURLPreSuffixMaxSize) return False; // there's no room + n = 0; k2 = i + 1; + while (k2 <= k1 - 1) resultURLPreSuffix[n++] = reqStr[k2++]; resultURLPreSuffix[n] = '\0'; i = k + 7; // to go past " RTSP/" diff --git a/liveMedia/RTSPServer.cpp b/liveMedia/RTSPServer.cpp index dcb2086..4b4650f 100644 --- a/liveMedia/RTSPServer.cpp +++ b/liveMedia/RTSPServer.cpp @@ -449,21 +449,33 @@ void RTSPServer::RTSPClientSession::handleRequestBytes(int newBytesRead) { // If there was a "Content-Length:" header, then make sure we've received all of the data that it specified: if (ptr + newBytesRead < tmpPtr + 2 + contentLength) return; // we still need more data; subsequent reads will give it to us - if (strcmp(cmdName, "OPTIONS") == 0) { - handleCmd_OPTIONS(cseq); - } else if (strcmp(cmdName, "DESCRIBE") == 0) { - handleCmd_DESCRIBE(cseq, urlSuffix, (char const*)fRequestBuffer); - } else if (strcmp(cmdName, "SETUP") == 0) { - handleCmd_SETUP(cseq, urlPreSuffix, urlSuffix, (char const*)fRequestBuffer); - } else if (strcmp(cmdName, "TEARDOWN") == 0 - || strcmp(cmdName, "PLAY") == 0 - || strcmp(cmdName, "PAUSE") == 0 - || strcmp(cmdName, "GET_PARAMETER") == 0 - || strcmp(cmdName, "SET_PARAMETER") == 0) { - handleCmd_withinSession(cmdName, urlPreSuffix, urlSuffix, cseq, - (char const*)fRequestBuffer); + char urlTotalSuffix[RTSP_PARAM_STRING_MAX] = {0}; + if (strlen(urlPreSuffix) + strlen(urlSuffix) + 2 > RTSP_PARAM_STRING_MAX) { + handleCmd_bad(cseq); } else { - handleCmd_notSupported(cseq); + + if (urlPreSuffix[0] != '\0') { + strcat(urlTotalSuffix, urlPreSuffix); + strcat(urlTotalSuffix, "/"); + } + strcat(urlTotalSuffix, urlSuffix); + + if (strcmp(cmdName, "OPTIONS") == 0) { + handleCmd_OPTIONS(cseq); + } else if (strcmp(cmdName, "DESCRIBE") == 0) { + handleCmd_DESCRIBE(cseq, urlTotalSuffix, (char const*)fRequestBuffer); + } else if (strcmp(cmdName, "SETUP") == 0) { + handleCmd_SETUP(cseq, urlPreSuffix, urlSuffix, (char const*)fRequestBuffer); + } else if (strcmp(cmdName, "TEARDOWN") == 0 + || strcmp(cmdName, "PLAY") == 0 + || strcmp(cmdName, "PAUSE") == 0 + || strcmp(cmdName, "GET_PARAMETER") == 0 + || strcmp(cmdName, "SET_PARAMETER") == 0) { + handleCmd_withinSession(cmdName, urlPreSuffix, urlSuffix, cseq, + (char const*)fRequestBuffer); + } else { + handleCmd_notSupported(cseq); + } } } else { #ifdef DEBUG -- 1.7.3.4 _______________________________________________ live-devel mailing list live-devel@lists.live555.com http://lists.live555.com/mailman/listinfo/live-devel