diff options
-rw-r--r-- | AUTHORS | 2 | ||||
-rw-r--r-- | ChangeLog | 15 | ||||
-rw-r--r-- | doc/blog/release/v0.8.18.md | 67 | ||||
-rw-r--r-- | doc/blog/release/v0.9.6.md | 87 | ||||
-rw-r--r-- | doc/blog/release/v0.9.7.md | 81 | ||||
-rw-r--r-- | lib/buffer.js | 2 | ||||
-rw-r--r-- | lib/dns.js | 3 | ||||
-rw-r--r-- | lib/http.js | 19 | ||||
-rw-r--r-- | src/node_buffer.cc | 13 | ||||
-rw-r--r-- | test/internet/test-dns.js | 1 | ||||
-rw-r--r-- | test/simple/test-buffer.js | 45 | ||||
-rw-r--r-- | test/simple/test-cluster-bind-twice.js | 77 | ||||
-rw-r--r-- | test/simple/test-http-server-stale-close.js | 51 | ||||
-rwxr-xr-x | tools/install.py | 7 |
14 files changed, 466 insertions, 4 deletions
@@ -385,6 +385,8 @@ Kai Sasaki Lewuathe <sasaki_kai@lewuathe.sakura.ne.jp> Nicolas Chambrier <naholyr@gmail.com> Tim Bradshaw <tfb@cley.com> Johannes Ewald <mail@johannesewald.de> +Chris Dent <chris.dent@gmail.com> +Dan Milon <danmilon@gmail.com> Brandon Philips <brandon.philips@rackspace.com> Frederico Silva <frederico.silva@gmail.com> Jan Wynholds <jan@rootmusic.com> @@ -304,6 +304,21 @@ * Fix #3521 Make process.env more like a regular Object (isaacs) +2013.01.18, Version 0.8.18 (Stable), 2c4eef0d972838c51999d32c0d251857a713dc18 + +* npm: Upgrade to v1.2.2 + +* dns: make error message match errno (Dan Milon) + +* tls: follow RFC6125 more stricly (Fedor Indutny) + +* buffer: reject negative SlowBuffer offsets (Ben Noordhuis) + +* install: add simplejson fallback (Chris Dent) + +* http: fix "Cannot call method 'emit' of null" (Ben Noordhuis) + + 2013.01.09, Version 0.8.17 (Stable), c50c33e9397d7a0a8717e8ce7530572907c054ad * npm: Upgrade to v1.2.0 diff --git a/doc/blog/release/v0.8.18.md b/doc/blog/release/v0.8.18.md new file mode 100644 index 0000000000..853fe96ea9 --- /dev/null +++ b/doc/blog/release/v0.8.18.md @@ -0,0 +1,67 @@ +category: release +date: Fri Jan 18 12:49:35 PST 2013 +version: 0.8.18 +title: Node v0.8.18 (Stable) +slug: node-v0-8-18-stable + +2013.01.18, Version 0.8.18 (Stable) + +* npm: Upgrade to v1.2.2 + +* dns: make error message match errno (Dan Milon) + +* tls: follow RFC6125 more stricly (Fedor Indutny) + +* buffer: reject negative SlowBuffer offsets (Ben Noordhuis) + +* install: add simplejson fallback (Chris Dent) + +* http: fix "Cannot call method 'emit' of null" (Ben Noordhuis) + + +Source Code: http://nodejs.org/dist/v0.8.18/node-v0.8.18.tar.gz + +Macintosh Installer (Universal): http://nodejs.org/dist/v0.8.18/node-v0.8.18.pkg + +Windows Installer: http://nodejs.org/dist/v0.8.18/node-v0.8.18-x86.msi + +Windows x64 Installer: http://nodejs.org/dist/v0.8.18/x64/node-v0.8.18-x64.msi + +Windows x64 Files: http://nodejs.org/dist/v0.8.18/x64/ + +Linux 32-bit Binary: http://nodejs.org/dist/v0.8.18/node-v0.8.18-linux-x86.tar.gz + +Linux 64-bit Binary: http://nodejs.org/dist/v0.8.18/node-v0.8.18-linux-x64.tar.gz + +Solaris 32-bit Binary: http://nodejs.org/dist/v0.8.18/node-v0.8.18-sunos-x86.tar.gz + +Solaris 64-bit Binary: http://nodejs.org/dist/v0.8.18/node-v0.8.18-sunos-x64.tar.gz + +Other release files: http://nodejs.org/dist/v0.8.18/ + +Website: http://nodejs.org/docs/v0.8.18/ + +Documentation: http://nodejs.org/docs/v0.8.18/api/ + +Shasums: + +``` +ddf4062ec395abd2aab18bdadbf94e0c36b9133d node-v0.8.18-darwin-x64.tar.gz +a4f6fc9cfddbcbcfc0733abbee24d9834924e648 node-v0.8.18-darwin-x86.tar.gz +7fbadf6d78f97ee96a20e7d0072e672d160e745b node-v0.8.18-linux-x64.tar.gz +0081950ce52058e1d0bb6609f5dd85819e39b90c node-v0.8.18-linux-x86.tar.gz +976bcf6a4f64e12bb570618f4a24ac77e74a592c node-v0.8.18-sunos-x64.tar.gz +68e21c766f49673cda6b44afaa0462625336c488 node-v0.8.18-sunos-x86.tar.gz +1a709f10740c08ec0f88e84fc4c61e908de9fa17 node-v0.8.18-x86.msi +fb07bfaed311607f9e8003171b870928bf64a801 node-v0.8.18.pkg +e3bc9b64f60f76a32b7d9b35bf86b5d1b8166717 node-v0.8.18.tar.gz +72c8a2a99f83e48641d55467a1ad2d8d224f048d node.exe +9c3ac616aac6c663b2c82a9bca998c99878ef92f node.exp +18fb36d6cc766ed506ddf5b0db67394d05368165 node.lib +155a12e9822a1d65101680774c27481d2de81f0e node.pdb +f95437a1e5684e8b246d8b6b0a6d3d2ffcfd1ac6 x64/node-v0.8.18-x64.msi +3d2b9f1f2e2971fbefee32ed9783fe6b8c1f7d48 x64/node.exe +282de6e02f75bae87c3e7dda998b26c25ae8e709 x64/node.exp +d7612894c40655155e72188bf584dbd8c09b0739 x64/node.lib +49abf88f55028304e50bfb368d68157aed1d0291 x64/node.pdb +``` diff --git a/doc/blog/release/v0.9.6.md b/doc/blog/release/v0.9.6.md new file mode 100644 index 0000000000..21f94563fd --- /dev/null +++ b/doc/blog/release/v0.9.6.md @@ -0,0 +1,87 @@ +title: Node v0.9.6 (Unstable) +slug: node-v0-9-6-unstable +version: 0.9.6 +category: release +date: Fri Jan 11 11:23:56 PST 2013 + +2013.01.11, Version 0.9.6 (Unstable) + +* V8: update to 3.15.11.5 + +* node: remove ev-emul.h (Ben Noordhuis) + +* path: make basename and extname ignore trailing slashes (Bert Belder) + +* typed arrays: fix sunos signed/unsigned char issue (Ben Noordhuis) + +* child_process: Fix {stdio:'inherit'} regression (Ben Noordhuis) + +* child_process: Fix pipe() from child stdio streams (Maciej Małecki) + +* child_process: make fork() execPath configurable (Bradley Meck) + +* stream: Add readable.push(chunk) method (isaacs) + +* dtrace: x64 ustack helper (Fedor Indutny) + +* repl: fix floating point number parsing (Nirk Niggler) + +* repl: allow overriding builtins (Ben Noordhuis) + +* net: add localAddress and localPort to Socket (James Hight) + +* fs: make pool size coincide with ReadStream bufferSize (Shigeki Ohtsu) + +* typed arrays: implement load and store swizzling (Dean McNamee) + +* windows: fix perfctr crash on XP and 2003 (Scott Blomquist) + +* dgram: fix double implicit bind error (Ben Noordhuis) + + +Source Code: http://nodejs.org/dist/v0.9.6/node-v0.9.6.tar.gz + +Macintosh Installer (Universal): http://nodejs.org/dist/v0.9.6/node-v0.9.6.pkg + +Windows Installer: http://nodejs.org/dist/v0.9.6/node-v0.9.6-x86.msi + +Windows x64 Installer: http://nodejs.org/dist/v0.9.6/x64/node-v0.9.6-x64.msi + +Windows x64 Files: http://nodejs.org/dist/v0.9.6/x64/ + +Linux 32-bit Binary: http://nodejs.org/dist/v0.9.6/node-v0.9.6-linux-x86.tar.gz + +Linux 64-bit Binary: http://nodejs.org/dist/v0.9.6/node-v0.9.6-linux-x64.tar.gz + +Solaris 32-bit Binary: http://nodejs.org/dist/v0.9.6/node-v0.9.6-sunos-x86.tar.gz + +Solaris 64-bit Binary: http://nodejs.org/dist/v0.9.6/node-v0.9.6-sunos-x64.tar.gz + +Other release files: http://nodejs.org/dist/v0.9.6/ + +Website: http://nodejs.org/docs/v0.9.6/ + +Documentation: http://nodejs.org/docs/v0.9.6/api/ + +Shasums: + +``` +31ef1e0d875232c85ecde0bc84ddf19cf6cd63f7 node-v0.9.6-darwin-x64.tar.gz +62d5f6f2b39e87eb1f86da0423b6ec45180cd986 node-v0.9.6-darwin-x86.tar.gz +e3cb0989c8262349659424ea2f534c8afe12f93c node-v0.9.6-linux-x64.tar.gz +ff4b68f274a52038fbd04a4ef143e1076ae71db9 node-v0.9.6-linux-x86.tar.gz +59ebb5e5c02c9e40a7a3cc2d8f554f2d722048eb node-v0.9.6-sunos-x64.tar.gz +714b88c5f34bb0adad2d73b6d76fa423d14c29b8 node-v0.9.6-sunos-x86.tar.gz +3ecc617efcae5274c3a1e3452e8fb0646a3e6afc node-v0.9.6-x86.msi +d865d044cc1e9379998aa6c3d34dbe2824e41b5e node-v0.9.6.pkg +650d7c50e29ce7ab428de0617ad315063a53ea1a node-v0.9.6.tar.gz +94b10c6945ec78af6d9b90fc083f97adfa44473f node.exe +0b0eceee083ca9cfdc8c24fbdfe92f7ee25938c2 node.exp +9af3ceee0be869e866b2f516dc2b17690e442739 node.lib +7dfbdf0ac378e67cfa5aff550f057c31f8f92d38 node.pdb +02f27f503a16850a66f7e6fe8732bfa5fcbe311f x64/node-v0.9.6-x64.msi +3f5990602e7268413602dd54a4d019b3330630ae x64/node.exe +836a7be49bd7ed5f1794775d0c20e75f327b067d x64/node.exp +e5e3abed1da31d94525f8731e2d67f0e19b20304 x64/node.lib +b61c1a7a5786a38864943bb3d4c78859d0430d7a x64/node.pdb +``` diff --git a/doc/blog/release/v0.9.7.md b/doc/blog/release/v0.9.7.md new file mode 100644 index 0000000000..7174f59c5b --- /dev/null +++ b/doc/blog/release/v0.9.7.md @@ -0,0 +1,81 @@ +category: release +version: 0.9.7 +date: Fri Jan 18 11:38:32 PST 2013 +title: Node v0.9.7 (Unstable) +slug: node-v0-9-7-unstable + +2013.01.18, Version 0.9.7 (Unstable) + +* V8: Upgrade to 3.15.11.7 + +* npm: Upgrade to 1.2.2 + +* punycode: Upgrade to 1.2.0 (Mathias Bynens) + +* repl: make built-in modules available by default (Felix Böhm) + +* windows: add support for '_Total' perf counters (Scott Blomquist) + +* cluster: make --prof work for workers (Ben Noordhuis) + +* child_process: do not keep list of sent sockets (Fedor Indutny) + +* tls: Follow RFC6125 more strictly (Fedor Indutny) + +* buffer: floating point read/write improvements (Trevor Norris) + +* TypedArrays: Improve dataview perf without endian param (Dean McNamee) + +* module: assert require() called with a non-empty string (Felix Böhm, James Campos) + +* stdio: Set readable/writable flags properly (isaacs) + +* stream: Properly handle large reads from push-streams (isaacs) + + +Source Code: http://nodejs.org/dist/v0.9.7/node-v0.9.7.tar.gz + +Macintosh Installer (Universal): http://nodejs.org/dist/v0.9.7/node-v0.9.7.pkg + +Windows Installer: http://nodejs.org/dist/v0.9.7/node-v0.9.7-x86.msi + +Windows x64 Installer: http://nodejs.org/dist/v0.9.7/x64/node-v0.9.7-x64.msi + +Windows x64 Files: http://nodejs.org/dist/v0.9.7/x64/ + +Linux 32-bit Binary: http://nodejs.org/dist/v0.9.7/node-v0.9.7-linux-x86.tar.gz + +Linux 64-bit Binary: http://nodejs.org/dist/v0.9.7/node-v0.9.7-linux-x64.tar.gz + +Solaris 32-bit Binary: http://nodejs.org/dist/v0.9.7/node-v0.9.7-sunos-x86.tar.gz + +Solaris 64-bit Binary: http://nodejs.org/dist/v0.9.7/node-v0.9.7-sunos-x64.tar.gz + +Other release files: http://nodejs.org/dist/v0.9.7/ + +Website: http://nodejs.org/docs/v0.9.7/ + +Documentation: http://nodejs.org/docs/v0.9.7/api/ + +Shasums: + +``` +fa5771999205beae787e56bbffa3be3c496dbb3e node-v0.9.7-darwin-x64.tar.gz +3790a0323e82598d9286470a3ca8b079b25d815c node-v0.9.7-darwin-x86.tar.gz +70da0da05a2d76dfba389b413112aa1c31289114 node-v0.9.7-linux-x64.tar.gz +b7448f020820302a6c648744a9ba4b6e1979fbf8 node-v0.9.7-linux-x86.tar.gz +a0148c804c37ecbcfd4039213e469ba2757b6125 node-v0.9.7-sunos-x64.tar.gz +121cd6fe2fbab0ca20644256914433bfa02ca6c4 node-v0.9.7-sunos-x86.tar.gz +8938d57fc9cff896bb13901a43b5cff989785a23 node-v0.9.7-x86.msi +23b86861de7c6111311f869c722431cf84d93761 node-v0.9.7.pkg +527a86ee094f7ed77967eda3dff4b2aff3f29384 node-v0.9.7.tar.gz +5231f327979f900d4ba927f2e63e67635001268c node.exe +6a78465d3f6e34aab82a529839c522abbab715ac node.exp +d814bd0733ba22a3cd9c086d34c68706d6c77663 node.lib +5c9df4dcf16c9baafce9b6982907ada586e878a2 node.pdb +f49f1e0706ef38facba45af75cfdf44678b21f5a x64/node-v0.9.7-x64.msi +13f9ee5c81b89bf77c5bfe46993905de4e3384d7 x64/node.exe +3f9c67381a7f2b3fc2f6c14b66036dde02de2820 x64/node.exp +cac98eebe21aeb05741a2fec6e2c7eaf5bb111a6 x64/node.lib +563932b95c08ebdb923358cd8b68ee17ac7ad781 x64/node.pdb +``` diff --git a/lib/buffer.js b/lib/buffer.js index d37942df48..d605829d73 100644 --- a/lib/buffer.js +++ b/lib/buffer.js @@ -585,7 +585,7 @@ Buffer.prototype.slice = function(start, end) { if (end === undefined) end = this.length; if (end > this.length) throw new Error('oob'); if (start > end) throw new Error('oob'); - + if (start < 0) throw new Error('start out of bounds'); return new Buffer(this.parent, end - start, +start + this.offset); }; diff --git a/lib/dns.js b/lib/dns.js index bd7789c6fa..fb7a8138c1 100644 --- a/lib/dns.js +++ b/lib/dns.js @@ -28,13 +28,14 @@ function errnoException(errorno, syscall) { // TODO make this more compatible with ErrnoException from src/node.cc // Once all of Node is using this function the ErrnoException from // src/node.cc should be removed. - var e = new Error(syscall + ' ' + errorno); // For backwards compatibility. libuv returns ENOENT on NXDOMAIN. if (errorno == 'ENOENT') { errorno = 'ENOTFOUND'; } + var e = new Error(syscall + ' ' + errorno); + e.errno = e.code = errorno; e.syscall = syscall; return e; diff --git a/lib/http.js b/lib/http.js index 417b3c9d20..c8bec11212 100644 --- a/lib/http.js +++ b/lib/http.js @@ -970,7 +970,24 @@ exports.ServerResponse = ServerResponse; ServerResponse.prototype.statusCode = 200; function onServerResponseClose() { - this._httpMessage.emit('close'); + // EventEmitter.emit makes a copy of the 'close' listeners array before + // calling the listeners. detachSocket() unregisters onServerResponseClose + // but if detachSocket() is called, directly or indirectly, by a 'close' + // listener, onServerResponseClose is still in that copy of the listeners + // array. That is, in the example below, b still gets called even though + // it's been removed by a: + // + // var obj = new events.EventEmitter; + // obj.on('event', a); + // obj.on('event', b); + // function a() { obj.removeListener('event', b) } + // function b() { throw "BAM!" } + // obj.emit('event'); // throws + // + // Ergo, we need to deal with stale 'close' events and handle the case + // where the ServerResponse object has already been deconstructed. + // Fortunately, that requires only a single if check. :-) + if (this._httpMessage) this._httpMessage.emit('close'); } ServerResponse.prototype.assignSocket = function(socket) { diff --git a/src/node_buffer.cc b/src/node_buffer.cc index ed2656955a..58f83d8d59 100644 --- a/src/node_buffer.cc +++ b/src/node_buffer.cc @@ -857,6 +857,19 @@ Handle<Value> Buffer::MakeFastBuffer(const Arguments &args) { uint32_t offset = args[2]->Uint32Value(); uint32_t length = args[3]->Uint32Value(); + if (offset > buffer->length_) { + return ThrowRangeError("offset out of range"); + } + + if (offset + length > buffer->length_) { + return ThrowRangeError("length out of range"); + } + + // Check for wraparound. Safe because offset and length are unsigned. + if (offset + length < offset) { + return ThrowRangeError("offset or length out of range"); + } + fast_buffer->SetIndexedPropertiesToExternalArrayData(buffer->data_ + offset, kExternalUnsignedByteArray, length); diff --git a/test/internet/test-dns.js b/test/internet/test-dns.js index a079ec8d44..b781565c30 100644 --- a/test/internet/test-dns.js +++ b/test/internet/test-dns.js @@ -308,6 +308,7 @@ TEST(function test_lookup_failure(done) { assert.ok(err instanceof Error); assert.strictEqual(err.errno, dns.NOTFOUND); assert.strictEqual(err.errno, 'ENOTFOUND'); + assert.ok(!/ENOENT/.test(err.message)); done(); }); diff --git a/test/simple/test-buffer.js b/test/simple/test-buffer.js index 534839918f..e221a53e0b 100644 --- a/test/simple/test-buffer.js +++ b/test/simple/test-buffer.js @@ -856,3 +856,48 @@ assert.throws(function() { var buf = new SlowBuffer(8); buf.writeFloatLE(0.0, -1); }, /offset is not uint/); + + +// SlowBuffer sanity checks. +assert.throws(function() { + var len = 0xfffff; + var sbuf = new SlowBuffer(len); + var buf = new Buffer(sbuf, len, 0); + SlowBuffer.makeFastBuffer(sbuf, buf, -len, len); // Should throw. + for (var i = 0; i < len; ++i) buf[i] = 0x42; // Try to force segfault. +}, RangeError); + +assert.throws(function() { + var len = 0xfffff; + var sbuf = new SlowBuffer(len); + var buf = new Buffer(sbuf, len, -len); // Should throw. + for (var i = 0; i < len; ++i) buf[i] = 0x42; // Try to force segfault. +}, RangeError); + +assert.throws(function() { + var len = 0xfffff; + var sbuf = new SlowBuffer(len); + sbuf = sbuf.slice(-len); // Should throw. + for (var i = 0; i < len; ++i) sbuf[i] = 0x42; // Try to force segfault. +}, RangeError); + +assert.throws(function() { + var sbuf = new SlowBuffer(1); + var buf = new Buffer(sbuf, 1, 0); + buf.length = 0xffffffff; + buf.slice(0xffffff0, 0xffffffe); // Should throw. +}, Error); + +assert.throws(function() { + var sbuf = new SlowBuffer(8); + var buf = new Buffer(sbuf, 8, 0); + buf.slice(-8); // Should throw. Throws Error instead of RangeError + // for the sake of v0.8 compatibility. +}, Error); + +assert.throws(function() { + var sbuf = new SlowBuffer(16); + var buf = new Buffer(sbuf, 8, 8); + buf.slice(-8); // Should throw. Throws Error instead of RangeError + // for the sake of v0.8 compatibility. +}, Error); diff --git a/test/simple/test-cluster-bind-twice.js b/test/simple/test-cluster-bind-twice.js new file mode 100644 index 0000000000..068842fa53 --- /dev/null +++ b/test/simple/test-cluster-bind-twice.js @@ -0,0 +1,77 @@ +// 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 test starts two clustered HTTP servers on the same port. It expects the +// first cluster to succeed and the second cluster to fail with EADDRINUSE. + +var common = require('../common'); +var assert = require('assert'); +var cluster = require('cluster'); +var fork = require('child_process').fork; +var http = require('http'); + +var id = process.argv[2]; + +if (!id) { + var a = fork(__filename, ['one']); + var b = fork(__filename, ['two']); + + a.on('message', function(m) { + assert.equal(m, 'READY'); + b.send('START'); + }); + + var ok = false; + + b.on('message', function(m) { + assert.equal(m, 'EADDRINUSE'); + a.kill(); + b.kill(); + ok = true; + }); + + process.on('exit', function() { + a.kill(); + b.kill(); + assert(ok); + }); +} +else if (id === 'one') { + if (cluster.isMaster) cluster.fork(); + http.createServer(assert.fail).listen(common.PORT, function() { + process.send('READY'); + }); +} +else if (id === 'two') { + if (cluster.isMaster) cluster.fork(); + process.on('message', function(m) { + assert.equal(m, 'START'); + var server = http.createServer(assert.fail); + server.listen(common.PORT, assert.fail); + server.on('error', function(e) { + assert.equal(e.code, 'EADDRINUSE'); + process.send(e.code); + }); + }); +} +else { + assert(0); // bad command line argument +} diff --git a/test/simple/test-http-server-stale-close.js b/test/simple/test-http-server-stale-close.js new file mode 100644 index 0000000000..e8ecf318e4 --- /dev/null +++ b/test/simple/test-http-server-stale-close.js @@ -0,0 +1,51 @@ +// 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 fork = require('child_process').fork; + +if (process.env.NODE_TEST_FORK) { + var req = http.request({ + headers: {'Content-Length': '42'}, + method: 'POST', + host: '127.0.0.1', + port: common.PORT, + }, process.exit); + req.write('BAM'); + req.end(); +} +else { + var server = http.createServer(function(req, res) { + res.writeHead(200, {'Content-Length': '42'}); + req.pipe(res); + req.on('close', function() { + server.close(); + res.end(); + }); + }); + server.listen(common.PORT, function() { + fork(__filename, { + env: {NODE_TEST_FORK: '1'} + }); + }); +} diff --git a/tools/install.py b/tools/install.py index d82d9ea844..c8ad828c1d 100755 --- a/tools/install.py +++ b/tools/install.py @@ -1,7 +1,12 @@ #!/usr/bin/env python import errno -import json + +try: + import json +except ImportError: + import simplejson as json + import os import re import shutil |