[rtmpdump] r170 - in trunk: rtmp.c rtmp.h rtmpsuck.c
hyc
subversion at mplayerhq.hu
Sun Jan 3 00:10:01 CET 2010
Author: hyc
Date: Sun Jan 3 00:10:00 2010
New Revision: 170
Log:
Fix: handle auth parameters in connect request
Modified:
trunk/rtmp.c
trunk/rtmp.h
trunk/rtmpsuck.c
Modified: trunk/rtmp.c
==============================================================================
--- trunk/rtmp.c Sat Jan 2 04:55:55 2010 (r169)
+++ trunk/rtmp.c Sun Jan 3 00:10:00 2010 (r170)
@@ -944,11 +944,9 @@ SendConnectPacket(RTMP * r)
// add auth string
if (r->Link.auth.av_len)
{
- if (enc+2 >= pend)
+ enc = AMF_EncodeBoolean(enc, pend, r->Link.authflag);
+ if (!enc)
return false;
- *enc++ = 0x01;
- *enc++ = 0x01;
-
enc = AMF_EncodeString(enc, pend, &r->Link.auth);
if (!enc)
return false;
Modified: trunk/rtmp.h
==============================================================================
--- trunk/rtmp.h Sat Jan 2 04:55:55 2010 (r169)
+++ trunk/rtmp.h Sun Jan 3 00:10:00 2010 (r170)
@@ -125,6 +125,7 @@ typedef struct RTMP_LNK
AVal flashVer;
AVal subscribepath;
AVal token;
+ bool authflag;
double seekTime;
uint32_t length;
Modified: trunk/rtmpsuck.c
==============================================================================
--- trunk/rtmpsuck.c Sat Jan 2 04:55:55 2010 (r169)
+++ trunk/rtmpsuck.c Sun Jan 3 00:10:00 2010 (r170)
@@ -189,8 +189,12 @@ ServeInvoke(STREAMING_SERVER *server, RT
{
pval = cobj.o_props[i].p_vu.p_aval;
if (pval.av_val)
- pval.av_val = strdup(pval.av_val);
- LogPrintf("%.*s: %.*s\n", pname.av_len, pname.av_val, pval.av_len, pval.av_val);
+ {
+ pval.av_val = malloc(pval.av_len+1);
+ memcpy(pval.av_val, cobj.o_props[i].p_vu.p_aval.av_val, pval.av_len);
+ pval.av_val[pval.av_len] = '\0';
+ }
+ LogPrintf("%.*s: %s\n", pname.av_len, pname.av_val, pval.av_val);
}
if (AVMATCH(&pname, &av_app))
{
@@ -275,6 +279,19 @@ ServeInvoke(STREAMING_SERVER *server, RT
if (pval.av_val)
free(pval.av_val);
}
+ if (obj.o_num > 3)
+ {
+ server->rc.Link.authflag = AMFProp_GetBoolean(&obj.o_props[3]);
+ if (obj.o_num > 4)
+ {
+ AVal tmp;
+ AMFProp_GetString(&obj.o_props[4], &tmp);
+ server->rc.Link.auth.av_len = tmp.av_len;
+ server->rc.Link.auth.av_val = malloc(tmp.av_len+1);
+ memcpy(server->rc.Link.auth.av_val, tmp.av_val, tmp.av_len);
+ server->rc.Link.auth.av_val[tmp.av_len] = '\0';
+ }
+ }
if (!RTMP_Connect(&server->rc))
{
More information about the rtmpdump
mailing list