I think I found a bug in function SendRTMP, which could lead to<br>download failure.<br><br>Steps to reproduce:<br><br>- find a program whose playpath contains more than 128 characters.<br>  (<a href="http://justin.tv">justin.tv</a> requires a auth token, which contains more than 400<br>
  characters)<br><br>- FCSubscribe packets generated by rtmpdump will not contain &#39;\xc3&#39;<br>  (but FCSubscribe packets generated by mozilla will contain &#39;\xc3&#39;) <br><br>- server will be confused, and rtmpdump will fail.<br>
<br>Facts in the code<br><br>- after connect succeed, m_chunkSize will change to some large value<br><br>- SendRTMP depends on m_chunkSize. And this is wrong according to the<br>spec of RTMP (pp.16 of rtmp_specification_1.0.pdf):<br>
<br>    &quot;Chunk size is maintained independently for each direction.&quot;<br><br>So SendRTMP should always use 128 for nChunkSize. Here is the patch:<br><br>--- rtmp.cpp    (revision 58)<br>+++ rtmp.cpp    (working copy)<br>
@@ -1830,12 +1830,10 @@<br>   nSize = packet.m_nBodySize;<br>   char *buffer = packet.m_body;<br> <br>+  int nChunkSize = 128&lt;packet.m_nBodySize ? 128 : packet.m_nBodySize;<br>   while (nSize)<br>   {<br>-    int nChunkSize = packet.m_packetType == 0x14?m_chunkSize:packet.m_nBodySize;<br>
     int wrote;<br>-    if (nSize &lt; m_chunkSize)<br>-      nChunkSize = nSize;<br> <br>     if (header) {<br>       wrote=WriteN(header, nChunkSize+hSize);<br><br>Some comments on this line:<br><br>int nChunkSize = packet.m_packetType == 0x14?m_chunkSize:packet.m_nBodySize;<br>
<br>- it is in the loop, but stay unchanged during the loop<br><br>In other words, code here was a quick hack. So it is likely that it<br>contain some bug.<br><br>