[FFmpeg-devel] [PATCH] lavf/http: print a Cookie header only if get_cookies() creates a string to write

Stefano Sabatini stefasab at gmail.com
Thu Jan 31 21:07:02 CET 2013


Avoid to write "Cookie:(null)" in case there is no path/domain match.

Fix first part of trac ticket #2180.
---
 libavformat/http.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/http.c b/libavformat/http.c
index 0700eac..0c3826f 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -573,7 +573,7 @@ static int http_connect(URLContext *h, const char *path, const char *local_path,
                            "Content-Type: %s\r\n", s->content_type);
     if (!has_header(s->headers, "\r\nCookie: ") && s->cookies) {
         char *cookies = NULL;
-        if (!get_cookies(s, &cookies, path, hoststr)) {
+        if (!get_cookies(s, &cookies, path, hoststr) && cookies) {
             len += av_strlcatf(headers + len, sizeof(headers) - len,
                                "Cookie: %s\r\n", cookies);
             av_free(cookies);
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list