]> granicus.if.org Git - rtmpdump/commitdiff
Fix default ports
authorhyc <hyc@400ebc74-4327-4243-bc38-086b20814532>
Wed, 10 Mar 2010 07:04:29 +0000 (07:04 +0000)
committerhyc <hyc@400ebc74-4327-4243-bc38-086b20814532>
Wed, 10 Mar 2010 07:04:29 +0000 (07:04 +0000)
git-svn-id: svn://svn.mplayerhq.hu/rtmpdump/trunk@320 400ebc74-4327-4243-bc38-086b20814532

rtmpdump.c
rtmpgw.c

index 39e51ba45546984ec42c12b6f98b8a55b5e5d46c..a15d4eca6166b5ad987c77ccf222bb20370b94f0 100644 (file)
@@ -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,
index 88156d125fe1679e374962a3d63fa87332d2718f..a4a8efa5badb93def673da30c8385ffa5c3b9344 100644 (file)
--- 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)