[FFmpeg-cvslog] libavformat/hls: Observe Set-Cookie headers

Micah Galizia git at videolan.org
Mon May 29 03:45:44 EEST 2017


ffmpeg | branch: master | Micah Galizia <micahgalizia at gmail.com> | Tue May 16 21:37:31 2017 -0400| [c4c73020f4bbf261f0b263be82de575c17fa5a60] | committer: Michael Niedermayer

libavformat/hls: Observe Set-Cookie headers

Signed-off-by: Micah Galizia <micahgalizia at gmail.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavformat/hls.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/libavformat/hls.c b/libavformat/hls.c
index 0c7283d974..4b8fb19a52 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -630,8 +630,16 @@ static int open_url(AVFormatContext *s, AVIOContext **pb, const char *url,
     ret = s->io_open(s, pb, url, AVIO_FLAG_READ, &tmp);
     if (ret >= 0) {
         // update cookies on http response with setcookies.
-        void *u = (s->flags & AVFMT_FLAG_CUSTOM_IO) ? NULL : s->pb;
-        update_options(&c->cookies, "cookies", u);
+        char *new_cookies = NULL;
+
+        if (!(s->flags & AVFMT_FLAG_CUSTOM_IO))
+            av_opt_get(*pb, "cookies", AV_OPT_SEARCH_CHILDREN, (uint8_t**)&new_cookies);
+
+        if (new_cookies) {
+            av_free(c->cookies);
+            c->cookies = new_cookies;
+        }
+
         av_dict_set(&opts, "cookies", c->cookies, 0);
     }
 



More information about the ffmpeg-cvslog mailing list