Skip to content

Commit 634493a

Browse files
committed
Merge pull request #14 from sloonz/master
Adds port in host request-header during handshake.
2 parents 8eb985d + 5e1c22c commit 634493a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/Client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ protected function connect() {
7070

7171
// Default headers (using lowercase for simpler array_merge below).
7272
$headers = array(
73-
'host' => $host,
73+
'host' => $host . ":" . $port,
7474
'user-agent' => 'websocket-client-php',
7575
'connection' => 'Upgrade',
7676
'upgrade' => 'websocket',

tests/unit/ClientTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ public function testDefaultHeaders() {
231231

232232
$this->assertRegExp(
233233
"/GET \/$this->test_id HTTP\/1.1\r\n"
234-
. "host: localhost\r\n"
234+
. "host: localhost:".self::$port."\r\n"
235235
. "user-agent: websocket-client-php\r\n"
236236
. "connection: Upgrade\r\n"
237237
. "upgrade: websocket\r\n"
@@ -251,7 +251,7 @@ public function testUserAgentOverride() {
251251

252252
$this->assertRegExp(
253253
"/GET \/$this->test_id HTTP\/1.1\r\n"
254-
. "host: localhost\r\n"
254+
. "host: localhost:".self::$port."\r\n"
255255
. "user-agent: Deep thought\r\n"
256256
. "connection: Upgrade\r\n"
257257
. "upgrade: websocket\r\n"
@@ -271,7 +271,7 @@ public function testAddingHeaders() {
271271

272272
$this->assertRegExp(
273273
"/GET \/$this->test_id HTTP\/1.1\r\n"
274-
. "host: localhost\r\n"
274+
. "host: localhost:".self::$port."\r\n"
275275
. "user-agent: websocket-client-php\r\n"
276276
. "connection: Upgrade\r\n"
277277
. "upgrade: websocket\r\n"

0 commit comments

Comments
 (0)