Differences

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

Link to this comparison view

Next revision
Previous revision
Next revision Both sides next revision
dlna_http_requests [2014/08/15 22:08]
beandog created
dlna_http_requests [2014/08/15 22:11]
beandog
Line 10: Line 10:
  
 <​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>​ </​code>​

Navigation