[rtmpdump] [PATCH] Content Length check should be case insensitive

Daniel Burr dburr at topcon.com
Thu Aug 12 07:18:53 CEST 2010

Hello all,

I have found a minor problem in rtmpdump which took me quite a while to 
track down.

In HTTP_read() the following check is done to make sure that the header 
contains a content length field:

    ptr = strstr(r->m_sb.sb_start, "Content-Length:");

Not every HTTP server and proxy uses this exact capitalisation.  In my 
case the response header is:

HTTP/1.1 200 OK
Date: Thu, 12 Aug 2010 03:21:05 GMT
Content-length: 17
Content-type: application/x-fcs
Cache-control: no-cache
Server: FlashCom/3.5.3
Via: 1.1 proxy1
Proxy-agent: Sun-Java-System-Web-Proxy-Server/4.0

The call to strstr() will not match in this case.  It could be be easily 
fixed by replacing strstr() with strcasestr() but this is a GNU 
extension.  To make a portable solution it is necessary to iterate and 
call strncasecmp() like in the attached patch.


Confidentiality Notice:  This message (including attachments) is a private communication solely for use of the intended recipient(s).  
If you are not the intended recipient(s) or believe you received this message in error, notify the sender immediately and then delete this 
message.  Any other use, retention, dissemination or copying is prohibited and may be a violation of law, including the Electronic 
Communication Privacy Act of 1986."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rtmpdump-content-len.patch
Type: text/x-patch
Size: 1023 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/rtmpdump/attachments/20100812/41bdedd9/attachment.bin>

More information about the rtmpdump mailing list