From b22608fb07795e22c4aaf2455ca4e7420d81b001 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 4 Feb 2015 13:50:19 -0500 Subject: [PATCH 1/2] this fixes Digest Auth for the mjpeg stream on a TV-IP302PI Digest Auth worked for the RTSP stream, but not http. This adds quotes around the cnonce value, which matches what curl and wget do and adds the algorithm line which also matches what curl and wget do. With these two changes the auth is accepted. --- src/zm_rtsp_auth.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/zm_rtsp_auth.cpp b/src/zm_rtsp_auth.cpp index b082ace01..4c3a7e442 100644 --- a/src/zm_rtsp_auth.cpp +++ b/src/zm_rtsp_auth.cpp @@ -114,9 +114,10 @@ std::string Authenticator::getAuthHeader(std::string method, std::string uri) if ( ! fQop.empty() ) { result += ", qop=" + fQop; result += ", nc=" + stringtf("%08x",nc); - result += ", cnonce=" + fCnonce; + result += ", cnonce=\"" + fCnonce "\""; } result += ", response=\"" + computeDigestResponse(method, uri) + "\""; + result += ", algorithm=\"MD5\""; //Authorization: Digest username="zm", // realm="NC-336PW-HD-1080P", From 65701f09569431dc1a53eaf9c9a25c2c64e3724d Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 4 Feb 2015 14:22:53 -0500 Subject: [PATCH 2/2] add missing + --- src/zm_rtsp_auth.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/zm_rtsp_auth.cpp b/src/zm_rtsp_auth.cpp index 4c3a7e442..fd9087afa 100644 --- a/src/zm_rtsp_auth.cpp +++ b/src/zm_rtsp_auth.cpp @@ -114,7 +114,7 @@ std::string Authenticator::getAuthHeader(std::string method, std::string uri) if ( ! fQop.empty() ) { result += ", qop=" + fQop; result += ", nc=" + stringtf("%08x",nc); - result += ", cnonce=\"" + fCnonce "\""; + result += ", cnonce=\"" + fCnonce + "\""; } result += ", response=\"" + computeDigestResponse(method, uri) + "\""; result += ", algorithm=\"MD5\"";