[rtmpdump] [PATCH] HTTP Proxy Support

Daniel Burr dburr at topcon.com
Mon Aug 16 10:11:31 CEST 2010


On 16/08/10 12:22, Howard Chu wrote:
>> The remainder of the changes in the patch are to:
>> 1.  Add a new command line argument (--http) to rtmpdump and rtmpgw to
>> allow the HTTP proxy to be specified.
>> 2.  Add a new struct (RTMPSockInfo) which is used to store target
>> server, SOCKS proxy and HTTP proxy information so that they can be
>> easily treated in a generic fashion.
>
> Thanks, I've been thinking we need this functionality for a while. But, for
> compatibility with other apps like wget and curl, you should have just used
> getenv("http_proxy") for the proxy server info in librtmp. I guess adding an
> option for rtmpdump may be useful, but at this point rtmpdump's importance is
> greatly diminished now that ffmpeg and curl support librtmp.

Hello again,

Here is a modified version of my patch which uses the http_proxy 
environment variable instead of command line arguments to specify the 
HTTP proxy.  This patch also includes extra checking for the HTTP 
response code in HTTP_read().  This checking is required to prevent an 
infinite loop when it has a value not equal to 200.

An example of the conditions which can lead to this is as follows:
1. An RTMPT connection is established via HTTP proxy, handshaking occurs 
successfully, data begins to be written to disk correctly
2. A call to ReadN() is made, RTMP_FEATURE_HTTP is set, so it loops 
while(!r->m_resplen)
3. At first sb_size is less than 144, so data is read by RTMPSockBuf_Fill()
4. The data read from the server is not the expected "200 OK" response 
to the previously sent RTMPT_SEND request but is some other code (e.g. 
due to exceeding a bandwidth limit)
5. HTTP_read() is called and returns -1 immediately because the 
substring "HTTP/1.1 200" does not match (therefore m_resplen is not updated)
6. Control returns to the top of the while(!r->m_resplen) loop which 
still evaluates as true
7. sb_size is now greater than 144 so no more data is attempted to be read
8. Go to (5)

The approach I took was to make HTTP_read() return a special value to 
indicate that the wrong response code was found which can be used to 
break out of the loop in this case.

DB

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-http-proxy2.patch
Type: text/x-patch
Size: 13033 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/rtmpdump/attachments/20100816/521a3556/attachment.bin>


More information about the rtmpdump mailing list