Skip to content

Commit cc64be0

Browse files
committed
Use port 443 for SSL connections
1 parent c2d6d1a commit cc64be0

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

RequestData.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function __construct($method, $url, array $headers = array())
1919

2020
private function mergeDefaultheaders(array $headers)
2121
{
22-
$port = (80 === $this->getPort()) ? '' : ":{$this->getPort()}";
22+
$port = ($this->getDefaultPort() === $this->getPort()) ? '' : ":{$this->getPort()}";
2323
$connectionHeaders = ('1.1' === $this->protocolVersion) ? array('Connection' => 'close') : array();
2424

2525
return array_merge(
@@ -44,7 +44,12 @@ public function getHost()
4444

4545
public function getPort()
4646
{
47-
return (int) parse_url($this->url, PHP_URL_PORT) ?: 80;
47+
return (int) parse_url($this->url, PHP_URL_PORT) ?: $this->getDefaultPort();
48+
}
49+
50+
public function getDefaultPort()
51+
{
52+
return ('https' === $this->getScheme()) ? 443 : 80;
4853
}
4954

5055
public function getPath()

0 commit comments

Comments
 (0)