Skip to content
This repository was archived by the owner on Aug 23, 2021. It is now read-only.

Commit a44921b

Browse files
Daniel BurrSteven Penny
authored andcommitted
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.
1 parent 4e06e21 commit a44921b

File tree

12 files changed

+931
-154
lines changed

12 files changed

+931
-154
lines changed

librtmp/amf.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,9 @@ AMFProp_Decode(AMFObjectProperty *prop, const char *pBuffer, int nSize,
610610
return -1;
611611
}
612612

613+
if (*pBuffer == AMF_NULL)
614+
bDecodeName = 0;
615+
613616
if (bDecodeName && nSize < 4)
614617
{ /* at least name (length + at least 1 byte) and 1 byte of data */
615618
RTMP_Log(RTMP_LOGDEBUG,
@@ -801,8 +804,8 @@ AMFProp_Dump(AMFObjectProperty *prop)
801804
}
802805
else
803806
{
804-
name.av_val = "no-name.";
805-
name.av_len = sizeof("no-name.") - 1;
807+
name.av_val = "no-name";
808+
name.av_len = sizeof("no-name") - 1;
806809
}
807810
if (name.av_len > 18)
808811
name.av_len = 18;
@@ -1121,7 +1124,7 @@ AMF_GetProp(AMFObject *obj, const AVal *name, int nIndex)
11211124
{
11221125
if (nIndex >= 0)
11231126
{
1124-
if (nIndex <= obj->o_num)
1127+
if (nIndex < obj->o_num)
11251128
return &obj->o_props[nIndex];
11261129
}
11271130
else

librtmp/dh.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ static int MDH_generate_key(MDH *dh)
6161
MP_set(&dh->ctx.P, dh->p);
6262
MP_set(&dh->ctx.G, dh->g);
6363
dh->ctx.len = 128;
64-
dhm_make_public(&dh->ctx, 1024, out, 1, havege_rand, &RTMP_TLS_ctx->hs);
64+
dhm_make_public(&dh->ctx, 1024, out, 1, havege_random, &RTMP_TLS_ctx->hs);
6565
MP_new(dh->pub_key);
6666
MP_new(dh->priv_key);
6767
MP_set(dh->pub_key, &dh->ctx.GX);

librtmp/handshake.h

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -962,8 +962,18 @@ HandShake(RTMP * r, int FP9HandShake)
962962
__FUNCTION__);
963963
RTMP_LogHex(RTMP_LOGDEBUG, reply, RTMP_SIG_SIZE);
964964
#endif
965-
if (!WriteN(r, (char *)reply, RTMP_SIG_SIZE))
966-
return FALSE;
965+
if (r->Link.CombineConnectPacket)
966+
{
967+
char *HandshakeResponse = malloc(RTMP_SIG_SIZE);
968+
memcpy(HandshakeResponse, (char *) reply, RTMP_SIG_SIZE);
969+
r->Link.HandshakeResponse.av_val = HandshakeResponse;
970+
r->Link.HandshakeResponse.av_len = RTMP_SIG_SIZE;
971+
}
972+
else
973+
{
974+
if (!WriteN(r, (char *) reply, RTMP_SIG_SIZE))
975+
return FALSE;
976+
}
967977

968978
/* 2nd part of handshake */
969979
if (ReadN(r, (char *)serversig, RTMP_SIG_SIZE) != RTMP_SIG_SIZE)

librtmp/hashswf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ extern TLS_CTX RTMP_TLS_ctx;
7070

7171
#endif /* CRYPTO */
7272

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

7575
HTTPResult
7676
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,
528528

529529
if (strncmp(buf, "url: ", 5))
530530
continue;
531-
if (strncmp(buf + 5, url, hlen))
531+
if (strncmp(buf + 5, url, strlen(buf + 5) - 1))
532532
continue;
533533
r1 = strrchr(buf, '/');
534534
i = strlen(r1);

librtmp/log.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ static void rtmp_log_default(int level, const char *format, va_list vl)
5252
vsnprintf(str, MAX_PRINT_LEN-1, format, vl);
5353

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

5858
if ( !fmsg ) fmsg = stderr;
5959

0 commit comments

Comments
 (0)