From 50d0c37f51c355fc3078dedd8ab17f489046f2af Mon Sep 17 00:00:00 2001 From: hyc Date: Wed, 10 Mar 2010 07:04:29 +0000 Subject: [PATCH] Fix default ports git-svn-id: svn://svn.mplayerhq.hu/rtmpdump/trunk@320 400ebc74-4327-4243-bc38-086b20814532 --- rtmpdump.c | 22 ++++++++++++++-------- rtmpgw.c | 28 +++++++++++++++++----------- 2 files changed, 31 insertions(+), 19 deletions(-) diff --git a/rtmpdump.c b/rtmpdump.c index 39e51ba..a15d4ec 100644 --- a/rtmpdump.c +++ b/rtmpdump.c @@ -1607,22 +1607,28 @@ main(int argc, char **argv) return RD_FAILED; } + if (protocol == RTMP_PROTOCOL_UNDEFINED) + { + Log(LOGWARNING, + "You haven't specified a protocol (--protocol) or rtmp url (-r), using default protocol RTMP"); + protocol = RTMP_PROTOCOL_RTMP; + } if (port == -1) { Log(LOGWARNING, "You haven't specified a port (--port) or rtmp url (-r), using default port 1935"); - port = 1935; + port = 0; } if (port == 0) { - port = 1935; - } - if (protocol == RTMP_PROTOCOL_UNDEFINED) - { - Log(LOGWARNING, - "You haven't specified a protocol (--protocol) or rtmp url (-r), using default protocol RTMP"); - protocol = RTMP_PROTOCOL_RTMP; + if (protocol & RTMP_FEATURE_SSL) + port = 443; + else if (protocol & RTMP_FEATURE_HTTP) + port = 80; + else + port = 1935; } + if (flvFile == 0) { Log(LOGWARNING, diff --git a/rtmpgw.c b/rtmpgw.c index 88156d1..a4a8efa 100644 --- a/rtmpgw.c +++ b/rtmpgw.c @@ -673,32 +673,38 @@ void processTCPrequest(STREAMING_SERVER * server, // server socket and state (ou goto filenotfound;; } - if (req.rtmpport == -1) - { - Log(LOGWARNING, - "You haven't specified a port (--port) or rtmp url (-r), using default port 1935"); - req.rtmpport = 1935; - } if (req.protocol == RTMP_PROTOCOL_UNDEFINED) { Log(LOGWARNING, "You haven't specified a protocol (--protocol) or rtmp url (-r), using default protocol RTMP"); req.protocol = RTMP_PROTOCOL_RTMP; } + if (req.rtmpport == -1) + { + Log(LOGWARNING, + "You haven't specified a port (--port) or rtmp url (-r), using default port"); + req.rtmpport = 0; + } + if (req.rtmpport == 0) + { + if (req.protocol & RTMP_FEATURE_SSL) + req.rtmpport = 443; + else if (req.protocol & RTMP_FEATURE_HTTP) + req.rtmpport = 80; + else + req.rtmpport = 1935; + } if (req.tcUrl.av_len == 0 && req.app.av_len != 0) { char str[512] = { 0 }; - snprintf(str, 511, "%s://%s/%s", RTMPProtocolStringsLower[req.protocol], - req.hostname, req.app.av_val); + snprintf(str, 511, "%s://%s:%d/%s", RTMPProtocolStringsLower[req.protocol], + req.hostname, req.rtmpport, req.app.av_val); req.tcUrl.av_len = strlen(str); req.tcUrl.av_val = (char *) malloc(req.tcUrl.av_len + 1); strcpy(req.tcUrl.av_val, str); } - if (req.rtmpport == 0) - req.rtmpport = 1935; - if (req.swfVfy) { if (RTMP_HashSWF(req.swfUrl.av_val, &req.swfSize, req.hash, req.swfAge) == 0) -- 2.40.0