summaryrefslogtreecommitdiff
path: root/lib/POE/Component/Client/WebSocket.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/POE/Component/Client/WebSocket.pm')
-rw-r--r--lib/POE/Component/Client/WebSocket.pm5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/POE/Component/Client/WebSocket.pm b/lib/POE/Component/Client/WebSocket.pm
index e428672..8f5ff3c 100644
--- a/lib/POE/Component/Client/WebSocket.pm
+++ b/lib/POE/Component/Client/WebSocket.pm
@@ -132,6 +132,9 @@ sub new {
my $key = "";
for (1..16) { $key .= int(rand(9)) }
+ my $origin = (uc $scheme eq 'WSS' ? 'https' : 'http')
+ . "://$host";
+
$self->{session} = POE::Session->create(
package_states => [
$self => {
@@ -167,7 +170,7 @@ sub new {
port => $port,
},
req => {
- 'origin' => 'http://'.$host,
+ 'origin' => $origin,
'sec-websocket-key' => encode_base64($key),
},
_state => {