The spec says that the 2nd round of packets need to have the 1st 4 bytes be the
timestamp (potentially zero) and the next 4 bytes be zero. The bytes after that
should be random. (not necessarily cryptographically secure, just for
establishing a unique echo response in the 3rd round of packets).
Signed-off-by: Rémi Duraffort <ivoire@videolan.org>
p_write[0] = RTMP_HANDSHAKE;
for( i = 0; i < RTMP_HANDSHAKE_BODY_SIZE; i++ )
- p_write[i + 1] = i & 0xFF;
+ {
+ if (i < 8)
+ {
+ p_write[i + 1] = 0x00;
+ } else {
+ p_write[i + 1] = rand() & 0xFF;
+ }
+ }
/* Send handshake*/
i_ret = net_Write( p_this, fd, NULL, p_write, RTMP_HANDSHAKE_BODY_SIZE + 1 );