aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Enderlin <ivan.enderlin@hoa-project.net>2013-06-06 22:48:42 +0200
committerIvan Enderlin <ivan.enderlin@hoa-project.net>2013-06-06 22:48:42 +0200
commit07700f353db960e75c0592fa4aa3e0631c800e24 (patch)
tree5610a7d15cd7003321b1b23fe36323e6e09b80b6
parent5afddbd35db0f697def54d85c88c6d873bfd79e0 (diff)
downloadRouter-07700f353db960e75c0592fa4aa3e0631c800e24.zip
Router-07700f353db960e75c0592fa4aa3e0631c800e24.tar.gz
Router-07700f353db960e75c0592fa4aa3e0631c800e24.tar.bz2
Fix ports print.
Default port is set at construction. Ports are printed if different of standard ports.
-rw-r--r--Http.php16
1 files changed, 9 insertions, 7 deletions
diff --git a/Http.php b/Http.php
index a70b382..fc4a07a 100644
--- a/Http.php
+++ b/Http.php
@@ -180,6 +180,8 @@ class Http extends Generic implements \Hoa\Core\Parameter\Parameterizable {
);
}
+ $this->setDefaultPort($this->getPort(), $this->isSecure());
+
return;
}
@@ -445,12 +447,14 @@ class Http extends Generic implements \Hoa\Core\Parameter\Parameterizable {
return $prefix . $unroute;
};
- $getPort = function ( $port, $secure ) {
+ $getPort = function ( $secure ) {
+
+ $defaultPort = $this->getDefaultPort($secure);
if(false === $secure)
- return 80 !== $port ? ':' . $this->getDefaultPort(false) : '';
+ return 80 !== $defaultPort ? ':' . $defaultPort : '';
- return 443 !== $port ? ':' . $this->getDefaultPort(true) : '';
+ return 443 !== $defaultPort ? ':' . $defaultPort : '';
};
if(true === array_key_exists('_subdomain', $variables)) {
@@ -460,7 +464,6 @@ class Http extends Generic implements \Hoa\Core\Parameter\Parameterizable {
'Subdomain is empty, cannot unroute the rule %s properly.',
6, $id);
- $port = $this->getPort();
$secure = null === $secured ? $this->isSecure() : $secured;
if(false !== $pos = strpos($pattern, '@'))
@@ -510,7 +513,7 @@ class Http extends Generic implements \Hoa\Core\Parameter\Parameterizable {
return (true === $secure ? 'https://' : 'http://') .
$subdomain .
$this->getStrictDomain() .
- $getPort($port, $secure) .
+ $getPort($secure) .
$prependPrefix($this->_unroute($id, $pattern, $variables)) .
$anchor;
}
@@ -527,13 +530,12 @@ class Http extends Generic implements \Hoa\Core\Parameter\Parameterizable {
return $prependPrefix($this->_unroute($id, $pattern, $variables)) .
$anchor;
- $port = $this->getPort();
$secure = null === $secured ? $this->isSecure() : $secured;
return (true === $secure ? 'https://' : 'http://') .
$this->_unroute($id, $subPattern, $variables, false) .
'.' . $this->getStrictDomain() .
- $getPort($port, $secure) .
+ $getPort($secure) .
$prependPrefix($this->_unroute($id, $pattern, $variables)) .
$anchor;
}