This is an old revision of the document!

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.

	$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) {
			$arr = explode(":", $str);
			$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) {
		} else {
		echo "$count failed\n";