diff options
Diffstat (limited to 'vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test')
43 files changed, 0 insertions, 3519 deletions
diff --git a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/README.md b/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/README.md deleted file mode 100644 index 152e5c66..00000000 --- a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/README.md +++ /dev/null @@ -1,10 +0,0 @@ -# `test/core` - -`test/core` directory is a place where tests from node.js core go. They are -here to ensure that node-http-proxy works just fine with all kinds of -different situations, which are covered in core tests, but are not covered in -our tests. - -All these tests require little modifications to make them test node-http-proxy, -but we try to keep them as vanilla as possible. - diff --git a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/common.js b/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/common.js deleted file mode 100644 index 3f584a54..00000000 --- a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/common.js +++ /dev/null @@ -1,190 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -var path = require('path'); -var assert = require('assert'); - -exports.testDir = path.dirname(__filename); -exports.fixturesDir = path.join(exports.testDir, 'fixtures'); -exports.libDir = path.join(exports.testDir, '../lib'); -exports.tmpDir = path.join(exports.testDir, 'tmp'); -exports.PORT = 12346; -exports.PROXY_PORT = 1234567; - -if (process.platform === 'win32') { - exports.PIPE = '\\\\.\\pipe\\libuv-test'; -} else { - exports.PIPE = exports.tmpDir + '/test.sock'; -} - -var util = require('util'); -for (var i in util) exports[i] = util[i]; -//for (var i in exports) global[i] = exports[i]; - -function protoCtrChain(o) { - var result = []; - for (; o; o = o.__proto__) { result.push(o.constructor); } - return result.join(); -} - -exports.indirectInstanceOf = function (obj, cls) { - if (obj instanceof cls) { return true; } - var clsChain = protoCtrChain(cls.prototype); - var objChain = protoCtrChain(obj); - return objChain.slice(-clsChain.length) === clsChain; -}; - - -exports.ddCommand = function (filename, kilobytes) { - if (process.platform === 'win32') { - var p = path.resolve(exports.fixturesDir, 'create-file.js'); - return '"' + process.argv[0] + '" "' + p + '" "' + - filename + '" ' + (kilobytes * 1024); - } else { - return 'dd if=/dev/zero of="' + filename + '" bs=1024 count=' + kilobytes; - } -}; - - -exports.spawnPwd = function (options) { - var spawn = require('child_process').spawn; - - if (process.platform === 'win32') { - return spawn('cmd.exe', ['/c', 'cd'], options); - } else { - return spawn('pwd', [], options); - } -}; - - -// Turn this off if the test should not check for global leaks. -exports.globalCheck = true; - -process.on('exit', function () { - if (!exports.globalCheck) return; - var knownGlobals = [setTimeout, - setInterval, - clearTimeout, - clearInterval, - console, - Buffer, - process, - global]; - - if (global.setImmediate) { - knownGlobals.push(setImmediate); - knownGlobals.push(clearImmediate); - } - - if (global.errno) { - knownGlobals.push(errno); - } - - if (global.gc) { - knownGlobals.push(gc); - } - - if (global.DTRACE_HTTP_SERVER_RESPONSE) { - knownGlobals.push(DTRACE_HTTP_SERVER_RESPONSE); - knownGlobals.push(DTRACE_HTTP_SERVER_REQUEST); - knownGlobals.push(DTRACE_HTTP_CLIENT_RESPONSE); - knownGlobals.push(DTRACE_HTTP_CLIENT_REQUEST); - knownGlobals.push(DTRACE_NET_STREAM_END); - knownGlobals.push(DTRACE_NET_SERVER_CONNECTION); - knownGlobals.push(DTRACE_NET_SOCKET_READ); - knownGlobals.push(DTRACE_NET_SOCKET_WRITE); - } - - if (global.ArrayBuffer) { - knownGlobals.push(ArrayBuffer); - knownGlobals.push(Int8Array); - knownGlobals.push(Uint8Array); - knownGlobals.push(Int16Array); - knownGlobals.push(Uint16Array); - knownGlobals.push(Int32Array); - knownGlobals.push(Uint32Array); - knownGlobals.push(Float32Array); - knownGlobals.push(Float64Array); - knownGlobals.push(DataView); - - if (global.Uint8ClampedArray) { - knownGlobals.push(Uint8ClampedArray); - } - } - - for (var x in global) { - var found = false; - - for (var y in knownGlobals) { - if (global[x] === knownGlobals[y]) { - found = true; - break; - } - } - - if (!found) { - console.error('Unknown global: %s', x); - assert.ok(false, 'Unknown global found'); - } - } -}); - - -var mustCallChecks = []; - - -function runCallChecks() { - var failed = mustCallChecks.filter(function (context) { - return context.actual !== context.expected; - }); - - failed.forEach(function (context) { - console.log('Mismatched %s function calls. Expected %d, actual %d.', - context.name, - context.expected, - context.actual); - console.log(context.stack.split('\n').slice(2).join('\n')); - }); - - if (failed.length) process.exit(1); -} - - -exports.mustCall = function (fn, expected) { - if (typeof expected !== 'number') expected = 1; - - var context = { - expected: expected, - actual: 0, - stack: (new Error).stack, - name: fn.name || '<anonymous>' - }; - - // add the exit listener only once to avoid listener leak warnings - if (mustCallChecks.length === 0) process.on('exit', runCallChecks); - - mustCallChecks.push(context); - - return function () { - context.actual++; - return fn.apply(this, arguments); - }; -}; diff --git a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/pummel/test-http-upload-timeout.js b/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/pummel/test-http-upload-timeout.js deleted file mode 100644 index 74b458f8..00000000 --- a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/pummel/test-http-upload-timeout.js +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -// This tests setTimeout() by having multiple clients connecting and sending -// data in random intervals. Clients are also randomly disconnecting until there -// are no more clients left. If no false timeout occurs, this test has passed. -var common = require('../common'), - assert = require('assert'), - http = require('http'), - server = http.createServer(), - connections = 0; - -server.on('request', function (req, res) { - req.socket.setTimeout(1000); - req.socket.on('timeout', function () { - throw new Error('Unexpected timeout'); - }); - req.on('end', function () { - connections--; - res.writeHead(200); - res.end('done\n'); - if (connections == 0) { - server.close(); - } - }); -}); - -server.listen(common.PORT, '127.0.0.1', function () { - for (var i = 0; i < 10; i++) { - connections++; - - setTimeout(function () { - var request = http.request({ - port: common.PROXY_PORT, - method: 'POST', - path: '/' - }); - - function ping() { - var nextPing = (Math.random() * 900).toFixed(); - if (nextPing > 600) { - request.end(); - return; - } - request.write('ping'); - setTimeout(ping, nextPing); - } - ping(); - }, i * 50); - } -}); diff --git a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/run b/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/run deleted file mode 100644 index adec53ba..00000000 --- a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/run +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/env node -/* - run.js: test runner for core tests - - Copyright (c) 2011 Nodejitsu - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -*/ - -var fs = require('fs'), - path = require('path'), - spawn = require('child_process').spawn, - async = require('async'), - colors = require('colors'), - optimist = require('optimist'); - -optimist.argv.color && (colors.mode = optimist.argv.color); - -var testTimeout = 15000; -var results = {}; - -function runTest(test, callback) { - var child = spawn(path.join(__dirname, 'run-single'), [ test ]); - - var killTimeout = setTimeout(function () { - child.kill(); - console.log(' ' + path.basename(test).yellow + ' timed out'.red); - }, testTimeout); - - child.on('exit', function (exitCode) { - clearTimeout(killTimeout); - - console.log(' ' + ((exitCode) ? '✘'.red : '✔'.green) + ' ' + - path.basename(test) + - (exitCode ? (' (exit code: ' + exitCode + ')') : '')); - results[test] = { exitCode: exitCode }; - callback(); - // - // We don't want tests to be stopped after first failure, and that's what - // async does when it receives truthy value in callback. - // - }); -}; - -var tests = process.argv.slice(2).filter(function (test) { - return test.substr(0, 2) != '--'; -}); - -if (!tests.length) { - var pathPrefix = path.join(__dirname, 'simple'); - tests = fs.readdirSync(pathPrefix).map(function (test) { - return path.join(pathPrefix, test); - }); - // - // We only run simple tests by default. - // -} - -console.log('Running tests:'.bold); -async.forEachSeries(tests, runTest, function () { - var failed = [], ok = []; - for (var test in results) { - (results[test].exitCode != 0 ? failed : ok).push(test); - } - - console.log('\nSummary:'.bold); - console.log((' ' + ok.length + '\tpassed tests').green); - console.log((' ' + failed.length + '\tfailed tests').red); -}); - -// vim:filetype=javascript - diff --git a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/run-single b/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/run-single deleted file mode 100644 index ae53588a..00000000 --- a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/run-single +++ /dev/null @@ -1,70 +0,0 @@ -#!/usr/bin/env node -/* - run-single.js: test runner for core tests - - Copyright (c) 2011 Nodejitsu - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -*/ - -// -// Basic idea behind core test runner is to modify core tests as little as -// possible. That's why we start up node-http-proxy here instead of embeeding -// this code in tests. -// -// In most cases only modification to core tests you'll need is changing port -// of http client to common.PROXY_PORT. -// - -var path = require('path'), - spawn = require('child_process').spawn, - httpProxy = require('../../'), - common = require('./common'); - -var test = process.argv[2], - testProcess; - -if (!test) { - return console.error('Need test to run'); -} - -console.log('Running test ' + test); - -var proxy = httpProxy.createServer(common.PORT, 'localhost'); -proxy.listen(common.PROXY_PORT); - -proxy.on('listening', function () { - console.log('Proxy server listening on ' + common.PROXY_PORT); - testProcess = spawn(process.argv[0], [ process.argv[2] ]); - testProcess.stdout.pipe(process.stdout); - testProcess.stderr.pipe(process.stderr); - - testProcess.on('exit', function (code) { - process.exit(code); - }); -}); - -process.on('SIGTERM', function () { - testProcess.kill(); - process.exit(1); -}); - -// vim:filetype=javascript diff --git a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-chunked.js b/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-chunked.js deleted file mode 100644 index b1cbf0db..00000000 --- a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-chunked.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -var common = require('../common'); -var assert = require('assert'); -var http = require('http'); - -var UTF8_STRING = '南越国是前203年至前111年存在于岭南地区的一个国家,' + - '国都位于番禺,疆域包括今天中国的广东、广西两省区的大部份地区,福建省、湖南、' + - '贵州、云南的一小部份地区和越南的北部。南越国是秦朝灭亡后,' + - '由南海郡尉赵佗于前203年起兵兼并桂林郡和象郡后建立。前196年和前179年,' + - '南越国曾先后两次名义上臣属于西汉,成为西汉的“外臣”。前112年,' + - '南越国末代君主赵建德与西汉发生战争,被汉武帝于前111年所灭。' + - '南越国共存在93年,历经五代君主。南越国是岭南地区的第一个有记载的政权国家,' + - '采用封建制和郡县制并存的制度,它的建立保证了秦末乱世岭南地区社会秩序的稳定,' + - '有效的改善了岭南地区落后的政治、经济现状。'; - -var server = http.createServer(function (req, res) { - res.writeHead(200, {'Content-Type': 'text/plain; charset=utf8'}); - res.end(UTF8_STRING, 'utf8'); -}); -server.listen(common.PORT, function () { - var data = ''; - var get = http.get({ - path: '/', - host: 'localhost', - port: common.PROXY_PORT - }, function (x) { - x.setEncoding('utf8'); - x.on('data', function (c) {data += c}); - x.on('error', function (e) { - throw e; - }); - x.on('end', function () { - assert.equal('string', typeof data); - console.log('here is the response:'); - assert.equal(UTF8_STRING, data); - console.log(data); - server.close(); - }); - }); - get.on('error', function (e) {throw e}); - get.end(); - -}); diff --git a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-client-abort.js b/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-client-abort.js deleted file mode 100644 index 78d0a6f9..00000000 --- a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-client-abort.js +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -var common = require('../common'); -var assert = require('assert'); -var http = require('http'); - -var clientAborts = 0; - -var server = http.Server(function (req, res) { - console.log('Got connection'); - res.writeHead(200); - res.write('Working on it...'); - - // I would expect an error event from req or res that the client aborted - // before completing the HTTP request / response cycle, or maybe a new - // event like "aborted" or something. - req.on('aborted', function () { - clientAborts++; - console.log('Got abort ' + clientAborts); - if (clientAborts === N) { - console.log('All aborts detected, you win.'); - server.close(); - } - }); - - // since there is already clientError, maybe that would be appropriate, - // since "error" is magical - req.on('clientError', function () { - console.log('Got clientError'); - }); -}); - -var responses = 0; -var N = http.Agent.defaultMaxSockets - 1; -var requests = []; - -server.listen(common.PORT, function () { - console.log('Server listening.'); - - for (var i = 0; i < N; i++) { - console.log('Making client ' + i); - var options = { port: common.PROXY_PORT, path: '/?id=' + i }; - var req = http.get(options, function (res) { - console.log('Client response code ' + res.statusCode); - - if (++responses == N) { - console.log('All clients connected, destroying.'); - requests.forEach(function (outReq) { - console.log('abort'); - outReq.abort(); - }); - } - }); - - requests.push(req); - } -}); - -process.on('exit', function () { - assert.equal(N, clientAborts); -}); diff --git a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-client-abort2.js b/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-client-abort2.js deleted file mode 100644 index eef05fb4..00000000 --- a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-client-abort2.js +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -// libuv-broken - - -var common = require('../common'); -var assert = require('assert'); -var http = require('http'); - -var server = http.createServer(function (req, res) { - res.end('Hello'); -}); - -server.listen(common.PORT, function () { - var req = http.get({port: common.PROXY_PORT}, function (res) { - res.on('data', function (data) { - req.abort(); - server.close(); - }); - }); -}); - diff --git a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-client-upload-buf.js b/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-client-upload-buf.js deleted file mode 100644 index 3b8e9abc..00000000 --- a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-client-upload-buf.js +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -var common = require('../common'); -var assert = require('assert'); -var http = require('http'); - -var N = 1024; -var bytesRecieved = 0; -var server_req_complete = false; -var client_res_complete = false; - -var server = http.createServer(function (req, res) { - assert.equal('POST', req.method); - - req.on('data', function (chunk) { - bytesRecieved += chunk.length; - }); - - req.on('end', function () { - server_req_complete = true; - console.log('request complete from server'); - res.writeHead(200, {'Content-Type': 'text/plain'}); - res.write('hello\n'); - res.end(); - }); -}); -server.listen(common.PORT); - -server.on('listening', function () { - var req = http.request({ - port: common.PROXY_PORT, - method: 'POST', - path: '/' - }, function (res) { - res.setEncoding('utf8'); - res.on('data', function (chunk) { - console.log(chunk); - }); - res.on('end', function () { - client_res_complete = true; - server.close(); - }); - }); - - req.write(new Buffer(N)); - req.end(); - - common.error('client finished sending request'); -}); - -process.on('exit', function () { - assert.equal(N, bytesRecieved); - assert.equal(true, server_req_complete); - assert.equal(true, client_res_complete); -}); diff --git a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-client-upload.js b/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-client-upload.js deleted file mode 100644 index fef706f2..00000000 --- a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-client-upload.js +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -var common = require('../common'); -var assert = require('assert'); -var http = require('http'); - -var sent_body = ''; -var server_req_complete = false; -var client_res_complete = false; - -var server = http.createServer(function (req, res) { - assert.equal('POST', req.method); - req.setEncoding('utf8'); - - req.on('data', function (chunk) { - console.log('server got: ' + JSON.stringify(chunk)); - sent_body += chunk; - }); - - req.on('end', function () { - server_req_complete = true; - console.log('request complete from server'); - res.writeHead(200, {'Content-Type': 'text/plain'}); - res.write('hello\n'); - res.end(); - }); -}); -server.listen(common.PORT); - -server.on('listening', function () { - var req = http.request({ - port: common.PROXY_PORT, - method: 'POST', - path: '/' - }, function (res) { - res.setEncoding('utf8'); - res.on('data', function (chunk) { - console.log(chunk); - }); - res.on('end', function () { - client_res_complete = true; - server.close(); - }); - }); - - req.write('1\n'); - req.write('2\n'); - req.write('3\n'); - req.end(); - - common.error('client finished sending request'); -}); - -process.on('exit', function () { - assert.equal('1\n2\n3\n', sent_body); - assert.equal(true, server_req_complete); - assert.equal(true, client_res_complete); -}); diff --git a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-contentLength0.js b/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-contentLength0.js deleted file mode 100644 index abc3747e..00000000 --- a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-contentLength0.js +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -var common = require('../common'); -var http = require('http'); - -// Simple test of Node's HTTP Client choking on a response -// with a 'Content-Length: 0 ' response header. -// I.E. a space character after the 'Content-Length' throws an `error` event. - - -var s = http.createServer(function (req, res) { - res.writeHead(200, {'Content-Length': '0 '}); - res.end(); -}); -s.listen(common.PORT, function () { - - var request = http.request({ port: common.PROXY_PORT }, function (response) { - console.log('STATUS: ' + response.statusCode); - s.close(); - }); - - request.end(); -}); diff --git a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-eof-on-connect.js b/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-eof-on-connect.js deleted file mode 100644 index d02ee6d1..00000000 --- a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-eof-on-connect.js +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -var common = require('../common'); -var assert = require('assert'); -var net = require('net'); -var http = require('http'); - -// This is a regression test for http://github.com/ry/node/issues/#issue/44 -// It is separate from test-http-malformed-request.js because it is only -// reproduceable on the first packet on the first connection to a server. - -var server = http.createServer(function (req, res) {}); -server.listen(common.PORT); - -server.on('listening', function () { - net.createConnection(common.PROXY_PORT).on('connect', function () { - this.destroy(); - }).on('close', function () { - server.close(); - }); -}); diff --git a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-extra-response.js b/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-extra-response.js deleted file mode 100644 index a3d27462..00000000 --- a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-extra-response.js +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -var common = require('../common'); -var assert = require('assert'); -var http = require('http'); -var net = require('net'); - -// If an HTTP server is broken and sends data after the end of the response, -// node should ignore it and drop the connection. -// Demos this bug: https://github.com/ry/node/issues/680 - -var body = 'hello world\r\n'; -var fullResponse = - 'HTTP/1.1 500 Internal Server Error\r\n' + - 'Content-Length: ' + body.length + '\r\n' + - 'Content-Type: text/plain\r\n' + - 'Date: Fri + 18 Feb 2011 06:22:45 GMT\r\n' + - 'Host: 10.20.149.2\r\n' + - 'Access-Control-Allow-Credentials: true\r\n' + - 'Server: badly broken/0.1 (OS NAME)\r\n' + - '\r\n' + - body; - -var gotResponse = false; - - -var server = net.createServer(function (socket) { - var postBody = ''; - - socket.setEncoding('utf8'); - - socket.on('data', function (chunk) { - postBody += chunk; - - if (postBody.indexOf('\r\n') > -1) { - socket.write(fullResponse); - // omg, I wrote the response twice, what a terrible HTTP server I am. - socket.end(fullResponse); - } - }); -}); - - -server.listen(common.PORT, function () { - http.get({ port: common.PROXY_PORT }, function (res) { - var buffer = ''; - console.log('Got res code: ' + res.statusCode); - - res.setEncoding('utf8'); - res.on('data', function (chunk) { - buffer += chunk; - }); - - res.on('end', function () { - console.log('Response ended, read ' + buffer.length + ' bytes'); - assert.equal(body, buffer); - server.close(); - gotResponse = true; - }); - }); -}); - - -process.on('exit', function () { - assert.ok(gotResponse); -}); - diff --git a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-head-request.js b/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-head-request.js deleted file mode 100644 index e8c203ef..00000000 --- a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-head-request.js +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -var common = require('../common'); -var assert = require('assert'); -var http = require('http'); -var util = require('util'); - - -var body = 'hello world\n'; - -var server = http.createServer(function (req, res) { - common.error('req: ' + req.method); - res.writeHead(200, {'Content-Length': body.length}); - res.end(); - server.close(); -}); - -var gotEnd = false; - -server.listen(common.PORT, function () { - var request = http.request({ - port: common.PROXY_PORT, - method: 'HEAD', - path: '/' - }, function (response) { - common.error('response start'); - response.on('end', function () { - common.error('response end'); - gotEnd = true; - }); - }); - request.end(); -}); - -process.on('exit', function () { - assert.ok(gotEnd); -}); diff --git a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-head-response-has-no-body-end.js b/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-head-response-has-no-body-end.js deleted file mode 100644 index 6d89bee9..00000000 --- a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-head-response-has-no-body-end.js +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -// libuv-broken - - -var common = require('../common'); -var assert = require('assert'); - -var http = require('http'); - -// This test is to make sure that when the HTTP server -// responds to a HEAD request with data to res.end, -// it does not send any body. - -var server = http.createServer(function (req, res) { - res.writeHead(200); - res.end('FAIL'); // broken: sends FAIL from hot path. -}); -server.listen(common.PORT); - -var responseComplete = false; - -server.on('listening', function () { - var req = http.request({ - port: common.PROXY_PORT, - method: 'HEAD', - path: '/' - }, function (res) { - common.error('response'); - res.on('end', function () { - common.error('response end'); - server.close(); - responseComplete = true; - }); - }); - common.error('req'); - req.end(); -}); - -process.on('exit', function () { - assert.ok(responseComplete); -}); diff --git a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-head-response-has-no-body.js b/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-head-response-has-no-body.js deleted file mode 100644 index aa7a281b..00000000 --- a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-head-response-has-no-body.js +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -var common = require('../common'); -var assert = require('assert'); - -var http = require('http'); - -// This test is to make sure that when the HTTP server -// responds to a HEAD request, it does not send any body. -// In this case it was sending '0\r\n\r\n' - -var server = http.createServer(function (req, res) { - res.writeHead(200); // broken: defaults to TE chunked - res.end(); -}); -server.listen(common.PORT); - -var responseComplete = false; - -server.on('listening', function () { - var req = http.request({ - port: common.PROXY_PORT, - method: 'HEAD', - path: '/' - }, function (res) { - common.error('response'); - res.on('end', function () { - common.error('response end'); - server.close(); - responseComplete = true; - }); - }); - common.error('req'); - req.end(); -}); - -process.on('exit', function () { - assert.ok(responseComplete); -}); diff --git a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-host-headers.js b/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-host-headers.js deleted file mode 100644 index 2dae1182..00000000 --- a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-host-headers.js +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -// libuv-broken - - -var http = require('http'), - common = require('../common'), - assert = require('assert'), - httpServer = http.createServer(reqHandler); - -function reqHandler(req, res) { - console.log('Got request: ' + req.headers.host + ' ' + req.url); - if (req.url === '/setHostFalse5') { - assert.equal(req.headers.host, undefined); - } else { - assert.equal(req.headers.host, 'localhost:' + common.PROXY_PORT, - 'Wrong host header for req[' + req.url + ']: ' + - req.headers.host); - } - res.writeHead(200, {}); - //process.nextTick(function () { res.end('ok'); }); - res.end('ok'); -} - -function thrower(er) { - throw er; -} - -testHttp(); - -function testHttp() { - - console.log('testing http on port ' + common.PROXY_PORT + ' (proxied to ' + - common.PORT + ')'); - - var counter = 0; - - function cb() { - counter--; - console.log('back from http request. counter = ' + counter); - if (counter === 0) { - httpServer.close(); - } - } - - httpServer.listen(common.PORT, function (er) { - console.error('listening on ' + common.PORT); - - if (er) throw er; - - http.get({ method: 'GET', - path: '/' + (counter++), - host: 'localhost', - //agent: false, - port: common.PROXY_PORT }, cb).on('error', thrower); - - http.request({ method: 'GET', - path: '/' + (counter++), - host: 'localhost', - //agent: false, - port: common.PROXY_PORT }, cb).on('error', thrower).end(); - - http.request({ method: 'POST', - path: '/' + (counter++), - host: 'localhost', - //agent: false, - port: common.PROXY_PORT }, cb).on('error', thrower).end(); - - http.request({ method: 'PUT', - path: '/' + (counter++), - host: 'localhost', - //agent: false, - port: common.PROXY_PORT }, cb).on('error', thrower).end(); - - http.request({ method: 'DELETE', - path: '/' + (counter++), - host: 'localhost', - //agent: false, - port: common.PROXY_PORT }, cb).on('error', thrower).end(); - }); -} - diff --git a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-many-keep-alive-connections.js b/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-many-keep-alive-connections.js deleted file mode 100644 index 6b79619b..00000000 --- a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-many-keep-alive-connections.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -var common = require('../common'); -var assert = require('assert'); -var http = require('http'); - -var expected = 10000; -var responses = 0; -var requests = 0; -var connection; - -var server = http.Server(function (req, res) { - requests++; - assert.equal(req.connection, connection); - res.writeHead(200); - res.end('hello world\n'); -}); - -server.once('connection', function (c) { - connection = c; -}); - -server.listen(common.PORT, function () { - var callee = arguments.callee; - var request = http.get({ - port: common.PROXY_PORT, - path: '/', - headers: { - 'Connection': 'Keep-alive' - } - }, function (res) { - res.on('end', function () { - if (++responses < expected) { - callee(); - } else { - process.exit(); - } - }); - }).on('error', function (e) { - console.log(e.message); - process.exit(1); - }); - request.agent.maxSockets = 1; -}); - -process.on('exit', function () { - assert.equal(expected, responses); - assert.equal(expected, requests); -}); diff --git a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-multi-line-headers.js b/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-multi-line-headers.js deleted file mode 100644 index e0eeb2c1..00000000 --- a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-multi-line-headers.js +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -var common = require('../common'); -var assert = require('assert'); - -var http = require('http'); -var net = require('net'); - -var gotResponse = false; - -var server = net.createServer(function (conn) { - var body = 'Yet another node.js server.'; - - var response = - 'HTTP/1.1 200 OK\r\n' + - 'Connection: close\r\n' + - 'Content-Length: ' + body.length + '\r\n' + - 'Content-Type: text/plain;\r\n' + - ' x-unix-mode=0600;\r\n' + - ' name=\"hello.txt\"\r\n' + - '\r\n' + - body; - - conn.write(response, function () { - conn.destroy(); - server.close(); - }); -}); - -server.listen(common.PORT, function () { - http.get({host: '127.0.0.1', port: common.PROXY_PORT}, function (res) { - assert.equal(res.headers['content-type'], - 'text/plain;x-unix-mode=0600;name="hello.txt"'); - gotResponse = true; - }); -}); - -process.on('exit', function () { - assert.ok(gotResponse); -}); diff --git a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-proxy.js b/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-proxy.js deleted file mode 100644 index fdddb3cd..00000000 --- a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-proxy.js +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -var common = require('../common'); -var assert = require('assert'); -var http = require('http'); -var url = require('url'); - -var PROXY_PORT = common.PORT; -var BACKEND_PORT = common.PORT + 1; - -var cookies = [ - 'session_token=; path=/; expires=Sun, 15-Sep-2030 13:48:52 GMT', - 'prefers_open_id=; path=/; expires=Thu, 01-Jan-1970 00:00:00 GMT' -]; - -var headers = {'content-type': 'text/plain', - 'set-cookie': cookies, - 'hello': 'world' }; - -var backend = http.createServer(function (req, res) { - common.debug('backend request'); - res.writeHead(200, headers); - res.write('hello world\n'); - res.end(); -}); - -var proxy = http.createServer(function (req, res) { - common.debug('proxy req headers: ' + JSON.stringify(req.headers)); - var proxy_req = http.get({ - port: BACKEND_PORT, - path: url.parse(req.url).pathname - }, function (proxy_res) { - - common.debug('proxy res headers: ' + JSON.stringify(proxy_res.headers)); - - assert.equal('world', proxy_res.headers['hello']); - assert.equal('text/plain', proxy_res.headers['content-type']); - assert.deepEqual(cookies, proxy_res.headers['set-cookie']); - - res.writeHead(proxy_res.statusCode, proxy_res.headers); - - proxy_res.on('data', function (chunk) { - res.write(chunk); - }); - - proxy_res.on('end', function () { - res.end(); - common.debug('proxy res'); - }); - }); -}); - -var body = ''; - -var nlistening = 0; -function startReq() { - nlistening++; - if (nlistening < 2) return; - - var client = http.get({ - port: common.PROXY_PORT, - path: '/test' - }, function (res) { - common.debug('got res'); - assert.equal(200, res.statusCode); - - assert.equal('world', res.headers['hello']); - assert.equal('text/plain', res.headers['content-type']); - assert.deepEqual(cookies, res.headers['set-cookie']); - - res.setEncoding('utf8'); - res.on('data', function (chunk) { body += chunk; }); - res.on('end', function () { - proxy.close(); - backend.close(); - common.debug('closed both'); - }); - }); - common.debug('client req'); -} - -common.debug('listen proxy'); -proxy.listen(PROXY_PORT, startReq); - -common.debug('listen backend'); -backend.listen(BACKEND_PORT, startReq); - -process.on('exit', function () { - assert.equal(body, 'hello world\n'); -}); diff --git a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-response-close.js b/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-response-close.js deleted file mode 100644 index b92abb01..00000000 --- a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-response-close.js +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -var common = require('../common'); -var assert = require('assert'); -var http = require('http'); - -var gotEnd = false; - -var server = http.createServer(function (req, res) { - res.writeHead(200); - res.write('a'); - - req.on('close', function () { - console.error('aborted'); - gotEnd = true; - }); -}); -server.listen(common.PORT); - -server.on('listening', function () { - console.error('make req'); - http.get({ - port: common.PROXY_PORT - }, function (res) { - console.error('got res'); - res.on('data', function (data) { - console.error('destroy res'); - res.destroy(); - server.close(); - }); - }); -}); - -process.on('exit', function () { - assert.ok(gotEnd); -}); diff --git a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-server-multiheaders.js b/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-server-multiheaders.js deleted file mode 100644 index 6a5b8be7..00000000 --- a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-server-multiheaders.js +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -// Verify that the HTTP server implementation handles multiple instances -// of the same header as per RFC2616: joining the handful of fields by ', ' -// that support it, and dropping duplicates for other fields. - -var common = require('../common'); -var assert = require('assert'); -var http = require('http'); - -var srv = http.createServer(function (req, res) { - assert.equal(req.headers.accept, 'abc, def, ghijklmnopqrst'); - assert.equal(req.headers.host, 'foo'); - assert.equal(req.headers['x-foo'], 'bingo'); - assert.equal(req.headers['x-bar'], 'banjo, bango'); - - res.writeHead(200, {'Content-Type' : 'text/plain'}); - res.end('EOF'); - - srv.close(); -}); - -srv.listen(common.PORT, function () { - http.get({ - host: 'localhost', - port: common.PROXY_PORT, - path: '/', - headers: [ - ['accept', 'abc'], - ['accept', 'def'], - ['Accept', 'ghijklmnopqrst'], - ['host', 'foo'], - ['Host', 'bar'], - ['hOst', 'baz'], - ['x-foo', 'bingo'], - ['x-bar', 'banjo'], - ['x-bar', 'bango'] - ] - }); -}); diff --git a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-set-cookies.js b/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-set-cookies.js deleted file mode 100644 index aac29940..00000000 --- a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-set-cookies.js +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -var common = require('../common'); -var assert = require('assert'); -var http = require('http'); - -var nresponses = 0; - -var server = http.createServer(function (req, res) { - if (req.url == '/one') { - res.writeHead(200, [['set-cookie', 'A'], - ['content-type', 'text/plain']]); - res.end('one\n'); - } else { - res.writeHead(200, [['set-cookie', 'A'], - ['set-cookie', 'B'], - ['content-type', 'text/plain']]); - res.end('two\n'); - } -}); -server.listen(common.PORT); - -server.on('listening', function () { - // - // one set-cookie header - // - http.get({ port: common.PROXY_PORT, path: '/one' }, function (res) { - // set-cookie headers are always return in an array. - // even if there is only one. - assert.deepEqual(['A'], res.headers['set-cookie']); - assert.equal('text/plain', res.headers['content-type']); - - res.on('data', function (chunk) { - console.log(chunk.toString()); - }); - - res.on('end', function () { - if (++nresponses == 2) { - server.close(); - } - }); - }); - - // two set-cookie headers - - http.get({ port: common.PROXY_PORT, path: '/two' }, function (res) { - assert.deepEqual(['A', 'B'], res.headers['set-cookie']); - assert.equal('text/plain', res.headers['content-type']); - - res.on('data', function (chunk) { - console.log(chunk.toString()); - }); - - res.on('end', function () { - if (++nresponses == 2) { - server.close(); - } - }); - }); - -}); - -process.on('exit', function () { - assert.equal(2, nresponses); -}); diff --git a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-status-code.js b/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-status-code.js deleted file mode 100644 index dffbaf7c..00000000 --- a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-status-code.js +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -// libuv-broken - - -var common = require('../common'); -var assert = require('assert'); -var http = require('http'); - -// Simple test of Node's HTTP ServerResponse.statusCode -// ServerResponse.prototype.statusCode - -var testsComplete = 0; -var tests = [200, 202, 300, 404, 500]; -var testIdx = 0; - -var s = http.createServer(function (req, res) { - var t = tests[testIdx]; - res.writeHead(t, {'Content-Type': 'text/plain'}); - console.log('--\nserver: statusCode after writeHead: ' + res.statusCode); - assert.equal(res.statusCode, t); - res.end('hello world\n'); -}); - -s.listen(common.PORT, nextTest); - - -function nextTest() { - if (testIdx + 1 === tests.length) { - return s.close(); - } - var test = tests[testIdx]; - - http.get({ port: common.PROXY_PORT }, function (response) { - console.log('client: expected status: ' + test); - console.log('client: statusCode: ' + response.statusCode); - assert.equal(response.statusCode, test); - response.on('end', function () { - testsComplete++; - testIdx += 1; - nextTest(); - }); - }); -} - - -process.on('exit', function () { - assert.equal(4, testsComplete); -}); - diff --git a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-upgrade-server2.js b/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-upgrade-server2.js deleted file mode 100644 index a5273761..00000000 --- a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http-upgrade-server2.js +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -var common = require('../common'); -var assert = require('assert'); -var http = require('http'); -var net = require('net'); - -var server = http.createServer(function (req, res) { - common.error('got req'); - throw new Error('This shouldn\'t happen.'); -}); - -server.on('upgrade', function (req, socket, upgradeHead) { - common.error('got upgrade event'); - // test that throwing an error from upgrade gets - // is uncaught - throw new Error('upgrade error'); -}); - -var gotError = false; - -process.on('uncaughtException', function (e) { - common.error('got \'clientError\' event'); - assert.equal('upgrade error', e.message); - gotError = true; - process.exit(0); -}); - - -server.listen(common.PORT, function () { - var c = net.createConnection(common.PROXY_PORT); - - c.on('connect', function () { - common.error('client wrote message'); - c.write('GET /blah HTTP/1.1\r\n' + - 'Upgrade: WebSocket\r\n' + - 'Connection: Upgrade\r\n' + - '\r\n\r\nhello world'); - }); - - c.on('end', function () { - c.end(); - }); - - c.on('close', function () { - common.error('client close'); - server.close(); - }); -}); - -process.on('exit', function () { - assert.ok(gotError); -}); diff --git a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http.js b/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http.js deleted file mode 100644 index e082eb2c..00000000 --- a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/core/simple/test-http.js +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -var common = require('../common'); -var assert = require('assert'); -var http = require('http'); -var url = require('url'); - -function p(x) { - common.error(common.inspect(x)); -} - -var responses_sent = 0; -var responses_recvd = 0; -var body0 = ''; -var body1 = ''; - -var server = http.Server(function (req, res) { - if (responses_sent == 0) { - assert.equal('GET', req.method); - assert.equal('/hello', url.parse(req.url).pathname); - - console.dir(req.headers); - assert.equal(true, 'accept' in req.headers); - assert.equal('*/*', req.headers['accept']); - - assert.equal(true, 'foo' in req.headers); - assert.equal('bar', req.headers['foo']); - } - - if (responses_sent == 1) { - assert.equal('POST', req.method); - assert.equal('/world', url.parse(req.url).pathname); - this.close(); - } - - req.on('end', function () { - res.writeHead(200, {'Content-Type': 'text/plain'}); - res.write('The path was ' + url.parse(req.url).pathname); - res.end(); - responses_sent += 1; - }); - - //assert.equal('127.0.0.1', res.connection.remoteAddress); -}); -server.listen(common.PORT); - -server.on('listening', function () { - var agent = new http.Agent({ port: common.PROXY_PORT, maxSockets: 1 }); - http.get({ - port: common.PROXY_PORT, - path: '/hello', - headers: {'Accept': '*/*', 'Foo': 'bar'}, - agent: agent - }, function (res) { - assert.equal(200, res.statusCode); - responses_recvd += 1; - res.setEncoding('utf8'); - res.on('data', function (chunk) { body0 += chunk; }); - common.debug('Got /hello response'); - }); - - setTimeout(function () { - var req = http.request({ - port: common.PROXY_PORT, - method: 'POST', - path: '/world', - agent: agent - }, function (res) { - assert.equal(200, res.statusCode); - responses_recvd += 1; - res.setEncoding('utf8'); - res.on('data', function (chunk) { body1 += chunk; }); - common.debug('Got /world response'); - }); - req.end(); - }, 1); -}); - -process.on('exit', function () { - common.debug('responses_recvd: ' + responses_recvd); - assert.equal(2, responses_recvd); - - common.debug('responses_sent: ' + responses_sent); - assert.equal(2, responses_sent); - - assert.equal('The path was /hello', body0); - assert.equal('The path was /world', body1); -}); - diff --git a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/examples-test.js b/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/examples-test.js deleted file mode 100644 index 36beb89a..00000000 --- a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/examples-test.js +++ /dev/null @@ -1,26 +0,0 @@ -/* - * examples.js: Tests which ensure all examples do not throw errors. - * - * (C) 2010, Charlie Robbins - * - */ - -var vows = require('vows') - macros = require('./macros'), - examples = macros.examples; - -// -// Suppress `EADDRINUSE` errors since -// we are just checking for require-time errors -// -process.on('uncaughtException', function (err) { - if (err.code !== 'EADDRINUSE') { - throw err; - } -}); - -vows.describe('node-http-proxy/examples').addBatch( - examples.shouldHaveDeps() -).addBatch( - examples.shouldHaveNoErrors() -).export(module);
\ No newline at end of file diff --git a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/fixtures/agent2-cert.pem b/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/fixtures/agent2-cert.pem deleted file mode 100644 index 8e4354db..00000000 --- a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/fixtures/agent2-cert.pem +++ /dev/null @@ -1,13 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIB7DCCAZYCCQC7gs0MDNn6MTANBgkqhkiG9w0BAQUFADB9MQswCQYDVQQGEwJV -UzELMAkGA1UECBMCQ0ExCzAJBgNVBAcTAlNGMQ8wDQYDVQQKEwZKb3llbnQxEDAO -BgNVBAsTB05vZGUuanMxDzANBgNVBAMTBmFnZW50MjEgMB4GCSqGSIb3DQEJARYR -cnlAdGlueWNsb3Vkcy5vcmcwHhcNMTEwMzE0MTgyOTEyWhcNMzgwNzI5MTgyOTEy -WjB9MQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExCzAJBgNVBAcTAlNGMQ8wDQYD -VQQKEwZKb3llbnQxEDAOBgNVBAsTB05vZGUuanMxDzANBgNVBAMTBmFnZW50MjEg -MB4GCSqGSIb3DQEJARYRcnlAdGlueWNsb3Vkcy5vcmcwXDANBgkqhkiG9w0BAQEF -AANLADBIAkEAyXb8FrRdKbhrKLgLSsn61i1C7w7fVVVd7OQsmV/7p9WB2lWFiDlC -WKGU9SiIz/A6wNZDUAuc2E+VwtpCT561AQIDAQABMA0GCSqGSIb3DQEBBQUAA0EA -C8HzpuNhFLCI3A5KkBS5zHAQax6TFUOhbpBCR0aTDbJ6F1liDTK1lmU/BjvPoj+9 -1LHwrmh29rK8kBPEjmymCQ== ------END CERTIFICATE----- diff --git a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/fixtures/agent2-csr.pem b/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/fixtures/agent2-csr.pem deleted file mode 100644 index a670c4c6..00000000 --- a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/fixtures/agent2-csr.pem +++ /dev/null @@ -1,10 +0,0 @@ ------BEGIN CERTIFICATE REQUEST----- -MIIBXTCCAQcCAQAwfTELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMQswCQYDVQQH -EwJTRjEPMA0GA1UEChMGSm95ZW50MRAwDgYDVQQLEwdOb2RlLmpzMQ8wDQYDVQQD -EwZhZ2VudDIxIDAeBgkqhkiG9w0BCQEWEXJ5QHRpbnljbG91ZHMub3JnMFwwDQYJ -KoZIhvcNAQEBBQADSwAwSAJBAMl2/Ba0XSm4ayi4C0rJ+tYtQu8O31VVXezkLJlf -+6fVgdpVhYg5QlihlPUoiM/wOsDWQ1ALnNhPlcLaQk+etQECAwEAAaAlMCMGCSqG -SIb3DQEJBzEWExRBIGNoYWxsZW5nZSBwYXNzd29yZDANBgkqhkiG9w0BAQUFAANB -AJnll2pt5l0pzskQSpjjLVTlFDFmJr/AZ3UK8v0WxBjYjCe5Jx4YehkChpxIyDUm -U3J9q9MDUf0+Y2+EGkssFfk= ------END CERTIFICATE REQUEST----- diff --git a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/fixtures/agent2-key.pem b/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/fixtures/agent2-key.pem deleted file mode 100644 index 522903c6..00000000 --- a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/fixtures/agent2-key.pem +++ /dev/null @@ -1,9 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIBOgIBAAJBAMl2/Ba0XSm4ayi4C0rJ+tYtQu8O31VVXezkLJlf+6fVgdpVhYg5 -QlihlPUoiM/wOsDWQ1ALnNhPlcLaQk+etQECAwEAAQJBAMT6Bf34+UHKY1ObpsbH -9u2jsVblFq1rWvs8GPMY6oertzvwm3DpuSUp7PTgOB1nLTLYtCERbQ4ovtN8tn3p -OHUCIQDzIEGsoCr5vlxXvy2zJwu+fxYuhTZWMVuo1397L0VyhwIhANQh+yzqUgaf -WRtSB4T2W7ADtJI35ET61jKBty3CqJY3AiAIwju7dVW3A5WeD6Qc1SZGKZvp9yCb -AFI2BfVwwaY11wIgXF3PeGcvACMyMWsuSv7aPXHfliswAbkWuzcwA4TW01ECIGWa -cgsDvVFxmfM5NPSuT/UDTa6R5BFISB5ea0N0AR3I ------END RSA PRIVATE KEY----- diff --git a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/fixtures/agent2.cnf b/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/fixtures/agent2.cnf deleted file mode 100644 index 0a9f2c73..00000000 --- a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/fixtures/agent2.cnf +++ /dev/null @@ -1,19 +0,0 @@ -[ req ] -default_bits = 1024 -days = 999 -distinguished_name = req_distinguished_name -attributes = req_attributes -prompt = no - -[ req_distinguished_name ] -C = US -ST = CA -L = SF -O = Joyent -OU = Node.js -CN = agent2 -emailAddress = ry@tinyclouds.org - -[ req_attributes ] -challengePassword = A challenge password - diff --git a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/helpers/http.js b/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/helpers/http.js deleted file mode 100644 index aaf7a804..00000000 --- a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/helpers/http.js +++ /dev/null @@ -1,182 +0,0 @@ -/* - * http.js: Top level include for node-http-proxy http helpers - * - * (C) 2010 Nodejitsu Inc. - * MIT LICENCE - * - */ - -var assert = require('assert'), - http = require('http'), - https = require('https'), - url = require('url'), - async = require('async'), - helpers = require('./index'), - protocols = helpers.protocols, - httpProxy = require('../../lib/node-http-proxy'); - -// -// ### function createServerPair (options, callback) -// #### @options {Object} Options to create target and proxy server. -// #### @callback {function} Continuation to respond to when complete. -// -// Creates http target and proxy servers -// -exports.createServerPair = function (options, callback) { - async.series([ - // - // 1. Create the target server - // - function createTarget(next) { - exports.createServer(options.target, next); - }, - // - // 2. Create the proxy server - // - function createTarget(next) { - exports.createProxyServer(options.proxy, next); - } - ], callback); -}; - -// -// ### function createServer (options, callback) -// #### @options {Object} Options for creatig an http server. -// #### @port {number} Port to listen on -// #### @output {string} String to write to each HTTP response -// #### @headers {Object} Headers to assert are sent by `node-http-proxy`. -// #### @callback {function} Continuation to respond to when complete. -// -// Creates a target server that the tests will proxy to. -// -exports.createServer = function (options, callback) { - // - // Request handler to use in either `http` - // or `https` server. - // - function requestHandler(req, res) { - if (options.headers) { - Object.keys(options.headers).forEach(function (key) { - assert.equal(req.headers[key], options.headers[key]); - }); - } - - if (options.outputHeaders) { - Object.keys(options.outputHeaders).forEach(function (header) { - res.setHeader(header, options.outputHeaders[header]); - }); - } - - setTimeout(function() { - res.writeHead(200, { 'Content-Type': 'text/plain' }); - res.write(options.output || 'hello proxy'); - res.end(); - }, options.latency || 1); - } - - var server = protocols.target === 'https' - ? https.createServer(helpers.https, requestHandler) - : http.createServer(requestHandler); - - server.listen(options.port, function () { - callback(null, this); - }); -}; - -// -// ### function createProxyServer (options, callback) -// #### @options {Object} Options for creatig an http server. -// #### @port {number} Port to listen on -// #### @latency {number} Latency of this server in milliseconds -// #### @proxy {Object} Options to pass to the HttpProxy. -// #### @routing {boolean} Enables `httpProxy.RoutingProxy` -// #### @callback {function} Continuation to respond to when complete. -// -// Creates a proxy server that the tests will request against. -// -exports.createProxyServer = function (options, callback) { - if (!options.latency) { - if (protocols.proxy === 'https') { - options.proxy.https = helpers.https; - } - options.proxy.rejectUnauthorized = false; - - return httpProxy - .createServer(options.proxy) - .listen(options.port, function () { - callback(null, this); - }); - } - - var server, - proxy; - - proxy = options.routing - ? new httpProxy.RoutingProxy(options.proxy) - : new httpProxy.HttpProxy(options.proxy); - - // - // Request handler to use in either `http` - // or `https` server. - // - function requestHandler(req, res) { - var buffer = httpProxy.buffer(req); - - if (options.outputHeaders) { - Object.keys(options.outputHeaders).forEach(function (header) { - res.setHeader(header, options.outputHeaders[header]); - }); - } - setTimeout(function () { - // - // Setup options dynamically for `RoutingProxy.prototype.proxyRequest` - // or `HttpProxy.prototype.proxyRequest`. - // - buffer = options.routing ? { buffer: buffer } : buffer; - proxy.proxyRequest(req, res, buffer); - }, options.latency); - } - - server = protocols.proxy === 'https' - ? https.createServer(helpers.https, requestHandler) - : http.createServer(requestHandler); - - server.listen(options.port, function () { - callback(null, this); - }); -}; - -// -// ### function assignPortsToRoutes (routes) -// #### @routes {Object} Routing table to assign ports to -// -// Assigns dynamic ports to the `routes` for runtime testing. -// -exports.assignPortsToRoutes = function (routes) { - Object.keys(routes).forEach(function (source) { - routes[source] = routes[source].replace('{PORT}', helpers.nextPort); - }); - - return routes; -}; - -// -// ### function parseRoutes (options) -// #### @options {Object} Options to use when parsing routes -// #### @protocol {string} Protocol to use in the routes -// #### @routes {Object} Routes to parse. -// -// Returns an Array of fully-parsed URLs for the source and -// target of `options.routes`. -// -exports.parseRoutes = function (options) { - var protocol = options.protocol || 'http', - routes = options.routes; - - return Object.keys(routes).map(function (source) { - return { - source: url.parse(protocol + '://' + source), - target: url.parse(protocol + '://' + routes[source]) - }; - }); -}; diff --git a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/helpers/index.js b/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/helpers/index.js deleted file mode 100644 index 7e3c3f48..00000000 --- a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/helpers/index.js +++ /dev/null @@ -1,105 +0,0 @@ -/* - * index.js: Top level include for node-http-proxy helpers - * - * (C) 2010 Nodejitsu Inc. - * MIT LICENCE - * - */ - -var fs = require('fs'), - path = require('path'); - -var fixturesDir = path.join(__dirname, '..', 'fixtures'); - -// -// @https {Object} -// Returns the necessary `https` credentials. -// -Object.defineProperty(exports, 'https', { - get: function () { - delete this.https; - return this.https = { - key: fs.readFileSync(path.join(fixturesDir, 'agent2-key.pem'), 'utf8'), - cert: fs.readFileSync(path.join(fixturesDir, 'agent2-cert.pem'), 'utf8') - }; - } -}); - -// -// @protocols {Object} -// Returns an object representing the desired protocols -// for the `proxy` and `target` server. -// -Object.defineProperty(exports, 'protocols', { - get: function () { - delete this.protocols; - return this.protocols = { - target: exports.argv.target || 'http', - proxy: exports.argv.proxy || 'http' - }; - } -}); - -// -// @nextPort {number} -// Returns an auto-incrementing port for tests. -// -Object.defineProperty(exports, 'nextPort', { - get: function () { - var current = this.port || 9050; - this.port = current + 1; - return current; - } -}); - -// -// @nextPortPair {Object} -// Returns an auto-incrementing pair of ports for tests. -// -Object.defineProperty(exports, 'nextPortPair', { - get: function () { - return { - target: this.nextPort, - proxy: this.nextPort - }; - } -}); - -// -// ### function describe(prefix) -// #### @prefix {string} Prefix to use before the description -// -// Returns a string representing the protocols that this suite -// is testing based on CLI arguments. -// -exports.describe = function (prefix, base) { - prefix = prefix || ''; - base = base || 'http'; - - function protocol(endpoint) { - return exports.protocols[endpoint] === 'https' - ? base + 's' - : base; - } - - return [ - 'node-http-proxy', - prefix, - [ - protocol('proxy'), - '-to-', - protocol('target') - ].join('') - ].filter(Boolean).join('/'); -}; - -// -// Expose the CLI arguments -// -exports.argv = require('optimist').argv; - -// -// Export additional helpers for `http` and `websockets`. -// -exports.http = require('./http'); -exports.ws = require('./ws');
\ No newline at end of file diff --git a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/helpers/ws.js b/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/helpers/ws.js deleted file mode 100644 index a4905227..00000000 --- a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/helpers/ws.js +++ /dev/null @@ -1,112 +0,0 @@ -/* - * ws.js: Top level include for node-http-proxy websocket helpers - * - * (C) 2010 Nodejitsu Inc. - * MIT LICENCE - * - */ - -var assert = require('assert'), - https = require('https'), - async = require('async'), - io = require('socket.io'), - ws = require('ws'), - helpers = require('./index'), - protocols = helpers.protocols, - http = require('./http'); - -// -// ### function createServerPair (options, callback) -// #### @options {Object} Options to create target and proxy server. -// #### @target {Object} Options for the target server. -// #### @proxy {Object} Options for the proxy server. -// #### @callback {function} Continuation to respond to when complete. -// -// Creates http target and proxy servers -// -exports.createServerPair = function (options, callback) { - async.series([ - // - // 1. Create the target server - // - function createTarget(next) { - exports.createServer(options.target, next); - }, - // - // 2. Create the proxy server - // - function createTarget(next) { - http.createProxyServer(options.proxy, next); - } - ], callback); -}; - -// -// ### function createServer (options, callback) -// #### @options {Object} Options for creating the socket.io or ws server. -// #### @raw {boolean} Enables ws.Websocket server. -// -// Creates a socket.io or ws server using the specified `options`. -// -exports.createServer = function (options, callback) { - return options.raw - ? exports.createWsServer(options, callback) - : exports.createSocketIoServer(options, callback); -}; - -// -// ### function createSocketIoServer (options, callback) -// #### @options {Object} Options for creating the socket.io server -// #### @port {number} Port to listen on -// #### @input {string} Input to expect from the only socket -// #### @output {string} Output to send the only socket -// -// Creates a socket.io server on the specified `options.port` which -// will expect `options.input` and then send `options.output`. -// -exports.createSocketIoServer = function (options, callback) { - var server = protocols.target === 'https' - ? io.listen(options.port, helpers.https, callback) - : io.listen(options.port, callback); - - server.sockets.on('connection', function (socket) { - socket.on('incoming', function (data) { - assert.equal(data, options.input); - socket.emit('outgoing', options.output); - }); - }); -}; - -// -// ### function createWsServer (options, callback) -// #### @options {Object} Options for creating the ws.Server instance -// #### @port {number} Port to listen on -// #### @input {string} Input to expect from the only socket -// #### @output {string} Output to send the only socket -// -// Creates a ws.Server instance on the specified `options.port` which -// will expect `options.input` and then send `options.output`. -// -exports.createWsServer = function (options, callback) { - var server, - wss; - - if (protocols.target === 'https') { - server = https.createServer(helpers.https, function (req, res) { - req.writeHead(200); - req.end(); - }).listen(options.port, callback); - - wss = new ws.Server({ server: server }); - } - else { - wss = new ws.Server({ port: options.port }, callback); - } - - wss.on('connection', function (socket) { - socket.on('message', function (data) { - assert.equal(data, options.input); - socket.send(options.output); - }); - }); -};
\ No newline at end of file diff --git a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/http/http-test.js b/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/http/http-test.js deleted file mode 100644 index 81f8726a..00000000 --- a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/http/http-test.js +++ /dev/null @@ -1,102 +0,0 @@ -/* - node-http-proxy-test.js: http proxy for node.js - - Copyright (c) 2010 Charlie Robbins, Marak Squires and Fedor Indutny - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -*/ - -var assert = require('assert'), - fs = require('fs'), - path = require('path'), - async = require('async'), - request = require('request'), - vows = require('vows'), - macros = require('../macros'), - helpers = require('../helpers'); - -var routeFile = path.join(__dirname, 'config.json'); - -vows.describe(helpers.describe()).addBatch({ - "With a valid target server": { - "and no latency": { - "and no headers": macros.http.assertProxied(), - "and headers": macros.http.assertProxied({ - request: { headers: { host: 'unknown.com' } } - }), - "and request close connection header": macros.http.assertProxied({ - request: { headers: { connection: "close" } }, - outputHeaders: { connection: "close" } - }), - "and request keep alive connection header": macros.http.assertProxied({ - request: { headers: { connection: "keep-alive" } }, - outputHeaders: { connection: "keep-alive" } - }), - "and response close connection header": macros.http.assertProxied({ - request: { headers: { connection: "" } }, // Must explicitly set to "" because otherwise node will automatically add a "connection: keep-alive" header - targetHeaders: { connection: "close" }, - outputHeaders: { connection: "close" } - }), - "and response keep-alive connection header": macros.http.assertProxied({ - request: { headers: { connection: "" } }, // Must explicitly set to "" because otherwise node will automatically add a "connection: keep-alive" header - targetHeaders: { connection: "keep-alive" }, - outputHeaders: { connection: "keep-alive" } - }), - "and response keep-alive connection header from http 1.0 client": macros.http.assertRawHttpProxied({ - rawRequest: "GET / HTTP/1.0\r\n\r\n", - targetHeaders: { connection: "keep-alive" }, - match: /connection: close/i - }), - "and request keep alive from http 1.0 client": macros.http.assertRawHttpProxied({ - rawRequest: "GET / HTTP/1.0\r\nConnection: Keep-Alive\r\n\r\n", - targetHeaders: { connection: "keep-alive" }, - match: /connection: keep-alive/i - }), - "and no connection header": macros.http.assertProxied({ - request: { headers: { connection: "" } }, // Must explicitly set to "" because otherwise node will automatically add a "connection: keep-alive" header - outputHeaders: { connection: "keep-alive" } - }), - "and forwarding enabled": macros.http.assertForwardProxied() - }, - "and latency": { - "and no headers": macros.http.assertProxied({ - latency: 2000 - }), - "and response headers": macros.http.assertProxied({ - targetHeaders: { "x-testheader": "target" }, - proxyHeaders: { "X-TestHeader": "proxy" }, - outputHeaders: { "x-testheader": "target" }, - latency: 1000 - }) - }, - "and timeout set": macros.http.assertProxied({ - shouldFail: true, - timeout: 2000, - requestLatency: 4000 - }) - }, - "With a no valid target server": { - "and no latency": macros.http.assertInvalidProxy(), - "and latency": macros.http.assertInvalidProxy({ - latency: 2000 - }) - } -}).export(module); diff --git a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/http/routing-table-test.js b/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/http/routing-table-test.js deleted file mode 100644 index f3dcf31e..00000000 --- a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/http/routing-table-test.js +++ /dev/null @@ -1,107 +0,0 @@ -/* - * routing-table-test.js: Tests for the proxying using the ProxyTable object. - * - * (C) 2010, Charlie Robbins - * - */ - -var assert = require('assert'), - fs = require('fs'), - path = require('path'), - async = require('async'), - request = require('request'), - vows = require('vows'), - macros = require('../macros'), - helpers = require('../helpers'); - -var routeFile = path.join(__dirname, 'config.json'); - -vows.describe(helpers.describe('routing-table')).addBatch({ - "With a routing table": { - "with latency": macros.http.assertProxiedToRoutes({ - latency: 2000, - routes: { - "icanhaz.com": "127.0.0.1:{PORT}", - "latency.com": "127.0.0.1:{PORT}" - } - }), - "addHost() / removeHost()": macros.http.assertDynamicProxy({ - hostnameOnly: true, - routes: { - "static.com": "127.0.0.1:{PORT}", - "removed.com": "127.0.0.1:{PORT}" - } - }, { - add: [{ host: 'dynamic1.com', target: '127.0.0.1:' }], - drop: ['removed.com'] - }), - "using RegExp": macros.http.assertProxiedToRoutes({ - routes: { - "foo.com": "127.0.0.1:{PORT}", - "bar.com": "127.0.0.1:{PORT}", - "baz.com/taco": "127.0.0.1:{PORT}", - "pizza.com/taco/muffins": "127.0.0.1:{PORT}", - "blah.com/me": "127.0.0.1:{PORT}/remapped", - "bleh.com/remap/this": "127.0.0.1:{PORT}/remap/remapped", - "test.com/double/tap": "127.0.0.1:{PORT}/remap" - } - }), - "using hostnameOnly": macros.http.assertProxiedToRoutes({ - hostnameOnly: true, - routes: { - "foo.com": "127.0.0.1:{PORT}", - "bar.com": "127.0.0.1:{PORT}" - } - }), - "using pathnameOnly": macros.http.assertProxiedToRoutes({ - pathnameOnly: true, - routes: { - "/foo": "127.0.0.1:{PORT}", - "/bar": "127.0.0.1:{PORT}", - "/pizza": "127.0.0.1:{PORT}" - } - }), - "using a routing file": macros.http.assertProxiedToRoutes({ - filename: routeFile, - routes: { - "foo.com": "127.0.0.1:{PORT}", - "bar.com": "127.0.0.1:{PORT}" - } - }, { - "after the file has been modified": { - topic: function () { - var config = JSON.parse(fs.readFileSync(routeFile, 'utf8')), - protocol = helpers.protocols.proxy, - port = helpers.nextPort, - that = this; - - config.router['dynamic.com'] = "127.0.0.1:" + port; - fs.writeFileSync(routeFile, JSON.stringify(config)); - - async.parallel([ - function waitForRoutes(next) { - that.proxyServer.on('routes', next); - }, - async.apply( - helpers.http.createServer, - { - port: port, - output: 'hello from dynamic.com' - } - ) - ], function () { - request({ - uri: protocol + '://127.0.0.1:' + that.port, - headers: { - host: 'dynamic.com' - } - }, that.callback); - }); - }, - "should receive 'hello from dynamic.com'": function (err, res, body) { - assert.equal(body, 'hello from dynamic.com'); - } - } - }) - } -}).export(module); diff --git a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/macros/examples.js b/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/macros/examples.js deleted file mode 100644 index 9d4202e6..00000000 --- a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/macros/examples.js +++ /dev/null @@ -1,101 +0,0 @@ -/* - * examples.js: Macros for testing code in examples/ - * - * (C) 2010 Nodejitsu Inc. - * MIT LICENCE - * - */ - -var assert = require('assert'), - fs = require('fs'), - path = require('path'), - spawn = require('child_process').spawn, - async = require('async'); - -var rootDir = path.join(__dirname, '..', '..'), - examplesDir = path.join(rootDir, 'examples'); - -// -// ### function shouldHaveDeps () -// -// Ensures that all `npm` dependencies are installed in `/examples`. -// -exports.shouldHaveDeps = function () { - return { - "Before testing examples": { - topic: function () { - async.waterfall([ - // - // 1. Read files in examples dir - // - async.apply(fs.readdir, examplesDir), - // - // 2. If node_modules exists, continue. Otherwise - // exec `npm` to install them - // - function checkNodeModules(files, next) { - if (files.indexOf('node_modules') !== -1) { - return next(); - } - - var child = spawn('npm', ['install', '-f'], { - cwd: examplesDir - }); - - child.on('exit', function (code) { - return code - ? next(new Error('npm install exited with non-zero exit code')) - : next(); - }); - }, - // - // 3. Read files in examples dir again to ensure the install - // worked as expected. - // - async.apply(fs.readdir, examplesDir), - ], this.callback); - }, - "examples/node_modules should exist": function (err, files) { - assert.notEqual(files.indexOf('node_modules'), -1); - } - } - } -}; - -// -// ### function shouldRequire (file) -// #### @file {string} File to attempt to require -// -// Returns a test which attempts to require `file`. -// -exports.shouldRequire = function (file) { - return { - "should have no errors": function () { - try { assert.isObject(require(file)) } - catch (ex) { assert.isNull(ex) } - } - }; -}; - -// -// ### function shouldHaveNoErrors () -// -// Returns a vows context that attempts to require -// every relevant example file in `examples`. -// -exports.shouldHaveNoErrors = function () { - var context = {}; - - ['balancer', 'http', 'middleware', 'websocket'].forEach(function (dir) { - var name = 'examples/' + dir, - files = fs.readdirSync(path.join(rootDir, 'examples', dir)); - - files.forEach(function (file) { - context[name + '/' + file] = exports.shouldRequire(path.join( - examplesDir, dir, file - )); - }); - }); - - return context; -};
\ No newline at end of file diff --git a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/macros/http.js b/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/macros/http.js deleted file mode 100644 index d3d83426..00000000 --- a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/macros/http.js +++ /dev/null @@ -1,531 +0,0 @@ -/* - * http.js: Macros for proxying HTTP requests - * - * (C) 2010 Nodejitsu Inc. - * MIT LICENCE - * - */ - -var assert = require('assert'), - fs = require('fs'), - async = require('async'), - net = require('net'), - request = require('request'), - helpers = require('../helpers/index'); - -// -// ### function assertRequest (options) -// #### @options {Object} Options for this request assertion. -// #### @request {Object} Options to use for `request`. -// #### @assert {Object} Test assertions against the response. -// -// Makes a request using `options.request` and then asserts the response -// and body against anything in `options.assert`. -// -exports.assertRequest = function (options) { - return { - topic: function () { - // - // Now make the HTTP request and assert. - // - options.request.rejectUnauthorized = false; - request(options.request, this.callback); - }, - "should succeed": function (err, res, body) { - assert.isNull(err); - if (options.assert.headers) { - Object.keys(options.assert.headers).forEach(function(header){ - assert.equal(res.headers[header], options.assert.headers[header]); - }); - } - - if (options.assert.body) { - assert.equal(body, options.assert.body); - } - - if (options.assert.statusCode) { - assert.equal(res.statusCode, options.assert.statusCode); - } - } - }; -}; - -// -// ### function assertFailedRequest (options) -// #### @options {Object} Options for this failed request assertion. -// #### @request {Object} Options to use for `request`. -// #### @assert {Object} Test assertions against the response. -// -// Makes a request using `options.request` and then asserts the response -// and body against anything in `options.assert`. -// -exports.assertFailedRequest = function (options) { - return { - topic: function () { - // - // Now make the HTTP request and assert. - // - options.request.rejectUnauthorized = false; - request(options.request, this.callback); - }, - "should not succeed": function (err, res, body) { - assert.notStrictEqual(err,null); - } - }; -}; - -// -// ### function assertProxied (options) -// #### @options {Object} Options for this test -// #### @latency {number} Latency in milliseconds for the proxy server. -// #### @ports {Object} Ports for the request (target, proxy). -// #### @output {string} Output to assert from. -// #### @forward {Object} Options for forward proxying. -// -// Creates a complete end-to-end test for requesting against an -// http proxy. -// -exports.assertProxied = function (options) { - options = options || {}; - - var ports = options.ports || helpers.nextPortPair, - output = options.output || 'hello world from ' + ports.target, - outputHeaders = options.outputHeaders, - targetHeaders = options.targetHeaders, - proxyHeaders = options.proxyHeaders, - protocol = helpers.protocols.proxy, - req = options.request || {}, - timeout = options.timeout || null, - assertFn = options.shouldFail - ? exports.assertFailedRequest - : exports.assertRequest; - - req.uri = req.uri || protocol + '://127.0.0.1:' + ports.proxy; - - return { - topic: function () { - // - // Create a target server and a proxy server - // using the `options` supplied. - // - helpers.http.createServerPair({ - target: { - output: output, - outputHeaders: targetHeaders, - port: ports.target, - headers: req.headers, - latency: options.requestLatency - }, - proxy: { - latency: options.latency, - port: ports.proxy, - outputHeaders: proxyHeaders, - proxy: { - forward: options.forward, - target: { - https: helpers.protocols.target === 'https', - host: '127.0.0.1', - port: ports.target - }, - timeout: timeout - } - } - }, this.callback); - }, - "the proxy request": assertFn({ - request: req, - assert: { - headers: outputHeaders, - body: output - } - }) - }; -}; - -// -// ### function assertRawHttpProxied (options) -// #### @options {Object} Options for this test -// #### @rawRequest {string} Raw HTTP request to perform. -// #### @match {RegExp} Output to match in the response. -// #### @latency {number} Latency in milliseconds for the proxy server. -// #### @ports {Object} Ports for the request (target, proxy). -// #### @output {string} Output to assert from. -// #### @forward {Object} Options for forward proxying. -// -// Creates a complete end-to-end test for requesting against an -// http proxy. -// -exports.assertRawHttpProxied = function (options) { - // Don't test raw requests over HTTPS since options.rawRequest won't be - // encrypted. - if(helpers.protocols.proxy == 'https') { - return true; - } - - options = options || {}; - - var ports = options.ports || helpers.nextPortPair, - output = options.output || 'hello world from ' + ports.target, - outputHeaders = options.outputHeaders, - targetHeaders = options.targetHeaders, - proxyHeaders = options.proxyHeaders, - protocol = helpers.protocols.proxy, - timeout = options.timeout || null, - assertFn = options.shouldFail - ? exports.assertFailedRequest - : exports.assertRequest; - - return { - topic: function () { - var topicCallback = this.callback; - - // - // Create a target server and a proxy server - // using the `options` supplied. - // - helpers.http.createServerPair({ - target: { - output: output, - outputHeaders: targetHeaders, - port: ports.target, - latency: options.requestLatency - }, - proxy: { - latency: options.latency, - port: ports.proxy, - outputHeaders: proxyHeaders, - proxy: { - forward: options.forward, - target: { - https: helpers.protocols.target === 'https', - host: '127.0.0.1', - port: ports.target - }, - timeout: timeout - } - } - }, function() { - var response = ''; - var client = net.connect(ports.proxy, '127.0.0.1', function() { - client.write(options.rawRequest); - }); - - client.on('data', function(data) { - response += data.toString(); - }); - - client.on('end', function() { - topicCallback(null, options.match, response); - }); - }); - }, - "should succeed": function(err, match, response) { - assert.match(response, match); - } - }; -}; - -// -// ### function assertInvalidProxy (options) -// #### @options {Object} Options for this test -// #### @latency {number} Latency in milliseconds for the proxy server -// #### @ports {Object} Ports for the request (target, proxy) -// -// Creates a complete end-to-end test for requesting against an -// http proxy with no target server. -// -exports.assertInvalidProxy = function (options) { - options = options || {}; - - var ports = options.ports || helpers.nextPortPair, - req = options.request || {}, - protocol = helpers.protocols.proxy; - - - req.uri = req.uri || protocol + '://127.0.0.1:' + ports.proxy; - - return { - topic: function () { - // - // Only create the proxy server, simulating a reverse-proxy - // to an invalid location. - // - helpers.http.createProxyServer({ - latency: options.latency, - port: ports.proxy, - proxy: { - target: { - host: '127.0.0.1', - port: ports.target - } - } - }, this.callback); - }, - "the proxy request": exports.assertRequest({ - request: req, - assert: { - statusCode: 500 - } - }) - }; -}; - -// -// ### function assertForwardProxied (options) -// #### @options {Object} Options for this test. -// -// Creates a complete end-to-end test for requesting against an -// http proxy with both a valid and invalid forward target. -// -exports.assertForwardProxied = function (options) { - var forwardPort = helpers.nextPort; - - return { - topic: function () { - helpers.http.createServer({ - output: 'hello from forward', - port: forwardPort - }, this.callback); - }, - "and a valid forward target": exports.assertProxied({ - forward: { - port: forwardPort, - host: '127.0.0.1' - } - }), - "and an invalid forward target": exports.assertProxied({ - forward: { - port: 9898, - host: '127.0.0.1' - } - }) - }; -}; - -// -// ### function assertProxiedtoRoutes (options, nested) -// #### @options {Object} Options for this ProxyTable-based test -// #### @routes {Object|string} Routes to use for the proxy. -// #### @hostnameOnly {boolean} Enables hostnameOnly routing. -// #### @nested {Object} Nested vows to add to the returned context. -// -// Creates a complete end-to-end test for requesting against an -// http proxy using `options.routes`: -// -// 1. Creates target servers for all routes in `options.routes.` -// 2. Creates a proxy server. -// 3. Ensure requests to the proxy server for all route targets -// returns the unique expected output. -// -exports.assertProxiedToRoutes = function (options, nested) { - // - // Assign dynamic ports to the routes to use. - // - options.routes = helpers.http.assignPortsToRoutes(options.routes); - - // - // Parse locations from routes for making assertion requests. - // - var locations = helpers.http.parseRoutes(options), - port = options.pport || helpers.nextPort, - protocol = helpers.protocols.proxy, - context, - proxy; - - if (options.filename) { - // - // If we've been passed a filename write the routes to it - // and setup the proxy options to use that file. - // - fs.writeFileSync(options.filename, JSON.stringify({ router: options.routes })); - proxy = { router: options.filename }; - } - else { - // - // Otherwise just use the routes themselves. - // - proxy = { - hostnameOnly: options.hostnameOnly, - pathnameOnly: options.pathnameOnly, - router: options.routes - }; - } - - // - // Set the https options if necessary - // - if (helpers.protocols.target === 'https') { - proxy.target = { https: true }; - } - - // - // Create the test context which creates all target - // servers for all routes and a proxy server. - // - context = { - topic: function () { - var that = this; - - async.waterfall([ - // - // 1. Create all the target servers - // - async.apply( - async.forEach, - locations, - function createRouteTarget(location, next) { - helpers.http.createServer({ - port: location.target.port, - output: 'hello from ' + location.source.href - }, next); - } - ), - // - // 2. Create the proxy server - // - async.apply( - helpers.http.createProxyServer, - { - port: port, - latency: options.latency, - routing: true, - proxy: proxy - } - ) - ], function (_, server) { - // - // 3. Set the proxy server for later use - // - that.proxyServer = server; - that.callback(); - }); - - // - // 4. Assign the port to the context for later use - // - this.port = port; - }, - // - // Add an extra assertion to a route which - // should respond with 404 - // - "a request to unknown.com": exports.assertRequest({ - assert: { statusCode: 404 }, - request: { - uri: protocol + '://127.0.0.1:' + port, - headers: { - host: 'unknown.com' - } - } - }) - }; - - // - // Add test assertions for each of the route locations. - // - locations.forEach(function (location) { - context[location.source.href] = exports.assertRequest({ - request: { - uri: protocol + '://127.0.0.1:' + port + location.source.path, - headers: { - host: location.source.hostname - } - }, - assert: { - body: 'hello from ' + location.source.href - } - }); - }); - - // - // If there are any nested vows to add to the context - // add them before returning the full context. - // - if (nested) { - Object.keys(nested).forEach(function (key) { - context[key] = nested[key]; - }); - } - - return context; -}; - -// -// ### function assertDynamicProxy (static, dynamic) -// Asserts that after the `static` routes have been tested -// and the `dynamic` routes are added / removed the appropriate -// proxy responses are received. -// -exports.assertDynamicProxy = function (static, dynamic) { - var proxyPort = helpers.nextPort, - protocol = helpers.protocols.proxy, - context; - - if (dynamic.add) { - dynamic.add = dynamic.add.map(function (dyn) { - dyn.port = helpers.nextPort; - dyn.target = dyn.target + dyn.port; - return dyn; - }); - } - - context = { - topic: function () { - var that = this; - - setTimeout(function () { - if (dynamic.drop) { - dynamic.drop.forEach(function (dropHost) { - that.proxyServer.proxy.removeHost(dropHost); - }); - } - - if (dynamic.add) { - async.forEachSeries(dynamic.add, function addOne (dyn, next) { - that.proxyServer.proxy.addHost(dyn.host, dyn.target); - helpers.http.createServer({ - port: dyn.port, - output: 'hello ' + dyn.host - }, next); - }, that.callback); - } - else { - that.callback(); - } - }, 200); - } - }; - - if (dynamic.drop) { - dynamic.drop.forEach(function (dropHost) { - context[dropHost] = exports.assertRequest({ - assert: { statusCode: 404 }, - request: { - uri: protocol + '://127.0.0.1:' + proxyPort, - headers: { - host: dropHost - } - } - }); - }); - } - - if (dynamic.add) { - dynamic.add.forEach(function (dyn) { - context[dyn.host] = exports.assertRequest({ - assert: { body: 'hello ' + dyn.host }, - request: { - uri: protocol + '://127.0.0.1:' + proxyPort, - headers: { - host: dyn.host - } - } - }); - }); - } - - static.pport = proxyPort; - return exports.assertProxiedToRoutes(static, { - "once the server has started": context - }); -}; diff --git a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/macros/index.js b/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/macros/index.js deleted file mode 100644 index c01f962b..00000000 --- a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/macros/index.js +++ /dev/null @@ -1,11 +0,0 @@ -/* - * index.js: Top level include for node-http-proxy macros - * - * (C) 2010 Nodejitsu Inc. - * MIT LICENCE - * - */ - -exports.examples = require('./examples'); -exports.http = require('./http'); -exports.ws = require('./ws');
\ No newline at end of file diff --git a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/macros/ws.js b/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/macros/ws.js deleted file mode 100644 index 508725a4..00000000 --- a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/macros/ws.js +++ /dev/null @@ -1,232 +0,0 @@ -/* - * ws.js: Macros for proxying Websocket requests - * - * (C) 2010 Nodejitsu Inc. - * MIT LICENCE - * - */ - -var assert = require('assert'), - fs = require('fs'), - async = require('async'), - io = require('socket.io-client'), - WebSocket = require('ws'), - helpers = require('../helpers/index'); - -// -// ### function assertSendRecieve (options) -// #### @options {Object} Options for creating this assertion. -// #### @raw {boolean} Enables raw `ws.WebSocket`. -// #### @uri {string} URI of the proxy server. -// #### @input {string} Input to assert sent to the target ws server. -// #### @output {string} Output to assert from the taget ws server. -// -// Creates a `socket.io` or raw `WebSocket` connection and asserts that -// `options.input` is sent to and `options.output` is received from the -// connection. -// -exports.assertSendReceive = function (options) { - if (!options.raw) { - return { - topic: function () { - var socket = io.connect(options.uri); - socket.on('outgoing', this.callback.bind(this, null)); - socket.emit('incoming', options.input); - }, - "should send input and receive output": function (_, data) { - assert.equal(data, options.output); - } - }; - } - - return { - topic: function () { - var socket = new WebSocket(options.uri); - socket.on('message', this.callback.bind(this, null)); - socket.on('open', function () { - socket.send(options.input); - }); - }, - "should send input and recieve output": function (_, data, flags) { - assert.equal(data, options.output); - } - }; -}; - -// -// ### function assertProxied (options) -// #### @options {Object} Options for this test -// #### @latency {number} Latency in milliseconds for the proxy server. -// #### @ports {Object} Ports for the request (target, proxy). -// #### @input {string} Input to assert sent to the target ws server. -// #### @output {string} Output to assert from the taget ws server. -// #### @raw {boolean} Enables raw `ws.Server` usage. -// -// Creates a complete end-to-end test for requesting against an -// http proxy. -// -exports.assertProxied = function (options) { - options = options || {}; - - var ports = options.ports || helpers.nextPortPair, - input = options.input || 'hello world to ' + ports.target, - output = options.output || 'hello world from ' + ports.target, - protocol = helpers.protocols.proxy; - - if (options.raw) { - protocol = helpers.protocols.proxy === 'https' - ? 'wss' - : 'ws'; - } - - return { - topic: function () { - helpers.ws.createServerPair({ - target: { - input: input, - output: output, - port: ports.target, - raw: options.raw - }, - proxy: { - latency: options.latency, - port: ports.proxy, - proxy: { - target: { - https: helpers.protocols.target === 'https', - host: '127.0.0.1', - port: ports.target - } - } - } - }, this.callback); - }, - "the proxy Websocket connection": exports.assertSendReceive({ - uri: protocol + '://127.0.0.1:' + ports.proxy, - input: input, - output: output, - raw: options.raw - }) - }; -}; - -// -// ### function assertProxiedtoRoutes (options, nested) -// #### @options {Object} Options for this ProxyTable-based test -// #### @raw {boolean} Enables ws.Server usage. -// #### @routes {Object|string} Routes to use for the proxy. -// #### @hostnameOnly {boolean} Enables hostnameOnly routing. -// #### @nested {Object} Nested vows to add to the returned context. -// -// Creates a complete end-to-end test for requesting against an -// http proxy using `options.routes`: -// -// 1. Creates target servers for all routes in `options.routes.` -// 2. Creates a proxy server. -// 3. Ensure Websocket connections to the proxy server for all route targets -// can send input and recieve output. -// -exports.assertProxiedToRoutes = function (options, nested) { - // - // Assign dynamic ports to the routes to use. - // - options.routes = helpers.http.assignPortsToRoutes(options.routes); - - // - // Parse locations from routes for making assertion requests. - // - var locations = helpers.http.parseRoutes(options), - protocol = helpers.protocols.proxy, - port = helpers.nextPort, - context, - proxy; - - if (options.raw) { - protocol = helpers.protocols.proxy === 'https' - ? 'wss' - : 'ws'; - } - - if (options.filename) { - // - // If we've been passed a filename write the routes to it - // and setup the proxy options to use that file. - // - fs.writeFileSync(options.filename, JSON.stringify({ router: options.routes })); - proxy = { router: options.filename }; - } - else { - // - // Otherwise just use the routes themselves. - // - proxy = { - hostnameOnly: options.hostnameOnly, - router: options.routes - }; - } - - // - // Create the test context which creates all target - // servers for all routes and a proxy server. - // - context = { - topic: function () { - var that = this; - - async.waterfall([ - // - // 1. Create all the target servers - // - async.apply( - async.forEach, - locations, - function createRouteTarget(location, next) { - helpers.ws.createServer({ - raw: options.raw, - port: location.target.port, - output: 'hello from ' + location.source.href, - input: 'hello to ' + location.source.href - }, next); - } - ), - // - // 2. Create the proxy server - // - async.apply( - helpers.http.createProxyServer, - { - port: port, - latency: options.latency, - routing: true, - proxy: proxy - } - ) - ], function (_, server) { - // - // 3. Set the proxy server for later use - // - that.proxyServer = server; - that.callback(); - }); - - // - // 4. Assign the port to the context for later use - // - this.port = port; - } - }; - - // - // Add test assertions for each of the route locations. - // - locations.forEach(function (location) { - context[location.source.href] = exports.assertSendRecieve({ - uri: protocol + '://127.0.0.1:' + port + location.source.path, - output: 'hello from ' + location.source.href, - input: 'hello to ' + location.source.href, - raw: options.raw - }); - }); - - return context; -};
\ No newline at end of file diff --git a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/ws/routing-table-test.js b/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/ws/routing-table-test.js deleted file mode 100644 index e04d6475..00000000 --- a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/ws/routing-table-test.js +++ /dev/null @@ -1,25 +0,0 @@ -/* - * routing-tabletest.js: Test for proxying `socket.io` and raw `WebSocket` requests using a ProxyTable. - * - * (C) 2010 Nodejitsu Inc. - * MIT LICENCE - * - */ - -var vows = require('vows'), - macros = require('../macros'), - helpers = require('../helpers/index'); - -vows.describe(helpers.describe('routing-proxy', 'ws')).addBatch({ - "With a valid target server": { - "and no latency": { - "using ws": macros.ws.assertProxied(), - "using socket.io": macros.ws.assertProxied({ - raw: true - }), - }, - // "and latency": macros.websocket.assertProxied({ - // latency: 2000 - // }) - } -}).export(module);
\ No newline at end of file diff --git a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/ws/socket.io-test.js b/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/ws/socket.io-test.js deleted file mode 100644 index d833109e..00000000 --- a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/ws/socket.io-test.js +++ /dev/null @@ -1,20 +0,0 @@ -/* - * socket.io-test.js: Test for proxying `socket.io` requests. - * - * (C) 2010 Nodejitsu Inc. - * MIT LICENCE - * - */ - -var vows = require('vows'), - macros = require('../macros'), - helpers = require('../helpers/index'); - -vows.describe(helpers.describe('socket.io', 'ws')).addBatch({ - "With a valid target server": { - "and no latency": macros.ws.assertProxied(), - // "and latency": macros.ws.assertProxied({ - // latency: 2000 - // }) - } -}).export(module);
\ No newline at end of file diff --git a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/ws/ws-test.js b/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/ws/ws-test.js deleted file mode 100644 index f3549152..00000000 --- a/vnfmarket/src/main/webapp/vnfmarket/node_modules/http-proxy/test/ws/ws-test.js +++ /dev/null @@ -1,23 +0,0 @@ -/* - * ws-test.js: Tests for proxying raw Websocket requests. - * - * (C) 2010 Nodejitsu Inc. - * MIT LICENCE - * - */ - -var vows = require('vows'), - macros = require('../macros'), - helpers = require('../helpers/index'); - -vows.describe(helpers.describe('websocket', 'ws')).addBatch({ - "With a valid target server": { - "and no latency": macros.ws.assertProxied({ - raw: true - }), - // "and latency": macros.ws.assertProxied({ - // raw: true, - // latency: 2000 - // }) - } -}).export(module);
\ No newline at end of file |