[Pkg-javascript-commits] [sockjs-client] 63/350: Allow non-localhost testing urls

tonnerre at ancient-solutions.com tonnerre at ancient-solutions.com
Fri Aug 5 01:03:42 UTC 2016


This is an automated email from the git hooks/post-receive script.

tonnerre-guest pushed a commit to branch upstream
in repository sockjs-client.

commit bd48c652cf70dd0624d052fcd1645a5201fc320e
Author: Bryce Kahle <bkahle at gmail.com>
Date:   Wed May 28 14:48:09 2014 -0400

    Allow non-localhost testing urls
---
 tests/sockjs_server.js | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tests/sockjs_server.js b/tests/sockjs_server.js
index 25ac69c..cc426dc 100644
--- a/tests/sockjs_server.js
+++ b/tests/sockjs_server.js
@@ -2,6 +2,7 @@
 var http = require('http');
 var node_static = require('node-static');
 var sockjs_app = require('./sockjs_app');
+var url = require('url');
 
 var port = process.env.ZUUL_PORT || 8081;
 var client_opts = {
@@ -40,6 +41,8 @@ server.addListener('request', function(req, res) {
     res.writeHead(200);
     res.end(new Array(2049).join('a') + '\nb\n');
   } else if (req.url === '/config.js') {
+    var parsedOrigin = url.parse(req.headers.referer || 'http://localhost');
+    client_opts.url = parsedOrigin.protocol + '//' + parsedOrigin.hostname + ':' + port;
     res.setHeader('content-type', 'application/javascript');
     res.writeHead(200);
     res.end('var client_opts = ' +

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/sockjs-client.git



More information about the Pkg-javascript-commits mailing list