DLNA HTTP Requests
I'm examining the HTTP traffic sent back-and-forth between the DLNA server (minidlna in my case) and the DLNA client (Sony Blu-ray player).
Here's some of my notes on them.
Source for headers is playback of a file up until the first 60 seconds.
Logging the first run:
sudo tcpflow -p -c port 8200 > log.firstrun-60s
Clean up the data:
dos2unix log.firstrun-60s
Some PHP code to help me examine the content closely (which I'm not going to apologize for the quality, since I'm debugging). Requires the PECL http extension.
<?php $str = file_get_contents("log.firstrun-60s"); $contents = explode("\n", $str); $count = 0; $key = 0; $headers = array(); foreach($contents as $str) { if(strpos($str, "HTTP/1.1") !== false) { $key++; $arr = explode(":", $str); array_shift($arr); $str = implode(":", $arr); } $arr_content_headers[$key][] = $str; } foreach($arr_content_headers as $arr) { $headers[] = implode("\n", $arr); } foreach($headers as $key => $http_headers) { $arr_headers = http_parse_headers($http_headers); if($arr_headers === false) { $count++; } else { print_r($arr_headers); } } if($count) echo "$count failed\n";
And the first two HTTP requests:
Array ( [Request Method] => HEAD [Request Url] => /MediaItems/224.mkv [User-Agent] => UPnP/1.0 DLNADOC/1.50 [Host] => 10.10.10.103:8200 [Accept] => */* [X-Av-Physical-Unit-Info] => pa="Blu-ray Disc Player" [X-Av-Client-Info] => av=5.0; cn="Sony Corporation"; mn="Blu-ray Disc Player"; mv="2.0" [Getcontentfeatures.Dlna.Org] => 1 ) Array ( [Response Code] => 200 [Response Status] => OK [Content-Type] => video/x-matroska [Content-Length] => 445063149 [Transfermode.Dlna.Org] => Streaming [Accept-Ranges] => bytes [Connection] => close [Date] => Sat, 16 Aug 2014 02:15:10 GMT [Ext] => [Realtimeinfo.Dlna.Org] => DLNA.ORG_TLAG=* [Contentfeatures.Dlna.Org] => DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01700000000000000000000000000000 [Server] => 3.12.5-ck DLNADOC/1.50 UPnP/1.0 MiniDLNA/1.1.1 )