hlsdl icon indicating copy to clipboard operation
hlsdl copied to clipboard

[404] Error getting Key-File when string has &

Open finelikewine opened this issue 5 years ago • 3 comments

#EXTM3U #EXT-X-VERSION:3 #EXT-X-TARGETDURATION:5 #EXT-X-MEDIA-SEQUENCE:0 #EXT-X-KEY:METHOD=AES-128,URI="https://websiteurl.com?id=DF4s$t%FvsdEdc&fadk=couk"

Error: Getting key-file [https://websiteurl.com?id=DF4s$t%FvsdEdc&fadk=couk] failed http_code[404]

Not sure if it's a website issue, IP issue, or if it has to do with the & which is preventing HLSDL from getting the key.

finelikewine avatar Jul 28 '20 22:07 finelikewine

nope, same error for me. Havent look into the code yet, but I hope I will be able to fix it, or at least make it possible to supply a keyfile via terminal

Pfuenzle avatar Dec 01 '20 15:12 Pfuenzle

nope, same error for me. Havent look into the code yet, but I hope I will be able to fix it, or at least make it possible to supply a keyfile via terminal

Yes, it would be great to have the ability to supply a keyfile via terminal

glgoose avatar Dec 07 '20 16:12 glgoose

hi, I've already made a few fixes and upgrades on my fork https://github.com/xavave/hlsdl-vs2019, but not this one 1- I would like now to be able to reproduce the issue with '&' key file, would you have a key file within a http(s) url example please? (I would need the m3u8 url) 2- for supplying a keyfile via terminal, what would you suggest ? this provided keyfile would override the original keyfile url?

maybe you could try with this fix in hls.c method fill_key_value:

replace:

           http_code = get_hls_data_from_url(key_url, &key_value, &size, BINKEY, NULL);
           if (es->key_url != key_url) {
               free(key_url);
           }

           if (http_code != 200 || size == 0) {
               MSG_ERROR("Getting key-file [%s] failed http_code[%d].\n", es->key_url, http_code);
               return 1;
           }
[test_winX64.zip](https://github.com/selsta/hlsdl/files/5655285/test_winX64.zip)

with;

          char* oldurl = key_url;
           char* newurl = repl_str(oldurl, "&", "&");

           http_code = get_hls_data_from_url(newurl , &key_value, &size, BINKEY, NULL);
           // http_code = get_hls_data_from_url(key_url, &key_value, &size, BINKEY, NULL);
           if (es->key_url != key_url) {
               free(key_url);
           }

           if (http_code != 200 || size == 0) {
               MSG_ERROR("Getting key-file [%s] failed http_code[%d].\n", es->key_url, http_code);
               return 1;
           }

In test_winX64.zip attachment: I've zipped a windows 64 compiled version of hlsdl with this fix test

xavave avatar Dec 07 '20 19:12 xavave