[rtmpdump] r73 - in branches/1.x: . handshake.cpp rtmp.cpp

hyc subversion at mplayerhq.hu
Wed Dec 16 21:26:39 CET 2009


Author: hyc
Date: Wed Dec 16 21:26:39 2009
New Revision: 73

Log:
Merge r62 and r63 into 1.x branch

Modified:
   branches/1.x/   (props changed)
   branches/1.x/handshake.cpp
   branches/1.x/rtmp.cpp

Modified: branches/1.x/handshake.cpp
==============================================================================
--- branches/1.x/handshake.cpp	Wed Dec 16 21:23:13 2009	(r72)
+++ branches/1.x/handshake.cpp	Wed Dec 16 21:26:39 2009	(r73)
@@ -257,12 +257,10 @@ bool CRTMP::HandShake(bool FP9HandShake)
 {
 	bool encrypted = Link.protocol == RTMP_PROTOCOL_RTMPE || Link.protocol == RTMP_PROTOCOL_RTMPTE;
 
-	FP9HandShake = true;//false;
-
-	if(encrypted && !FP9HandShake) {
-		Log(LOGERROR, "%s: RTMPE requires FP9 handshake!", __FUNCTION__);
-		return false;
-	}
+	if ( encrypted || Link.SWFHash )
+		FP9HandShake = true;
+	else
+		FP9HandShake = false;
 
 	char clientsig[RTMP_SIG_SIZE+1];
 	char serversig[RTMP_SIG_SIZE];
@@ -398,11 +396,16 @@ bool CRTMP::HandShake(bool FP9HandShake)
 	LogHex(LOGDEBUG, serversig, RTMP_SIG_SIZE);
 	#endif
 
+	if (!FP9HandShake) {
+		if(!WriteN(serversig, RTMP_SIG_SIZE))
+			return false;
+	}
+
 	// we have to use this signature now to find the correct algorithms for getting the digest and DH positions
 	int digestPosServer = GetDigestOffset2(serversig, RTMP_SIG_SIZE);
 	int dhposServer     = GetDHOffset2(serversig, RTMP_SIG_SIZE);
 
-	if(!VerifyDigest(digestPosServer, serversig, GenuineFMSKey, 36)) {
+	if(FP9HandShake && !VerifyDigest(digestPosServer, serversig, GenuineFMSKey, 36)) {
         	Log(LOGWARNING, "Trying different position for server digest!\n");
                 digestPosServer = GetDigestOffset1(serversig, RTMP_SIG_SIZE);
 		dhposServer     = GetDHOffset1(serversig, RTMP_SIG_SIZE);
@@ -493,8 +496,6 @@ bool CRTMP::HandShake(bool FP9HandShake)
 			Log(LOGWARNING, "%s: client signature does not match!", __FUNCTION__);
 		}
 
-		if(!WriteN(serversig, RTMP_SIG_SIZE))
-			return false;
 	} else {
 		// verify server response
 		int digestPosClient = GetDigestOffset1(clientsig+1, RTMP_SIG_SIZE);

Modified: branches/1.x/rtmp.cpp
==============================================================================
--- branches/1.x/rtmp.cpp	Wed Dec 16 21:23:13 2009	(r72)
+++ branches/1.x/rtmp.cpp	Wed Dec 16 21:26:39 2009	(r73)
@@ -754,7 +754,7 @@ bool CRTMP::SendConnectPacket()
   if(Link.pageUrl)
   	enc += EncodeString(enc, "pageUrl", Link.pageUrl);
 
-  //enc += EncodeNumber(enc, "objectEncoding", 3.0); // use AMF3 objects, not supported yet
+  enc += EncodeNumber(enc, "objectEncoding", 0.0); // AMF0, AMF3 not supported yet
   enc += 2; // end of object - 0x00 0x00 0x09
   *enc = 0x09;
   enc++;


More information about the rtmpdump mailing list