[FFmpeg-devel] [PATCH] Properly handle cookies that specify sub-domain where the URL.
Eli Kara
eli at algotec.co.il
Thu Jan 23 09:34:20 CET 2014
> > While I don't remember the C boolean type, I just wanted to note that the variable is only used once and therefore probably unneeded.
>
> > Please remove the tabs and consider to shorten the comment lines.
>
> You don't remember it because it doesn't exist (smiles). I did check
> the C standard and it clearly states that relational operators return 1 or 0 with type int, so my comment is relevant to C++ only, sorry about that.
>
> I still think it is clearer with the leading_dot variable. You could place the statement inside the call to av_strdup but that would look unintelligible IMO.
> The other alternative would be another if or conditional statement.
>
> I'll wait a while longer to see if anyone else has any comments on this..
> IMHO feel free to leave the variable in there
Done. Here is the revised patch, please take a look whenever is convenient.
I have a few small question though -
What happens when a patch gets applied ? Is it mirrored on Github or just on the original git repository in ffmpeg's site?
Also, if patch fixes a known bug in the tracker, who's responsibility is it to close it ?
Thanks,
Eli
---
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(¶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) ||
--
1.8.3.msysgit.0
More information about the ffmpeg-devel
mailing list