Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
dlna_http_requests [2014/08/15 22:08]
beandog created
dlna_http_requests [2014/08/15 22:12] (current)
beandog
Line 1: Line 1:
 ====== DLNA HTTP Requests ====== ====== DLNA HTTP Requests ======
 +
 +  * [[DLNA]]
 +  * [[DLNA HTTP]]
  
 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). 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).
Line 10: Line 13:
  
 <​code>​ <​code>​
-sudo tcpflow -p -c port 8200 > log.firstrun+sudo tcpflow -p -c port 8200 > log.firstrun-60s 
 +</​code>​ 
 + 
 +Clean up the data: 
 + 
 +<​code>​ 
 +dos2unix log.firstrun-60s 
 +</​code>​ 
 + 
 +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. 
 + 
 +<code php> 
 +<?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";​ 
 +</​code>​ 
 + 
 +And the first two HTTP requests: 
 + 
 +<​code>​ 
 +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 
 +)
 </​code>​ </​code>​

Navigation