[rtmpdump] r133 - in trunk: rtmpdump.c streams.c swfvfy.c

hyc subversion at mplayerhq.hu
Tue Dec 29 23:47:19 CET 2009


Author: hyc
Date: Tue Dec 29 23:47:18 2009
New Revision: 133

Log:
Add "ask" param, don't talk to HTTP server if we already have cached hash

Modified:
   trunk/rtmpdump.c
   trunk/streams.c
   trunk/swfvfy.c

Modified: trunk/rtmpdump.c
==============================================================================
--- trunk/rtmpdump.c	Tue Dec 29 23:45:11 2009	(r132)
+++ trunk/rtmpdump.c	Tue Dec 29 23:47:18 2009	(r133)
@@ -47,7 +47,7 @@
 
 #ifdef CRYPTO
 #define HASHLEN	32
-extern int SWFVerify(const char *url, unsigned int *size, unsigned char *hash);
+extern int SWFVerify(const char *url, unsigned int *size, unsigned char *hash, int ask);
 #endif
 
 #define RTMPDUMP_VERSION	"v2.0"
@@ -1289,7 +1289,7 @@ main(int argc, char **argv)
 	  }
         case 'W':
 	  STR2AVAL(swfUrl, optarg);
-          if (SWFVerify(optarg, &swfSize, hash) == 0)
+          if (SWFVerify(optarg, &swfSize, hash, 1) == 0)
             {
               swfHash.av_val = (char *)hash;
               swfHash.av_len = HASHLEN;

Modified: trunk/streams.c
==============================================================================
--- trunk/streams.c	Tue Dec 29 23:45:11 2009	(r132)
+++ trunk/streams.c	Tue Dec 29 23:47:18 2009	(r133)
@@ -39,7 +39,7 @@
 
 #ifdef CRYPTO
 #define HASHLEN	32
-extern int SWFVerify(const char *url, unsigned int *size, unsigned char *hash);
+extern int SWFVerify(const char *url, unsigned int *size, unsigned char *hash, int ask);
 #endif
 
 #define RTMPDUMP_STREAMS_VERSION	"v2.0"
@@ -947,7 +947,7 @@ ParseOption(char opt, char *arg, RTMP_RE
         unsigned char hash[HASHLEN];
 
         STR2AVAL(req->swfUrl, arg);
-        if (SWFVerify(arg, &req->swfSize, hash) == 0)
+        if (SWFVerify(arg, &req->swfSize, hash, 1) == 0)
           {
             req->swfHash.av_val = malloc(HASHLEN);
             req->swfHash.av_len = HASHLEN;

Modified: trunk/swfvfy.c
==============================================================================
--- trunk/swfvfy.c	Tue Dec 29 23:45:11 2009	(r132)
+++ trunk/swfvfy.c	Tue Dec 29 23:47:18 2009	(r133)
@@ -219,7 +219,7 @@ leave:
 #define HEX2BIN(a)      (((a)&0x40)?((a)&0xf)+9:((a)&0xf))
 
 int
-SWFVerify(const char *url, unsigned int *size, unsigned char *hash)
+SWFVerify(const char *url, unsigned int *size, unsigned char *hash, int ask)
 {
   FILE *f = NULL;
   char *path, *home, date[64];
@@ -288,6 +288,9 @@ SWFVerify(const char *url, unsigned int 
         }
     }
 
+  if (got && !ask)
+    return 0;
+
   in.first = 1;
   in.date = date;
   HMAC_CTX_init(&ctx);


More information about the rtmpdump mailing list