From 2e7d8a88f4b470dcc9da1639fe2a69e03251036c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Ma=C5=82ecki?= Date: Thu, 27 Sep 2012 08:04:23 +0200 Subject: [PATCH] [fix] Partial fix for rejecting self-signed certs in tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since joyent/node@35607f3a2dda03af8cf2dd3704c0c915e28aa774, https and tls modules validate server certificate by default. Turn this feature off since we're using self-signed certificates in tests. Currently wss tests are still failing, pending investigation. Commited on a plane from PoznaƄ to Munich. --- examples/http/proxy-https-to-https.js | 3 ++- test/helpers/http.js | 1 + test/macros/http.js | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/http/proxy-https-to-https.js b/examples/http/proxy-https-to-https.js index b35ecc3..af0d922 100644 --- a/examples/http/proxy-https-to-https.js +++ b/examples/http/proxy-https-to-https.js @@ -46,7 +46,8 @@ https.createServer(helpers.https, function (req, res) { httpProxy.createServer(8000, 'localhost', { https: helpers.https, target: { - https: true + https: true, + rejectUnauthorized: false } }).listen(8080); diff --git a/test/helpers/http.js b/test/helpers/http.js index b91478f..3479626 100644 --- a/test/helpers/http.js +++ b/test/helpers/http.js @@ -91,6 +91,7 @@ exports.createProxyServer = function (options, callback) { if (protocols.proxy === 'https') { options.proxy.https = helpers.https; } + options.proxy.rejectUnauthorized = false; return httpProxy .createServer(options.proxy) diff --git a/test/macros/http.js b/test/macros/http.js index dcb4256..767b7db 100644 --- a/test/macros/http.js +++ b/test/macros/http.js @@ -27,6 +27,7 @@ exports.assertRequest = function (options) { // // Now make the HTTP request and assert. // + options.request.rejectUnauthorized = false; request(options.request, this.callback); }, "should succeed": function (err, res, body) { @@ -320,4 +321,4 @@ exports.assertProxiedToRoutes = function (options, nested) { } return context; -}; \ No newline at end of file +};