[rtmpdump] branch master updated. 1d07cfa Fix socks support for SetupURL
gitolite
gil at avcodec.org
Tue Oct 30 16:45:04 CET 2012
The branch, master has been updated
via 1d07cfa60402ace8472f4661112595f1fe661913 (commit)
from a312ac7770207bd7d07725c1aef43725206e803a (commit)
- Log -----------------------------------------------------------------
commit 1d07cfa60402ace8472f4661112595f1fe661913
Author: Matthew Garrett <mjg59 at srcf.ucam.org>
AuthorDate: Sun Jul 8 16:26:14 2012 -0400
Commit: Howard Chu <hyc at highlandsun.com>
CommitDate: Tue Oct 30 08:44:30 2012 -0700
Fix socks support for SetupURL
SetupURL assigns sockshost but never parses the data. This patch factors
the code out from SetupStream into a common function and adds it to
SetupURL.
diff --git a/librtmp/rtmp.c b/librtmp/rtmp.c
index 76a6b4f..682e3b8 100644
--- a/librtmp/rtmp.c
+++ b/librtmp/rtmp.c
@@ -321,6 +321,31 @@ static const char DEFAULT_FLASH_VER[] = DEF_VERSTR;
const AVal RTMP_DefaultFlashVer =
{ (char *)DEFAULT_FLASH_VER, sizeof(DEFAULT_FLASH_VER) - 1 };
+static void
+SocksSetup(RTMP *r, AVal *sockshost)
+{
+ if (sockshost->av_len)
+ {
+ const char *socksport = strchr(sockshost->av_val, ':');
+ char *hostname = strdup(sockshost->av_val);
+
+ if (socksport)
+ hostname[socksport - sockshost->av_val] = '\0';
+ r->Link.sockshost.av_val = hostname;
+ r->Link.sockshost.av_len = strlen(hostname);
+
+ r->Link.socksport = socksport ? atoi(socksport + 1) : 1080;
+ RTMP_Log(RTMP_LOGDEBUG, "Connecting via SOCKS proxy: %s:%d", r->Link.sockshost.av_val,
+ r->Link.socksport);
+ }
+ else
+ {
+ r->Link.sockshost.av_val = NULL;
+ r->Link.sockshost.av_len = 0;
+ r->Link.socksport = 0;
+ }
+}
+
void
RTMP_SetupStream(RTMP *r,
int protocol,
@@ -385,26 +410,7 @@ RTMP_SetupStream(RTMP *r,
}
#endif
- if (sockshost->av_len)
- {
- const char *socksport = strchr(sockshost->av_val, ':');
- char *hostname = strdup(sockshost->av_val);
-
- if (socksport)
- hostname[socksport - sockshost->av_val] = '\0';
- r->Link.sockshost.av_val = hostname;
- r->Link.sockshost.av_len = strlen(hostname);
-
- r->Link.socksport = socksport ? atoi(socksport + 1) : 1080;
- RTMP_Log(RTMP_LOGDEBUG, "Connecting via SOCKS proxy: %s:%d", r->Link.sockshost.av_val,
- r->Link.socksport);
- }
- else
- {
- r->Link.sockshost.av_val = NULL;
- r->Link.sockshost.av_len = 0;
- r->Link.socksport = 0;
- }
+ SocksSetup(r, sockshost);
if (tcUrl && tcUrl->av_len)
r->Link.tcUrl = *tcUrl;
@@ -757,6 +763,8 @@ int RTMP_SetupURL(RTMP *r, char *url)
(unsigned char *)r->Link.SWFHash, r->Link.swfAge);
#endif
+ SocksSetup(r, &r->Link.sockshost);
+
if (r->Link.port == 0)
{
if (r->Link.protocol & RTMP_FEATURE_SSL)
-----------------------------------------------------------------------
Summary of changes:
librtmp/rtmp.c | 48 ++++++++++++++++++++++++++++--------------------
1 files changed, 28 insertions(+), 20 deletions(-)
hooks/post-receive
--
More information about the rtmpdump
mailing list