2013-06-01 03:06:36 +02:00
|
|
|
var https = require('https');
|
2013-05-31 08:26:11 +02:00
|
|
|
|
|
|
|
module.exports.request = function(req, resp) {
|
2013-06-01 03:06:36 +02:00
|
|
|
https.get({
|
2013-05-31 08:26:11 +02:00
|
|
|
host: 'registry.npmjs.org',
|
|
|
|
path: req.url,
|
2013-06-01 03:06:36 +02:00
|
|
|
ca: require('./npmsslkeys'),
|
2013-05-31 08:26:11 +02:00
|
|
|
headers: {
|
2013-06-08 03:16:28 +02:00
|
|
|
'User-Agent': 'sinopia/0.0.0',
|
2013-05-31 08:26:11 +02:00
|
|
|
},
|
|
|
|
}, function(res) {
|
|
|
|
resp.writeHead(res.statusCode, res.headers);
|
|
|
|
res.on('data', function(d) {
|
|
|
|
resp.write(d);
|
|
|
|
});
|
|
|
|
res.on('end', function() {
|
|
|
|
resp.end();
|
|
|
|
});
|
|
|
|
}).on('error', function(err) {
|
|
|
|
console.error(err);
|
|
|
|
resp.send(500);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|