'use strict' const http = require('http') const https = require('https') const server = http.createServer(handler) const port = +process.argv[2] const prefix = process.argv[3] const upstream = process.argv[4] var calls = 0 server.listen(port) function handler (req, res) { if (req.url.indexOf(prefix) !== 0) { throw new Error('request url [' + req.url + '] does not start with [' + prefix + ']') } var upstreamUrl = upstream + req.url.substring(prefix.length) https.get(upstreamUrl, function (ures) { ures.on('end', function () { if (++calls === 2) { server.close() } }) ures.pipe(res) }) }
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
fixtures | Folder | 0755 |
|
|
common.js | File | 112 B | 0644 |
|
process-exec-sync.js | File | 3.06 KB | 0644 |
|
simple-proxy.js | File | 641 B | 0644 |
|
test-addon.js | File | 4.34 KB | 0644 |
|
test-configure-python.js | File | 2.08 KB | 0644 |
|
test-download.js | File | 7.27 KB | 0644 |
|
test-find-accessible-sync.js | File | 2.52 KB | 0644 |
|
test-find-node-directory.js | File | 4.23 KB | 0644 |
|
test-find-python.js | File | 5.68 KB | 0644 |
|
test-find-visualstudio.js | File | 19.61 KB | 0644 |
|
test-install.js | File | 769 B | 0644 |
|
test-options.js | File | 712 B | 0644 |
|
test-process-release.js | File | 17.42 KB | 0644 |
|