[FFmpeg-trac] #4808(avformat:new): HLS live stream don't use new cookies on future requests

FFmpeg trac at avcodec.org
Wed Aug 26 19:03:48 CEST 2015


#4808: HLS live stream don't use new cookies on future requests
-------------------------------------+-------------------------------------
             Reporter:  lucas.rokam  |                     Type:  defect
               Status:  new          |                 Priority:  normal
            Component:  avformat     |                  Version:
             Keywords:  m3u8 hls     |  unspecified
  playlist                           |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 Summary of the bug:
 When I try to play a HLS live stream, the setcookie is used on the http
 response and that cookie isn't set for the future requests.

 After 5 minutes the response get error 403.

 Here is a HTTP sniffer result:
 {{{
 GET /dvr/m/off24ha/master-playlist.m3u8?h
 =0411440465697761939438414404691735864119652h6rN-
 AOOhXZcPlp2UCV8Fg&k=html5&a=F&u=52dfc02cdd23810590000f57_605fd6ba-6320
 -4a5a-b10f-065e5363421d HTTP/1.1
 Range: bytes=0-
 User-Agent: Kodi/14.1 (Windows NT 10.0; WOW64) App_Bitness/32
 Version/14.1-Git:20150129-38e4046
 Host: live.hls.globo.com
 Accept: */*
 Cookie: locksession=
 Accept-Charset: UTF-8,*;q=0.8

 HTTP/1.1 200 OK
 Server: nginx
 Date: Tue, 25 Aug 2015 01:19:39 GMT
 Content-Type: application/vnd.apple.mpegurl
 Content-Length: 573
 Connection: keep-alive
 Set-Cookie:
 vssession=cR_S3dMoZipzPbX8eNy0Qw14404658790059058404/dvr/m/off24ha
 /?0411440465697761939438414404691735864119652h6rN-
 AOOhXZcPlp2UCV8Fg|F|52dfc02cdd23810590000f57_605fd6ba-6320-4a5a-b10f-
 065e5363421d; Expires=Tue, 25 Aug 2015 01:24:39 GMT; Path=/dvr/m/off24ha/;
 Vary: Accept-Encoding
 Expires: Tue, 25 Aug 2015 01:19:41 GMT
 Cache-Control: private, max-age=0, no-cache
 Set-Cookie: locksession=8171fe6881c99d4d95b53cd0dcf3acd9; Path=/; Max-
 Age=300

 #EXTM3U
 #EXT-X-VERSION:3
 #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=264000
 off24ha_264/playlist.m3u8
 #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=464000
 off24ha_464/playlist.m3u8
 #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=750000
 off24ha_750/playlist.m3u8
 #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1264000
 off24ha_1264/playlist.m3u8
 #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1864000
 off24ha_1864/playlist.m3u8
 #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=2564000
 off24ha_2564/playlist.m3u8
 #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=64000,CODECS="mp4a.40.2"
 off24ha_264/playlist-audio.m3u8

 GET /dvr/m/off24ha/off24ha_2564/playlist.m3u8 HTTP/1.1
 User-Agent: Kodi/14.1 (Windows NT 10.0; WOW64) App_Bitness/32
 Version/14.1-Git:20150129-38e4046
 Accept: */*
 Connection: close
 Host: live.hls.globo.com
 Cookie: locksession=8171fe6881c99d4d95b53cd0dcf3acd9;
 vssession=cR_S3dMoZipzPbX8eNy0Qw14404658790059058404/dvr/m/off24ha
 /?0411440465697761939438414404691735864119652h6rN-
 AOOhXZcPlp2UCV8Fg|F|52dfc02cdd23810590000f57_605fd6ba-6320-4a5a-b10f-
 065e5363421d; locksession=8171fe6881c99d4d95b53cd0dcf3acd9
 Icy-MetaData: 1

 HTTP/1.1 200 OK
 Server: nginx
 Date: Tue, 25 Aug 2015 01:23:03 GMT
 Content-Type: application/vnd.apple.mpegurl
 Content-Length: 750
 Connection: close
 Set-Cookie:
 vssession=UPDcUGHKJXpc7LOg8kGzuQ14404660821688619614/dvr/m/off24ha
 /?0411440465697761939438414404691735864119652h6rN-
 AOOhXZcPlp2UCV8Fg|F|52dfc02cdd23810590000f57_605fd6ba-6320-4a5a-b10f-
 065e5363421d; Expires=Tue, 25 Aug 2015 01:28:02 GMT; Path=/dvr/m/off24ha/;
 Vary: Accept-Encoding
 Expires: Tue, 25 Aug 2015 01:23:05 GMT
 Cache-Control: private, max-age=0, no-cache
 Set-Cookie: locksession=8171fe6881c99d4d95b53cd0dcf3acd9; Path=/; Max-
 Age=300

 #EXTM3U
 #EXT-X-VERSION:3
 #EXT-X-TARGETDURATION:5
 #EXT-X-MEDIA-SEQUENCE:171228
 #EXTINF:5.0000,
 off24ha_2564-1440465725-148687275600.ts
 #EXTINF:5.0000,
 off24ha_2564-1440465730-148687725600.ts
 #EXTINF:5.0000,
 off24ha_2564-1440465735-148688175600.ts
 #EXTINF:5.0000,
 off24ha_2564-1440465740-148688625600.ts
 #EXTINF:5.0000,
 off24ha_2564-1440465745-148689075600.ts
 #EXTINF:5.0000,
 off24ha_2564-1440465750-148689525600.ts
 #EXTINF:5.0000,
 off24ha_2564-1440465755-148689975600.ts
 #EXTINF:5.0000,
 off24ha_2564-1440465760-148690425600.ts
 #EXTINF:5.0000,
 off24ha_2564-1440465765-148690875600.ts
 #EXTINF:5.0000,
 off24ha_2564-1440465770-148691325600.ts
 #EXTINF:5.0000,
 off24ha_2564-1440465775-148691775600.ts
 #EXTINF:5.0000,
 off24ha_2564-1440465780-148692225600.ts


 GET /dvr/m/off24ha/off24ha_2564/off24ha_2564-1440465730-148687725600.ts
 HTTP/1.1
 User-Agent: Kodi/14.1 (Windows NT 10.0; WOW64) App_Bitness/32
 Version/14.1-Git:20150129-38e4046
 Accept: */*
 Connection: close
 Host: live.hls.globo.com
 Cookie: locksession=8171fe6881c99d4d95b53cd0dcf3acd9;
 vssession=cR_S3dMoZipzPbX8eNy0Qw14404658790059058404/dvr/m/off24ha
 /?0411440465697761939438414404691735864119652h6rN-
 AOOhXZcPlp2UCV8Fg|F|52dfc02cdd23810590000f57_605fd6ba-6320-4a5a-b10f-
 065e5363421d; locksession=8171fe6881c99d4d95b53cd0dcf3acd9
 Icy-MetaData: 1

 HTTP/1.1 200 OK
 Server: nginx
 Date: Tue, 25 Aug 2015 01:23:03 GMT
 Content-Type: video/MP2T
 Content-Length: 1690308
 Connection: close
 Set-Cookie: vssession=Psd_ZJE9VB33-uVq-
 64xew14404660830665574113/dvr/m/off24ha
 /?0411440465697761939438414404691735864119652h6rN-
 AOOhXZcPlp2UCV8Fg|F|52dfc02cdd23810590000f57_605fd6ba-6320-4a5a-b10f-
 065e5363421d; Expires=Tue, 25 Aug 2015 01:28:03 GMT; Path=/dvr/m/off24ha/;
 Expires: Tue, 25 Aug 2015 01:23:02 GMT
 Cache-Control: no-cache


 GET /dvr/m/off24ha/off24ha_2564/off24ha_2564-1440465735-148688175600.ts
 HTTP/1.1
 User-Agent: Kodi/14.1 (Windows NT 10.0; WOW64) App_Bitness/32
 Version/14.1-Git:20150129-38e4046
 Accept: */*
 Connection: close
 Host: live.hls.globo.com
 Cookie: locksession=8171fe6881c99d4d95b53cd0dcf3acd9;
 vssession=cR_S3dMoZipzPbX8eNy0Qw14404658790059058404/dvr/m/off24ha
 /?0411440465697761939438414404691735864119652h6rN-
 AOOhXZcPlp2UCV8Fg|F|52dfc02cdd23810590000f57_605fd6ba-6320-4a5a-b10f-
 065e5363421d; locksession=8171fe6881c99d4d95b53cd0dcf3acd9
 Icy-MetaData: 1

 HTTP/1.1 200 OK
 Server: nginx
 Date: Tue, 25 Aug 2015 01:23:08 GMT
 Content-Type: video/MP2T
 Content-Length: 1570740
 Connection: close
 Set-Cookie:
 vssession=DyJ7qHEcnvYHlzSindzYew14404660881076012996/dvr/m/off24ha
 /?0411440465697761939438414404691735864119652h6rN-
 AOOhXZcPlp2UCV8Fg|F|52dfc02cdd23810590000f57_605fd6ba-6320-4a5a-b10f-
 065e5363421d; Expires=Tue, 25 Aug 2015 01:28:08 GMT; Path=/dvr/m/off24ha/;
 Expires: Tue, 25 Aug 2015 01:23:07 GMT
 Cache-Control: no-cache
 }}}
 I think that the cookie needs to be reset on every response on hls.c at
 open_input function. But as I'm a shitty C coder, I won't send a PR.

 How to reproduce:
 Open a HLS stream that setcookie on every .m3u8 and .ts responses

--
Ticket URL: <https://trac.ffmpeg.org/ticket/4808>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list