Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#4846 closed defect (fixed)

New ffmpeg build lose full cookies support (HLS,APPLEHTTP)

Reported by: infologique Owned by:
Priority: important Component: avformat
Version: git-master Keywords: hls regression
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

Summary of the bug:

Since kodi 15.0+ my addon can't play HTTPS HLS stream when server use cookies to authenticate client. It's look like Cookie Jar (session) is not kept, I reproduced the problem with MPV for windows (I use Windows 10) (http://mpv.srsfckn.biz/) version 2015-09-03, but it's work perfectly with Kodi 14 and MPV 2015-06-10...

With Kodi, ive tried to determine the source of my bug. I used fiddler to analyse HTTP trafic.

My results :

With kodi 14:

Call 1:

GET master.m3u8?hdnea=st=1442110578~exp=1442110643~acl=/i/012/mp4/i/2015-09-10_19_29_30_infoman_0406_*~hmac=e65e5c1f99490dc7eb6f4735e71f64620b90fa7aa5a2d25d889d2a85e1454867 HTTP/1.1

Return :

Response sent 210 bytes of Cookie data:

Set-Cookie: hdntl=exp=1442197043~acl=%2fi%2f012%2fmp4%2fi%2f2015-09-10_19_29_30_infoman_0406_*~data=hdntl~hmac=38c574b93b9b455c9301b734a34eeeb87ef5fd290bd308a92ecf0c7ec277f467; path=/; domain=toutvuniver1-vh.akamaihd.net;

Response sent 156 bytes of Cookie data:

Set-Cookie: _alid_=YsRWYon6GP4YDxu2iRsAmA==; path=/i/012/mp4/i/2015-09-10_19_29_30_infoman_0406_,500,800,1200,2000,3000,.mp4.csmil/; domain=toutvuniver1-vh.akamaihd.net

ffmpeg correctly send back these cookies during call 2 and 3 :

Call 2 :

GET index_0_av.m3u8

(Cookie: hdntl=exp=1442196982~acl=%2fi%2f012%2fmp4%2fi%2f2015-09-10_19_29_30_infoman_0406_*~data=hdntl~hmac=3eb50bfcada9e8a2c7f67bb9dd5cfd6519690b3360da52631667539abe70f7f1; _alid_=dLmmkHrWidM4JpXfr/wOwQ==; hdntl=exp=1442197043~acl=%2fi%2f012%2fmp4%2fi%2f2015-09-10_19_29_30_infoman_0406_*~data=hdntl~hmac=38c574b93b9b455c9301b734a34eeeb87ef5fd290bd308a92ecf0c7ec277f467; _alid_=YsRWYon6GP4YDxu2iRsAmA==)

Call 3:

GET crypt.key?null=&id=AgDA3ocUzF6bt7Pc9FVCEtLRCQK5cl1HWgwsv0NW8kav4ATDiVGkvfVQlERx6+dVH5BMgsFvpk644Q%3d%3d HTTP/1.1

(Cookie: hdntl=exp=1442196982~acl=%2fi%2f012%2fmp4%2fi%2f2015-09-10_19_29_30_infoman_0406_*~data=hdntl~hmac=3eb50bfcada9e8a2c7f67bb9dd5cfd6519690b3360da52631667539abe70f7f1; _alid_=dLmmkHrWidM4JpXfr/wOwQ==; hdntl=exp=1442197043~acl=%2fi%2f012%2fmp4%2fi%2f2015-09-10_19_29_30_infoman_0406_*~data=hdntl~hmac=38c574b93b9b455c9301b734a34eeeb87ef5fd290bd308a92ecf0c7ec277f467; _alid_=YsRWYon6GP4YDxu2iRsAmA==)

Crypt key value : z��.��O"$Hb�


But since kodi 15 (i tried 15.0, 15.1, 15.2 and 16 RC1)

Call 1 is identical :

GET master.m3u8?hdnea=st=1442110872~exp=1442110937~acl=/i/012/mp4/i/2015-09-10_19_29_30_infoman_0406_*~hmac=3f7f04a637bf5178a8d3649b3b4d02ace5108c53b9baa1771938137d3cc6df3a HTTP/1.1

Return (it's barely identical):

Response sent 210 bytes of Cookie data:

Set-Cookie: hdntl=exp=1442197276~acl=%2fi%2f012%2fmp4%2fi%2f2015-09-10_19_29_30_infoman_0406_*~data=hdntl~hmac=b4a4b8cc0f8bce3fdc07cb96dc11bbbd976057e1e1ef717b0198656580a0aacc; path=/; domain=toutvuniver1-vh.akamaihd.net;

Response sent 156 bytes of Cookie data:

Set-Cookie: _alid_=s4xlmE7ZjxkyCWG0q4svqw==; path=/i/012/mp4/i/2015-09-10_19_29_30_infoman_0406_,500,800,1200,2000,3000,.mp4.csmil/; domain=toutvuniver1-vh.akamaihd.net

Call 2 :

Now ffmpeg select index 4 by itself (based on client bandwidth), it's ok.

GET index_4_av.m3u8?null=&id=AgDA3ocUzF6bvpzd9FXbqEsGltYruWZsB1+VoSG%2f6EY0o5fzdEb4zcAO26Diyi6KS6PnxY0IhWhX7Q%3d%3d HTTP/1.1

(Cookie: hdntl=exp=1442197276~acl=%2fi%2f012%2fmp4%2fi%2f2015-09-10_19_29_30_infoman_0406_*~data=hdntl~hmac=b4a4b8cc0f8bce3fdc07cb96dc11bbbd976057e1e1ef717b0198656580a0aacc; _alid_=s4xlmE7ZjxkyCWG0q4svqw==)

Call 3 :

GET crypt.key?null=&id=AgDA3ocUzF6bvpzd9FXbqEsGltYruWZsB1+VoSG%2f6EY0o5fzdEb4zcAO26Diyi6KS6PnxY0IhWhX7Q%3d%3d HTTP/1.1

(Cookie: _alid_=s4xlmE7ZjxkyCWG0q4svqw==) <<<<< Very tiny !!

this time the server response is:

403 Forbidden

<HTML><HEAD> <TITLE>Access Denied</TITLE> </HEAD><BODY> <H1>Access Denied</H1> You don't have permission to access "crypt&#46;key&#63;" on this server.<P> Reference&#32;&#35;18&#46;be9b5ecc&#46;1442110876&#46;126fa </BODY> </HTML>

I think the new version of ffmpeg is broken... but I really need that feature for playing akamaihd content...


Here, copy of MPV output log :

Playing: https://toutvuniver1-vh.akamaihd.net/i/012/mp4/c/2015-09-11_19_00_00_cheforeille_0001_,500,800,1200,2000,3000,.mp4.csmil/master.m3u8?hdnea=st=1442150589~exp=1444742589~acl=/i/012/mp4/c/2015-09-11_19_00_00_cheforeille_0001_*~hmac=84d9371012603adc84fc95b49714153067267921e1fd1657aa4dbde37a135c90
[ytdl_hook] youtube-dl not found, not executable, or broken.
[ffmpeg] https: No trailing CRLF found in HTTP header.
[ffmpeg] http: HTTP error 403 Forbidden
[ffmpeg] crypto: Unable to open resource: http://toutvuniver1-vh.akamaihd.net/i/012/mp4/c/2015-09-11_19_00_00_cheforeille_0001_,500,800,1200,2000,3000,.mp4.csmil/segment1_0_av.ts?null=&id=AgDA3ocUuFTzZP6D9VV5ld2XSNbwaxOqUHkw%2feJpYrOKgj8wqLoFRAOsOOERNS3DwNm8gM5Ya1xYug%3d%3d
[ffmpeg/demuxer] hls,applehttp: Failed to open segment of playlist 0
[ffmpeg] http: HTTP error 403 Forbidden
[ffmpeg] crypto: Unable to open resource: http://toutvuniver1-vh.akamaihd.net/i/012/mp4/c/2015-09-11_19_00_00_cheforeille_0001_,500,800,1200,2000,3000,.mp4.csmil/segment2_0_av.ts?null=&id=AgDA3ocUuFTzZP6D9VV5ld2XSNbwaxOqUHkw%2feJpYrOKgj8wqLoFRAOsOOERNS3DwNm8gM5Ya1xYug%3d%3d


How to reproduce:

Call this page, with your browser :
http://infologique.net/api/ici/

and start playing the generated url (may possibly work only in canada... I don't know)

Change History (9)

comment:1 follow-up: Changed 4 years ago by cehoyos

  • Keywords hls regression added; HLS AppleHTTP cookies removed

Please verify if this is a regression since da7759b3579de3e98deb1ac58e642b861280ba54 / a duplicate of ticket #4797.
Currently, this has no similarities with a valid ticket;-(

comment:2 in reply to: ↑ 1 Changed 4 years ago by infologique

Replying to cehoyos:

Please verify if this is a regression since da7759b3579de3e98deb1ac58e642b861280ba54 / a duplicate of ticket #4797.
Currently, this has no similarities with a valid ticket;-(

Not really similar to ticket #4797, but the most similar ticket seems to be the #4808. You think my ticket is not valid? I'm only a ffmpeg user, and a simple C# coder... you can't reproduce ?

comment:3 Changed 4 years ago by gjdfgh

You think my ticket is not valid?

Ignore this. I can confirm this bug. I'll try to fix it as soon as I have time, if nobody else does.

comment:4 Changed 4 years ago by cehoyos

  • Component changed from undetermined to avformat
  • Reproduced by developer set
  • Resolution set to duplicate
  • Status changed from new to closed
  • Version changed from unspecified to git-master

Indeed a duplicate of ticket #4797.

comment:5 Changed 4 years ago by gjdfgh

This is caused by commit 0c73a5a53cc97f4291bbe9e1e68226edf6161744.

comment:6 Changed 4 years ago by cehoyos

  • Resolution duplicate deleted
  • Status changed from closed to reopened

comment:7 Changed 4 years ago by gjdfgh

Fixed via 26eb2940079d0ec433cf9b2deae24560707cbcf8. (At least this specific case.)

comment:8 Changed 4 years ago by cehoyos

  • Resolution set to fixed
  • Status changed from reopened to closed

comment:9 Changed 4 years ago by infologique

It will be merged into 2.8-branch ? Otherwise in which release commit 26eb2940079d0ec433cf9b2deae24560707cbcf8 will be available? Thanks!

Note: See TracTickets for help on using tickets.