Skip to content
Permalink
Browse files

HTTP Proxy Support

http://stream-recorder.com/forum/compile-rtmpdump-windows-http-proxy-support-applying-t11027.html
http://lists.mplayerhq.hu/pipermail/rtmpdump/2010-August/001133.html

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.
  • Loading branch information...
Daniel Burr authored and cup committed Aug 16, 2010
1 parent 4e06e21 commit a44921b6aa5ed3a1ffd2f5f4983e7d724d3c2e5d
Showing with 931 additions and 154 deletions.
  1. +6 −3 librtmp/amf.c
  2. +1 −1 librtmp/dh.h
  3. +12 −2 librtmp/handshake.h
  4. +2 −2 librtmp/hashswf.c
  5. +2 −2 librtmp/log.c
  6. +457 −90 librtmp/rtmp.c
  7. +17 −5 librtmp/rtmp.h
  8. +1 −1 librtmp/rtmp_sys.h
  9. +16 −9 rtmpdump.c
  10. +11 −3 rtmpgw.c
  11. +164 −7 rtmpsrv.c
  12. +242 −29 rtmpsuck.c
@@ -610,6 +610,9 @@ AMFProp_Decode(AMFObjectProperty *prop, const char *pBuffer, int nSize,
return -1;
}

if (*pBuffer == AMF_NULL)
bDecodeName = 0;

if (bDecodeName && nSize < 4)
{ /* at least name (length + at least 1 byte) and 1 byte of data */
RTMP_Log(RTMP_LOGDEBUG,
@@ -801,8 +804,8 @@ AMFProp_Dump(AMFObjectProperty *prop)
}
else
{
name.av_val = "no-name.";
name.av_len = sizeof("no-name.") - 1;
name.av_val = "no-name";
name.av_len = sizeof("no-name") - 1;
}
if (name.av_len > 18)
name.av_len = 18;
@@ -1121,7 +1124,7 @@ AMF_GetProp(AMFObject *obj, const AVal *name, int nIndex)
{
if (nIndex >= 0)
{
if (nIndex <= obj->o_num)
if (nIndex < obj->o_num)
return &obj->o_props[nIndex];
}
else
@@ -61,7 +61,7 @@ static int MDH_generate_key(MDH *dh)
MP_set(&dh->ctx.P, dh->p);
MP_set(&dh->ctx.G, dh->g);
dh->ctx.len = 128;
dhm_make_public(&dh->ctx, 1024, out, 1, havege_rand, &RTMP_TLS_ctx->hs);
dhm_make_public(&dh->ctx, 1024, out, 1, havege_random, &RTMP_TLS_ctx->hs);
MP_new(dh->pub_key);
MP_new(dh->priv_key);
MP_set(dh->pub_key, &dh->ctx.GX);
@@ -962,8 +962,18 @@ HandShake(RTMP * r, int FP9HandShake)
__FUNCTION__);
RTMP_LogHex(RTMP_LOGDEBUG, reply, RTMP_SIG_SIZE);
#endif
if (!WriteN(r, (char *)reply, RTMP_SIG_SIZE))
return FALSE;
if (r->Link.CombineConnectPacket)
{
char *HandshakeResponse = malloc(RTMP_SIG_SIZE);
memcpy(HandshakeResponse, (char *) reply, RTMP_SIG_SIZE);
r->Link.HandshakeResponse.av_val = HandshakeResponse;
r->Link.HandshakeResponse.av_len = RTMP_SIG_SIZE;
}
else
{
if (!WriteN(r, (char *) reply, RTMP_SIG_SIZE))
return FALSE;
}

/* 2nd part of handshake */
if (ReadN(r, (char *)serversig, RTMP_SIG_SIZE) != RTMP_SIG_SIZE)
@@ -70,7 +70,7 @@ extern TLS_CTX RTMP_TLS_ctx;

#endif /* CRYPTO */

#define AGENT "Mozilla/5.0"
#define AGENT "Mozilla/5.0 (Windows NT 5.1; rv:8.0) Gecko/20100101 Firefox/8.0"

HTTPResult
HTTP_get(struct HTTP_ctx *http, const char *url, HTTP_read_callback *cb)
@@ -528,7 +528,7 @@ RTMP_HashSWF(const char *url, unsigned int *size, unsigned char *hash,

if (strncmp(buf, "url: ", 5))
continue;
if (strncmp(buf + 5, url, hlen))
if (strncmp(buf + 5, url, strlen(buf + 5) - 1))
continue;
r1 = strrchr(buf, '/');
i = strlen(r1);
@@ -52,8 +52,8 @@ static void rtmp_log_default(int level, const char *format, va_list vl)
vsnprintf(str, MAX_PRINT_LEN-1, format, vl);

/* Filter out 'no-name' */
if ( RTMP_debuglevel<RTMP_LOGALL && strstr(str, "no-name" ) != NULL )
return;
if (RTMP_debuglevel < RTMP_LOGDEBUG && strstr(str, "no-name") != NULL)
return;

if ( !fmsg ) fmsg = stderr;

0 comments on commit a44921b

Please sign in to comment.
You can’t perform that action at this time.