From 5e1c22c17f31878676a73efa967b999d2d48596e Mon Sep 17 00:00:00 2001 From: Simon LIPP Date: Wed, 18 Mar 2015 15:46:37 +0100 Subject: [PATCH] Add port in Host request-header during handshake --- lib/Client.php | 2 +- tests/unit/ClientTest.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/Client.php b/lib/Client.php index 64a9a60..82982a0 100644 --- a/lib/Client.php +++ b/lib/Client.php @@ -70,7 +70,7 @@ protected function connect() { // Default headers (using lowercase for simpler array_merge below). $headers = array( - 'host' => $host, + 'host' => $host . ":" . $port, 'user-agent' => 'websocket-client-php', 'connection' => 'Upgrade', 'upgrade' => 'websocket', diff --git a/tests/unit/ClientTest.php b/tests/unit/ClientTest.php index 2e6ea38..43c259d 100644 --- a/tests/unit/ClientTest.php +++ b/tests/unit/ClientTest.php @@ -231,7 +231,7 @@ public function testDefaultHeaders() { $this->assertRegExp( "/GET \/$this->test_id HTTP\/1.1\r\n" - . "host: localhost\r\n" + . "host: localhost:".self::$port."\r\n" . "user-agent: websocket-client-php\r\n" . "connection: Upgrade\r\n" . "upgrade: websocket\r\n" @@ -251,7 +251,7 @@ public function testUserAgentOverride() { $this->assertRegExp( "/GET \/$this->test_id HTTP\/1.1\r\n" - . "host: localhost\r\n" + . "host: localhost:".self::$port."\r\n" . "user-agent: Deep thought\r\n" . "connection: Upgrade\r\n" . "upgrade: websocket\r\n" @@ -271,7 +271,7 @@ public function testAddingHeaders() { $this->assertRegExp( "/GET \/$this->test_id HTTP\/1.1\r\n" - . "host: localhost\r\n" + . "host: localhost:".self::$port."\r\n" . "user-agent: websocket-client-php\r\n" . "connection: Upgrade\r\n" . "upgrade: websocket\r\n"