[rtmpdump] r182 - trunk/hashswf.c

hyc subversion at mplayerhq.hu
Mon Jan 4 12:35:53 CET 2010


Author: hyc
Date: Mon Jan  4 12:35:51 2010
New Revision: 182

Log:
Fix URL matching in file check

Modified:
   trunk/hashswf.c

Modified: trunk/hashswf.c
==============================================================================
--- trunk/hashswf.c	Mon Jan  4 08:59:40 2010	(r181)
+++ trunk/hashswf.c	Mon Jan  4 12:35:51 2010	(r182)
@@ -258,11 +258,20 @@ RTMP_HashSWF(const char *url, unsigned i
   strcat(path, "/.swfinfo");
 
   f = fopen(path, "r+");
-  if (f)
+  while (f)
     {
       char buf[4096], *file;
 
-      file = strrchr(url, '/');
+      file = strchr(url, '/');
+      if (!file)
+        break;
+      file += 2;
+      file = strchr(file, '/');
+      if (!file)
+        break;
+      file++;
+      hlen = file - url;
+      file = strrchr(file, '/');
 
       while (fgets(buf, sizeof(buf), f))
         {
@@ -272,6 +281,8 @@ RTMP_HashSWF(const char *url, unsigned i
 
           if (strncmp(buf, "url: ", 5))
             continue;
+          if (strncmp(buf+5, url, hlen))
+            continue;
           r1 = strrchr(buf, '/');
           i = strlen(r1);
           r1[--i] = '\0';
@@ -304,6 +315,7 @@ RTMP_HashSWF(const char *url, unsigned i
             }
           break;
         }
+      break;
     }
 
   if (got && !ask)


More information about the rtmpdump mailing list