zippybr | 23 Jul 2012 14:17
Picon

SF.net SVN: freenas:[11957] branches/8.2.0/nanobsd/plugins/minidlna_pbi/ resources/plugins/minidlna/application/libs/MiniDLNA.php

Revision: 11957
          http://freenas.svn.sourceforge.net/freenas/?rev=11957&view=rev
Author:   zippybr
Date:     2012-07-23 12:17:30 +0000 (Mon, 23 Jul 2012)
Log Message:
-----------
Do not include default port number for http/https

For some reason HTTP_HOST is not included with those,
even when the request explicitly use them...

Modified Paths:
--------------
    branches/8.2.0/nanobsd/plugins/minidlna_pbi/resources/plugins/minidlna/application/libs/MiniDLNA.php

Modified: branches/8.2.0/nanobsd/plugins/minidlna_pbi/resources/plugins/minidlna/application/libs/MiniDLNA.php
===================================================================
---
branches/8.2.0/nanobsd/plugins/minidlna_pbi/resources/plugins/minidlna/application/libs/MiniDLNA.php	2012-07-23
12:16:14 UTC (rev 11956)
+++
branches/8.2.0/nanobsd/plugins/minidlna_pbi/resources/plugins/minidlna/application/libs/MiniDLNA.php	2012-07-23
12:17:30 UTC (rev 11957)
 <at>  <at>  -55,8 +55,14  <at>  <at> 

         if($this->_rpc)
             return $this->_rpc;
-        $scheme = (isset($_SERVER['HTTPS'])) ? 'https' : 'http';
-        $target = sprintf('%s://%s:%s/plugins/json-rpc/v1/', $scheme, $_SERVER['SERVER_ADDR'], $_SERVER['SERVER_PORT']);
+        if(isset($_SERVER['HTTPS'])) {
+            $scheme = 'https';
+            $port = ($_SERVER['SERVER_PORT'] != 443) ? ':'.$_SERVER['SERVER_PORT'] : '';
+        } else {
+            $scheme = 'http';
+            $port = ($_SERVER['SERVER_PORT'] != 80) ? ':'.$_SERVER['SERVER_PORT'] : '';
+        }
+        $target = sprintf('%s://%s%s/plugins/json-rpc/v1/', $scheme, $_SERVER['SERVER_ADDR'], $port);
         $oauth_consumer = $this->getOAuthConsumer();
         $connection = Tivoka::connect($target);
         $connection->setOAuthConsumer($oauth_consumer);

This was sent by the SourceForge.net collaborative development platform, the world's largest Open
Source development site.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

Gmane