[FFmpeg-cvslog] avformat/http: Properly handle cookies that specify sub-domain where the URL.

Eli Kara git at videolan.org
Thu Jan 23 14:48:45 CET 2014


ffmpeg | branch: master | Eli Kara <eli at algotec.co.il> | Thu Jan 23 08:34:20 2014 +0000| [da25a6573f9c2faa557a86a6f9cd6f73ca233b54] | committer: Michael Niedermayer

avformat/http: Properly handle cookies that specify sub-domain where the URL.

Fixes ticket #3336

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavformat/http.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavformat/http.c b/libavformat/http.c
index 3b655c6..69c4d6d 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -490,8 +490,11 @@ static int get_cookies(HTTPContext *s, char **cookies, const char *path,
                 av_free(cpath);
                 cpath = av_strdup(&param[5]);
             } else if (!av_strncasecmp("domain=", param, 7)) {
+                // if the cookie specifies a sub-domain, skip the leading dot thereby
+                // supporting URLs that point to sub-domains and the master domain
+                int leading_dot = (param[7] == '.');
                 av_free(cdomain);
-                cdomain = av_strdup(&param[7]);
+                cdomain = av_strdup(&param[7+leading_dot]);
             } else if (!av_strncasecmp("secure",  param, 6) ||
                        !av_strncasecmp("comment", param, 7) ||
                        !av_strncasecmp("max-age", param, 7) ||



More information about the ffmpeg-cvslog mailing list