From dfc78137a3feb528be1a5657e475c3a4425d4365 Mon Sep 17 00:00:00 2001 From: hyc Date: Tue, 29 Dec 2009 22:47:18 +0000 Subject: [PATCH] Add "ask" param, don't talk to HTTP server if we already have cached hash git-svn-id: svn://svn.mplayerhq.hu/rtmpdump/trunk@133 400ebc74-4327-4243-bc38-086b20814532 --- rtmpdump.c | 4 ++-- streams.c | 4 ++-- swfvfy.c | 5 ++++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/rtmpdump.c b/rtmpdump.c index f7ddb0a..0e1c2ec 100644 --- a/rtmpdump.c +++ b/rtmpdump.c @@ -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; diff --git a/streams.c b/streams.c index 0cbc0b9..d66c8bf 100644 --- a/streams.c +++ b/streams.c @@ -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_REQUEST * req) 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; diff --git a/swfvfy.c b/swfvfy.c index 56806e5..1a45955 100644 --- a/swfvfy.c +++ b/swfvfy.c @@ -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 *size, unsigned char *hash) } } + if (got && !ask) + return 0; + in.first = 1; in.date = date; HMAC_CTX_init(&ctx); -- 2.40.0