Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision Both sides next revision
dlna_http_requests [2014/08/15 22:09]
beandog
dlna_http_requests [2014/08/15 22:11]
beandog
Line 17: Line 17:
 <​code>​ <​code>​
 dos2unix log.firstrun-60s 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