[FFmpeg-user] cookie Syntax help

john Bell jhbell50 at hotmail.com
Wed Aug 14 01:16:19 CEST 2013


I an issuing the following command(with spaces following the ;'s)
 
ffplay -i -cookies "eurosp1sp1keys=t4HxT5V8c4myQle3HO_6YA; eurosp1
sp1keyt=1376432802; path=\; domain=www.hqstream.tv; \n" "http://50.22.223.42/hqs
tream/eurosp1sp1/playlist.m3u8?keys=t4HxT5V8c4myQle3HO_6YA&keyt=1376432802"

and the result is:
ffplay version N-55020-g768e40b Copyright (c) 2003-2013 the FFmpeg developers
 ...
[http @ 03ddac00] Invalid cookie found, no value, path or domain specified
 
I believe the command follows the code requirements as posted below. 
Can anyone tell me where I am going wrong? 
 
The ffmpeg cookie code reads as follows:
 
 438 /** 439  * Create a string containing cookie values for use as a HTTP cookie header 440  * field value for a particular path and domain from the cookie values stored in 441  * the HTTP protocol context. The cookie string is stored in *cookies. 442  * 443  * @return a negative value if an error condition occurred, 0 otherwise 444  */ 445 static int get_cookies(HTTPContext *s, char **cookies, const char *path, 446                        const char *domain) 447 { 448     // cookie strings will look like Set-Cookie header field values.  Multiple 449     // Set-Cookie fields will result in multiple values delimited by a newline 450     int ret = 0; 451     char *next, *cookie, *set_cookies = av_strdup(s->cookies), *cset_cookies = set_cookies; 452  453     if (!set_cookies) return AVERROR(EINVAL); 454  455     *cookies = NULL; 456     while ((cookie = av_strtok(set_cookies, "\n", &next))) { 457         int domain_offset = 0; 458         char *param, *next_param, *cdomain = NULL, *cpath = NULL, *cvalue = NULL; 459         set_cookies = NULL; 460   461         while ((param = av_strtok(cookie, "; ", &next_param))) { 462             cookie = NULL; 463             if        (!av_strncasecmp("path=",   param, 5)) { 464                 av_free(cpath); 465                 cpath = av_strdup(&param[5]); 466             } else if (!av_strncasecmp("domain=", param, 7)) { 467                 av_free(cdomain); 468                 cdomain = av_strdup(&param[7]); 469             } else if (!av_strncasecmp("secure",  param, 6) || 470                        !av_strncasecmp("comment", param, 7) || 471                        !av_strncasecmp("max-age", param, 7) || 472                        !av_strncasecmp("version", param, 7)) { 473                 // ignore Comment, Max-Age, Secure and Version 474             } else { 475                 av_free(cvalue); 476                 cvalue = av_strdup(param); 477             } 478         } 479         if (!cdomain) 480             cdomain = av_strdup(domain); 481  482         // ensure all of the necessary values are valid 483         if (!cdomain || !cpath || !cvalue) { 484             av_log(s, AV_LOG_WARNING, 485                    "Invalid cookie found, no value, path or domain specified\n"); 486             goto done_cookie; 487         } 488  		 	   		  


More information about the ffmpeg-user mailing list