[5/5] rtmpproto: Don't include a client version in the unencrypted C1 handshake

Message ID 20161014133843.11941-5-martin@martin.st
State Committed
Commit 7d8d726be7dc46343ab1c98c339c1ed44bcb07c1
Headers show

Commit Message

Martin Storsjö Oct. 14, 2016, 1:38 p.m.
According to the public RTMP specification, these 4 bytes should
be zero.

librtmp in server mode assumes that the RTMPE (FP9) handshake is
used if these bytes are nonzero.
---
 libavformat/rtmpproto.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Luca Barbato Oct. 30, 2016, 1:53 p.m. | #1
On 14/10/2016 15:38, Martin Storsjö wrote:
> According to the public RTMP specification, these 4 bytes should
> be zero.
> 
> librtmp in server mode assumes that the RTMPE (FP9) handshake is
> used if these bytes are nonzero.
> ---
>  libavformat/rtmpproto.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
> index 0097841..1ffc79a 100644
> --- a/libavformat/rtmpproto.c
> +++ b/libavformat/rtmpproto.c
> @@ -1198,10 +1198,7 @@ static int rtmp_handshake(URLContext *s, RTMPContext *rt)
>      uint8_t tosend    [RTMP_HANDSHAKE_PACKET_SIZE+1] = {
>          3,                // unencrypted data
>          0, 0, 0, 0,       // client uptime
> -        RTMP_CLIENT_VER1,
> -        RTMP_CLIENT_VER2,
> -        RTMP_CLIENT_VER3,
> -        RTMP_CLIENT_VER4,
> +        0, 0, 0, 0,       // zeros
>      };
>      uint8_t clientdata[RTMP_HANDSHAKE_PACKET_SIZE];
>      uint8_t serverdata[RTMP_HANDSHAKE_PACKET_SIZE+1];
> 

This breaks the handshake with wowza apparently. I'd revert it. (sorry I
just happened to have access to a setup to test just today)

lu
Martin Storsjö Oct. 30, 2016, 7:46 p.m. | #2
On Sun, 30 Oct 2016, Luca Barbato wrote:

> On 14/10/2016 15:38, Martin Storsjö wrote:
>> According to the public RTMP specification, these 4 bytes should
>> be zero.
>>
>> librtmp in server mode assumes that the RTMPE (FP9) handshake is
>> used if these bytes are nonzero.
>> ---
>>  libavformat/rtmpproto.c | 5 +----
>>  1 file changed, 1 insertion(+), 4 deletions(-)
>>
>> diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
>> index 0097841..1ffc79a 100644
>> --- a/libavformat/rtmpproto.c
>> +++ b/libavformat/rtmpproto.c
>> @@ -1198,10 +1198,7 @@ static int rtmp_handshake(URLContext *s, RTMPContext *rt)
>>      uint8_t tosend    [RTMP_HANDSHAKE_PACKET_SIZE+1] = {
>>          3,                // unencrypted data
>>          0, 0, 0, 0,       // client uptime
>> -        RTMP_CLIENT_VER1,
>> -        RTMP_CLIENT_VER2,
>> -        RTMP_CLIENT_VER3,
>> -        RTMP_CLIENT_VER4,
>> +        0, 0, 0, 0,       // zeros
>>      };
>>      uint8_t clientdata[RTMP_HANDSHAKE_PACKET_SIZE];
>>      uint8_t serverdata[RTMP_HANDSHAKE_PACKET_SIZE+1];
>>
>
> This breaks the handshake with wowza apparently. I'd revert it. (sorry I
> just happened to have access to a setup to test just today)

Hmm, indeed. I thought I had tested this, but apparently not.

Feel free to push the revert, and clearly it was a good thing to postpone 
pushing this to the master branch.

// Martin

Patch

diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
index 0097841..1ffc79a 100644
--- a/libavformat/rtmpproto.c
+++ b/libavformat/rtmpproto.c
@@ -1198,10 +1198,7 @@  static int rtmp_handshake(URLContext *s, RTMPContext *rt)
     uint8_t tosend    [RTMP_HANDSHAKE_PACKET_SIZE+1] = {
         3,                // unencrypted data
         0, 0, 0, 0,       // client uptime
-        RTMP_CLIENT_VER1,
-        RTMP_CLIENT_VER2,
-        RTMP_CLIENT_VER3,
-        RTMP_CLIENT_VER4,
+        0, 0, 0, 0,       // zeros
     };
     uint8_t clientdata[RTMP_HANDSHAKE_PACKET_SIZE];
     uint8_t serverdata[RTMP_HANDSHAKE_PACKET_SIZE+1];