[Pkg-javascript-commits] [pdf.js] 154/174: Merge pull request #6600 from Rob--W/test-server-improved
David Prévot
taffit at moszumanska.debian.org
Thu Nov 19 18:45:39 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository pdf.js.
commit 248e211a20b018f74676d751e0177f0ea9f96b9c
Merge: a4ca998 b0ff49e
Author: Yury Delendik <ydelendik at mozilla.com>
Date: Wed Nov 11 13:50:25 2015 -0600
Merge pull request #6600 from Rob--W/test-server-improved
Improve reliability of the test server
test/webserver.js | 52 ++++++++++++++++++++++++++++++++++++++--------------
1 file changed, 38 insertions(+), 14 deletions(-)
diff --cc test/webserver.js
index 9ea02d2,c108d68..ee5e802
--- a/test/webserver.js
+++ b/test/webserver.js
@@@ -66,21 -65,8 +66,21 @@@ WebServer.prototype =
this.server.close(callback);
this.server = null;
},
+ _ensureNonZeroPort: function () {
+ if (!this.port) {
+ // If port is 0, a random port will be chosen instead. Do not set a host
+ // name to make sure that the port is synchronously set by .listen().
+ var server = http.createServer().listen(0);
+ var address = server.address();
+ // .address().port being available synchronously is merely an
+ // implementation detail. So we are defensive here and fall back to some
+ // fixed port when the address is not available yet.
+ this.port = address ? address.port : 8000;
+ server.close();
+ }
+ },
_handler: function (req, res) {
- var url = req.url;
+ var url = req.url.replace(/\/\//g, '/');
var urlParts = /([^?]*)((?:\?(.*))?)/.exec(url);
var pathPart = decodeURI(urlParts[1]), queryPart = urlParts[3];
var verbose = this.verbose;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git
More information about the Pkg-javascript-commits
mailing list