From da25a6573f9c2faa557a86a6f9cd6f73ca233b54 Mon Sep 17 00:00:00 2001 From: Eli Kara Date: Thu, 23 Jan 2014 08:34:20 +0000 Subject: [PATCH] avformat/http: Properly handle cookies that specify sub-domain where the URL. Fixes ticket #3336 Signed-off-by: Michael Niedermayer --- libavformat/http.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavformat/http.c b/libavformat/http.c index 3b655c66732d1..69c4d6d7a097c 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(¶m[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(¶m[7]); + cdomain = av_strdup(¶m[7+leading_dot]); } else if (!av_strncasecmp("secure", param, 6) || !av_strncasecmp("comment", param, 7) || !av_strncasecmp("max-age", param, 7) ||