[FFmpeg-cvslog] http: remove cache_redirect option

2022-01-31 Thread erankor
ffmpeg | branch: master | erankor  | Wed Jan 19 
09:04:35 2022 +0200| [f23d3a5f8f7c85df985e6c374cfc99b3ca91aaf6] | committer: 
Ronald S. Bultje

http: remove cache_redirect option

following 625ea2d, redirect caching is performed according to the http
response headers, there's no need to have it as an option -
always start from the original uri, and apply any redirects according
to the redirect_cache dictionary.

Signed-off-by: Ronald S. Bultje 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f23d3a5f8f7c85df985e6c374cfc99b3ca91aaf6
---

 libavformat/http.c| 6 ++
 libavformat/version.h | 1 -
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/libavformat/http.c b/libavformat/http.c
index cf04d3f14f..e8096e3134 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -72,7 +72,6 @@ typedef struct HTTPContext {
 uint64_t off, end_off, filesize;
 char *uri;
 char *location;
-int cache_redirect;
 HTTPAuthState auth_state;
 HTTPAuthState proxy_auth_state;
 char *http_proxy;
@@ -175,7 +174,6 @@ static const AVOption options[] = {
 { "resource", "The resource requested by a client", OFFSET(resource), 
AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, E },
 { "reply_code", "The http status code to return to a client", 
OFFSET(reply_code), AV_OPT_TYPE_INT, { .i64 = 200}, INT_MIN, 599, E},
 { "short_seek_size", "Threshold to favor readahead over seek.", 
OFFSET(short_seek_size), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, D },
-{ "cache_redirect", "Save redirected URL for subsequent seek operations", 
OFFSET(cache_redirect), AV_OPT_TYPE_BOOL, { .i64 = 
FF_HTTP_CACHE_REDIRECT_DEFAULT }, 0, 1, D },
 { NULL }
 };
 
@@ -1938,8 +1936,8 @@ static int64_t http_seek_internal(URLContext *h, int64_t 
off, int whence, int fo
 return s->off;
 }
 
-/* if redirect caching is disabled, revert to the original uri */
-if (!s->cache_redirect && strcmp(s->uri, s->location)) {
+/* if the location changed (redirect), revert to the original uri */
+if (strcmp(s->uri, s->location)) {
 char *new_uri;
 new_uri = av_strdup(s->uri);
 if (!new_uri)
diff --git a/libavformat/version.h b/libavformat/version.h
index bd014e907e..5439dad170 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -60,7 +60,6 @@
 #define FF_API_AVIOCONTEXT_WRITTEN  (LIBAVFORMAT_VERSION_MAJOR < 60)
 #define FF_HLS_TS_OPTIONS   (LIBAVFORMAT_VERSION_MAJOR < 60)
 #define FF_API_AVSTREAM_CLASS   (LIBAVFORMAT_VERSION_MAJOR > 59)
-#define FF_HTTP_CACHE_REDIRECT_DEFAULT  (LIBAVFORMAT_VERSION_MAJOR < 60)
 
 
 #define FF_API_R_FRAME_RATE1

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avformat/http: Fix double-free on error

2022-01-31 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Thu Jan 20 20:18:11 2022 +0100| [61cbfdc0a29e88483a6fa9645f64fec71983689a] | 
committer: Andreas Rheinhardt

avformat/http: Fix double-free on error

av_dict_set() with AV_DICT_DONT_STRDUP_VAL takes ownership
of the string it is passed to as val; this includes freeing it
on error.

Fixes Coverity issue #1497468.

Reviewed-by: Eran Kornblau 
Signed-off-by: Andreas Rheinhardt 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=61cbfdc0a29e88483a6fa9645f64fec71983689a
---

 libavformat/http.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/libavformat/http.c b/libavformat/http.c
index e8096e3134..8f39d11a88 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -333,10 +333,8 @@ static int redirect_cache_set(HTTPContext *s, const char 
*source, const char *de
 }
 
 ret = av_dict_set(&s->redirect_cache, source, value, AV_DICT_MATCH_CASE | 
AV_DICT_DONT_STRDUP_VAL);
-if (ret < 0) {
-av_free(value);
+if (ret < 0)
 return ret;
-}
 
 return 0;
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".