summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorWu Cheng-Han2015-07-12 17:19:07 +0800
committerWu Cheng-Han2015-07-12 17:19:07 +0800
commitbbcc64af6b8e610f09a845c940c930d4d91a12f4 (patch)
tree2185faaa7e2a69919bcb77ffee8ff55b12f7e7a5 /lib
parentf359044776ae3e4e499bb3311034c84a4b554347 (diff)
Handle an server getNotenameFromSocket referer undefined exception
Diffstat (limited to '')
-rw-r--r--lib/realtime.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/realtime.js b/lib/realtime.js
index 66a3c9c5..3e367158 100644
--- a/lib/realtime.js
+++ b/lib/realtime.js
@@ -151,7 +151,11 @@ function getStatus(callback) {
}
function getNotenameFromSocket(socket) {
- var hostUrl = url.parse(socket.handshake.headers.referer);
+ var referer = socket.handshake.headers.referer;
+ if (!referer) {
+ return socket.disconnect();
+ }
+ var hostUrl = url.parse(referer);
var notename = hostUrl.pathname.split('/')[1];
if (notename == config.featuresnotename) {
return notename;