diff --git a/lib/httpLoader.js b/lib/httpLoader.js index 0c0179b..2eb0562 100644 --- a/lib/httpLoader.js +++ b/lib/httpLoader.js @@ -1,6 +1,7 @@ // -// Basic schema loader that loads schemas over HTTP[S]. -// Wrapper for http.get. +// Example schema loader that loads schemas over HTTP[S]. +// Wrapper for http.get. For SSL connections, the CA certificate is +// not verified. // // If you were to write your own HTTP[S] loader, you’d probably want // to use https://github.com/mikeal/request to do the heavy lifting. @@ -23,12 +24,15 @@ function loader(ref, callback, _depth) { return callback(err); } - var urlParts = url.parse(ref); + var options = url.parse(ref); var getter = http.get; - if (urlParts.protocol === 'https:') { getter = https.get; } + if (options.protocol === 'https:') { + options.rejectUnauthorized = false; + getter = https.get; + } - getter(ref, function(res) { + getter(options, function(res) { if (res.statusCode >= 300 && res.statusCode <= 399) { // redirect