From 6359e017ac76e971089bcfcffe8dcb921f7f4db4 Mon Sep 17 00:00:00 2001
From: Wyatt Preul
Date: Tue, 11 Jun 2013 15:56:03 -0500
Subject: [PATCH 01/11] docs: Warning about consuming response
---
doc/api/http.markdown | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/doc/api/http.markdown b/doc/api/http.markdown
index e93aa2d2ddf..a1b1a598dbe 100644
--- a/doc/api/http.markdown
+++ b/doc/api/http.markdown
@@ -315,7 +315,7 @@ Boolean (read-only). True if headers were sent, false otherwise.
### response.sendDate
-When true, the Date header will be automatically generated and sent in
+When true, the Date header will be automatically generated and sent in
the response if it is not already present in the headers. Defaults to true.
This should only be disabled for testing; HTTP requires the Date header
@@ -526,17 +526,17 @@ Alternatively, you could just opt out of pooling entirely using `agent:false`:
### agent.maxSockets
-By default set to 5. Determines how many concurrent sockets the agent can have
+By default set to 5. Determines how many concurrent sockets the agent can have
open per host.
### agent.sockets
-An object which contains arrays of sockets currently in use by the Agent. Do not
+An object which contains arrays of sockets currently in use by the Agent. Do not
modify.
### agent.requests
-An object which contains queues of requests that have not yet been assigned to
+An object which contains queues of requests that have not yet been assigned to
sockets. Do not modify.
## http.globalAgent
@@ -566,7 +566,9 @@ entirely discarded. However, if you add a `'response'` event handler,
then you **must** consume the data from the response object, either by
calling `response.read()` whenever there is a `'readable'` event, or
by adding a `'data'` handler, or by calling the `.resume()` method.
-Until the data is consumed, the `'end'` event will not fire.
+Until the data is consumed, the `'end'` event will not fire. Also, until
+the data is read it will consume memory that can eventually lead to a
+'process out of memory' error.
Note: Node does not check whether Content-Length and the length of the body
which has been transmitted are equal or not.
From 3398cce1934004e4d60c7d7605fa7548582c362f Mon Sep 17 00:00:00 2001
From: Ben Noordhuis
Date: Wed, 31 Jul 2013 05:50:26 +0200
Subject: [PATCH 02/11] http: improve chunked res.write(buf) performance
Avoid a costly buffer-to-string operation. Instead, allocate a new
buffer, copy the chunk header and data into it and send that.
The speed difference is negligible on small payloads but it really
shines with larger (10+ kB) chunks. benchmark/http/end-vs-write-end
with 64 kB chunks gives 45-50% higher throughput. With 1 MB chunks,
the difference is a staggering 590%.
Of course, YMMV will vary with real workloads and networks but this
commit should have a positive impact on CPU and memory consumption.
Big kudos to Wyatt Preul (@wpreul) for reporting the issue and providing
the initial patch.
Fixes #5941 and #5944.
---
lib/http.js | 157 +++++++++++++++++++++++++++++++---------------------
1 file changed, 93 insertions(+), 64 deletions(-)
diff --git a/lib/http.js b/lib/http.js
index 7527fde1ad4..339a889beb5 100644
--- a/lib/http.js
+++ b/lib/http.js
@@ -447,6 +447,8 @@ function OutgoingMessage() {
this.useChunkedEncodingByDefault = true;
this.sendDate = false;
+ this._headerSent = false;
+ this._header = '';
this._hasBody = true;
this._trailer = '';
@@ -768,6 +770,92 @@ Object.defineProperty(OutgoingMessage.prototype, 'headersSent', {
});
+// Convert a number in the range 0-15 to a lowercase hexadecimal digit.
+function hex(val) {
+ // The comparison and bit hacks are deliberate. We could look up the
+ // value in a buffer with hexdigits[val & 15] but that adds a couple
+ // of bounds checks to each conversion.
+ return val <= 9 ? (val | 48) : ((val - 9) | 96);
+}
+
+
+function chunkify(chunk, headers, trailers, last) {
+ var chunklen = chunk.length;
+ var buflen = chunklen + 4; // '\r\n' + chunk + '\r\n'
+ var offset = 0;
+ var octets = 1;
+
+ // Skip expensive Buffer.byteLength() calls; only ISO-8859-1 characters
+ // are allowed in HTTP headers, therefore:
+ //
+ // headers.length == Buffer.byteLength(headers.length)
+ // trailers.length == Buffer.byteLength(trailers.length)
+ //
+ // Note: the actual encoding that is used is ASCII. That's de jure
+ // a violation of the spec but de facto correct because many HTTP
+ // clients get confused by non-ASCII headers.
+ if (last === true) buflen += 5; // '0\r\n\r\n'
+ if (headers !== '') buflen += headers.length;
+ if (trailers !== '') buflen += trailers.length;
+
+ if (chunklen & 0xf0000000) octets += 7;
+ else if (chunklen & 0xf000000) octets += 6;
+ else if (chunklen & 0xf00000) octets += 5;
+ else if (chunklen & 0xf0000) octets += 4;
+ else if (chunklen & 0xf000) octets += 3;
+ else if (chunklen & 0xf00) octets += 2;
+ else if (chunklen & 0xf0) octets += 1;
+ buflen += octets;
+
+ var buf = new Buffer(buflen);
+
+ if (headers !== '') {
+ buf.write(headers, 0, headers.length, 'ascii');
+ offset = headers.length;
+ }
+
+ // Write chunk length in hex to buffer. This effectively limits us
+ // to 4 GB chunks but that's okay because buffers are max 1 GB anyway.
+ switch (octets) {
+ case 8: buf[offset++] = hex((chunklen >>> 28) & 15);
+ case 7: buf[offset++] = hex((chunklen >>> 24) & 15);
+ case 6: buf[offset++] = hex((chunklen >>> 20) & 15);
+ case 5: buf[offset++] = hex((chunklen >>> 16) & 15);
+ case 4: buf[offset++] = hex((chunklen >>> 12) & 15);
+ case 3: buf[offset++] = hex((chunklen >>> 8) & 15);
+ case 2: buf[offset++] = hex((chunklen >>> 4) & 15);
+ }
+ buf[offset++] = hex(chunklen & 15);
+
+ // Add '\r\n'.
+ buf[offset++] = 13;
+ buf[offset++] = 10;
+
+ // Copy buffer.
+ chunk.copy(buf, offset);
+ offset += chunklen;
+
+ // Add trailing '\r\n'.
+ buf[offset++] = 13;
+ buf[offset++] = 10;
+
+ if (last === true) {
+ // Add trailing '0\r\n\r\n'.
+ buf[offset++] = 48;
+ buf[offset++] = 13;
+ buf[offset++] = 10;
+ buf[offset++] = 13;
+ buf[offset++] = 10;
+ }
+
+ if (trailers !== '') {
+ buf.write(trailers, offset, trailers.length, 'ascii');
+ }
+
+ return buf;
+}
+
+
OutgoingMessage.prototype.write = function(chunk, encoding) {
if (!this._header) {
this._implicitHeader();
@@ -787,23 +875,6 @@ OutgoingMessage.prototype.write = function(chunk, encoding) {
// signal the user to keep writing.
if (chunk.length === 0) return true;
- // TODO(bnoordhuis) Temporary optimization hack, remove in v0.11. We only
- // want to convert the buffer when we're sending:
- //
- // a) Transfer-Encoding chunks, because it lets us pack the chunk header
- // and the chunk into a single write(), or
- //
- // b) the first chunk of a fixed-length request, because it lets us pack
- // the request headers and the chunk into a single write().
- //
- // Converting to strings is expensive, CPU-wise, but reducing the number
- // of write() calls more than makes up for that because we're dramatically
- // reducing the number of TCP roundtrips.
- if (chunk instanceof Buffer && (this.chunkedEncoding || !this._headerSent)) {
- chunk = chunk.toString('binary');
- encoding = 'binary';
- }
-
var len, ret;
if (this.chunkedEncoding) {
if (typeof(chunk) === 'string' &&
@@ -812,8 +883,11 @@ OutgoingMessage.prototype.write = function(chunk, encoding) {
len = Buffer.byteLength(chunk, encoding);
chunk = len.toString(16) + CRLF + chunk + CRLF;
ret = this._send(chunk, encoding);
+ } else if (Buffer.isBuffer(chunk)) {
+ var buf = chunkify(chunk, '', '', false);
+ ret = this._send(buf, encoding);
} else {
- // buffer, or a non-toString-friendly encoding
+ // Non-toString-friendly encoding.
len = chunk.length;
this._send(len.toString(16) + CRLF);
this._send(chunk, encoding);
@@ -900,52 +974,7 @@ OutgoingMessage.prototype.end = function(data, encoding) {
}
} else if (Buffer.isBuffer(data)) {
if (this.chunkedEncoding) {
- var chunk_size = data.length.toString(16);
-
- // Skip expensive Buffer.byteLength() calls; only ISO-8859-1 characters
- // are allowed in HTTP headers. Therefore:
- //
- // this._header.length == Buffer.byteLength(this._header.length)
- // this._trailer.length == Buffer.byteLength(this._trailer.length)
- //
- var header_len = this._header.length;
- var chunk_size_len = chunk_size.length;
- var data_len = data.length;
- var trailer_len = this._trailer.length;
-
- var len = header_len +
- chunk_size_len +
- 2 + // '\r\n'.length
- data_len +
- 5 + // '\r\n0\r\n'.length
- trailer_len +
- 2; // '\r\n'.length
-
- var buf = new Buffer(len);
- var off = 0;
-
- buf.write(this._header, off, header_len, 'ascii');
- off += header_len;
-
- buf.write(chunk_size, off, chunk_size_len, 'ascii');
- off += chunk_size_len;
-
- crlf_buf.copy(buf, off);
- off += 2;
-
- data.copy(buf, off);
- off += data_len;
-
- zero_chunk_buf.copy(buf, off);
- off += 5;
-
- if (trailer_len > 0) {
- buf.write(this._trailer, off, trailer_len, 'ascii');
- off += trailer_len;
- }
-
- crlf_buf.copy(buf, off);
-
+ var buf = chunkify(data, this._header, this._trailer, true);
ret = this.connection.write(buf);
} else {
var header_len = this._header.length;
From fc6f8a69438d45640d4d0a76633b57965c1f843a Mon Sep 17 00:00:00 2001
From: Ben Noordhuis
Date: Thu, 1 Aug 2013 14:35:13 +0200
Subject: [PATCH 03/11] events: fix memory leak, don't leak event names
Before this commit, events were set to undefined rather than deleted
from the EventEmitter's backing dictionary for performance reasons:
`delete obj.key` causes a transition of the dictionary's hidden class
and that can be costly.
Unfortunately, that introduces a memory leak when many events are added
and then removed again. The strings containing the event names are never
reclaimed by the garbage collector because they remain part of the
dictionary.
That's why this commit makes EventEmitter delete events again. This
effectively reverts commit 0397223.
Fixes #5970.
---
lib/events.js | 8 ++--
test/simple/test-event-emitter-memory-leak.js | 42 +++++++++++++++++++
2 files changed, 46 insertions(+), 4 deletions(-)
create mode 100644 test/simple/test-event-emitter-memory-leak.js
diff --git a/lib/events.js b/lib/events.js
index 38422dab0f3..5188205d129 100644
--- a/lib/events.js
+++ b/lib/events.js
@@ -197,7 +197,7 @@ EventEmitter.prototype.removeListener = function(type, listener) {
if (list === listener ||
(typeof list.listener === 'function' && list.listener === listener)) {
- this._events[type] = undefined;
+ delete this._events[type];
if (this._events.removeListener)
this.emit('removeListener', type, listener);
@@ -215,7 +215,7 @@ EventEmitter.prototype.removeListener = function(type, listener) {
if (list.length === 1) {
list.length = 0;
- this._events[type] = undefined;
+ delete this._events[type];
} else {
list.splice(position, 1);
}
@@ -238,7 +238,7 @@ EventEmitter.prototype.removeAllListeners = function(type) {
if (arguments.length === 0)
this._events = {};
else if (this._events[type])
- this._events[type] = undefined;
+ delete this._events[type];
return this;
}
@@ -262,7 +262,7 @@ EventEmitter.prototype.removeAllListeners = function(type) {
while (listeners.length)
this.removeListener(type, listeners[listeners.length - 1]);
}
- this._events[type] = undefined;
+ delete this._events[type];
return this;
};
diff --git a/test/simple/test-event-emitter-memory-leak.js b/test/simple/test-event-emitter-memory-leak.js
new file mode 100644
index 00000000000..d02fa80512d
--- /dev/null
+++ b/test/simple/test-event-emitter-memory-leak.js
@@ -0,0 +1,42 @@
+// 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.
+
+// Flags: --expose-gc
+
+// Add and remove a lot of different events to an EventEmitter, then check
+// that we didn't leak the event names.
+var common = require('../common');
+var assert = require('assert');
+var events = require('events');
+
+assert.equal(typeof gc, 'function', 'Run this test with --expose-gc');
+var before = process.memoryUsage().heapUsed;
+var e = new events.EventEmitter();
+
+for (var i = 0; i < 2.5e5; ++i) {
+ var name = 'a-pretty-long-event-name-' + i;
+ e.on(name, assert.fail);
+ e.removeListener(name, assert.fail);
+}
+while (gc());
+
+var after = process.memoryUsage().heapUsed;
+assert(after - before < 1024*1024, 'EventEmitter leaks event names.');
From 98db7babccfbf2abe5de4fee6bcaa97aa7ebfe75 Mon Sep 17 00:00:00 2001
From: Ben Noordhuis
Date: Thu, 1 Aug 2013 16:00:40 +0200
Subject: [PATCH 04/11] test: fix pummel/test-net-connect-memleak
* Run the garbage collector before creating the big array. It doesn't
matter now but if in the future something in node.js core creates
a lot of reclaimable garbage, that will break the test's expectation.
* The first RSS check was being done too late. The garbage collector
might have run before the check, throwing off the 'reclaimed memory'
calculation.
* Due to changes in how V8 represents the big array internally, the
actual memory usage is just below 256 MB on x64. Update the test's
expectation.
---
test/pummel/test-net-connect-memleak.js | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/test/pummel/test-net-connect-memleak.js b/test/pummel/test-net-connect-memleak.js
index c3f2daac2c0..3e7503864a4 100644
--- a/test/pummel/test-net-connect-memleak.js
+++ b/test/pummel/test-net-connect-memleak.js
@@ -28,9 +28,12 @@ var net = require('net');
assert(typeof gc === 'function', 'Run this test with --expose-gc');
net.createServer(function() {}).listen(common.PORT);
+var before = 0;
(function() {
// 2**26 == 64M entries
+ gc();
for (var i = 0, junk = [0]; i < 26; ++i) junk = junk.concat(junk);
+ before = process.memoryUsage().rss;
net.createConnection(common.PORT, '127.0.0.1', function() {
assert(junk.length != 0); // keep reference alive
@@ -40,11 +43,10 @@ net.createServer(function() {}).listen(common.PORT);
})();
function done() {
- var before = process.memoryUsage().rss;
gc();
var after = process.memoryUsage().rss;
var reclaimed = (before - after) / 1024;
console.log('%d kB reclaimed', reclaimed);
- assert(reclaimed > 256 * 1024); // it's more like 512M on x64
+ assert(reclaimed > 128 * 1024); // It's around 256 MB on x64.
process.exit();
}
From 9e1eb361e8deb3f296a3c9d01de8fcc10361443f Mon Sep 17 00:00:00 2001
From: Ben Noordhuis
Date: Thu, 1 Aug 2013 16:09:42 +0200
Subject: [PATCH 05/11] test: future-proof
simple/test-event-emitter-memory-leak
Run the garbage collector before running the actual test. It doesn't
matter now but if in the future something in node.js core creates a lot
of reclaimable garbage, that will break the test's expectation.
---
test/simple/test-event-emitter-memory-leak.js | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/test/simple/test-event-emitter-memory-leak.js b/test/simple/test-event-emitter-memory-leak.js
index d02fa80512d..2cb56124cd2 100644
--- a/test/simple/test-event-emitter-memory-leak.js
+++ b/test/simple/test-event-emitter-memory-leak.js
@@ -28,6 +28,8 @@ var assert = require('assert');
var events = require('events');
assert.equal(typeof gc, 'function', 'Run this test with --expose-gc');
+gc();
+
var before = process.memoryUsage().heapUsed;
var e = new events.EventEmitter();
@@ -36,7 +38,7 @@ for (var i = 0; i < 2.5e5; ++i) {
e.on(name, assert.fail);
e.removeListener(name, assert.fail);
}
-while (gc());
+gc();
var after = process.memoryUsage().heapUsed;
assert(after - before < 1024*1024, 'EventEmitter leaks event names.');
From bea9dfa14c5f0e248202cbc97d8f4ce20992f556 Mon Sep 17 00:00:00 2001
From: isaacs
Date: Fri, 2 Aug 2013 14:55:01 -0700
Subject: [PATCH 06/11] npm: Upgrade to 1.3.7
---
deps/npm/AUTHORS | 91 +-
deps/npm/LICENSE | 256 ++-
deps/npm/html/doc/README.html | 2 +-
deps/npm/html/doc/api/npm-bin.html | 2 +-
deps/npm/html/doc/api/npm-bugs.html | 2 +-
deps/npm/html/doc/api/npm-commands.html | 2 +-
deps/npm/html/doc/api/npm-config.html | 2 +-
deps/npm/html/doc/api/npm-deprecate.html | 2 +-
deps/npm/html/doc/api/npm-docs.html | 2 +-
deps/npm/html/doc/api/npm-edit.html | 2 +-
deps/npm/html/doc/api/npm-explore.html | 2 +-
deps/npm/html/doc/api/npm-help-search.html | 2 +-
deps/npm/html/doc/api/npm-init.html | 2 +-
deps/npm/html/doc/api/npm-install.html | 2 +-
deps/npm/html/doc/api/npm-link.html | 2 +-
deps/npm/html/doc/api/npm-load.html | 2 +-
deps/npm/html/doc/api/npm-ls.html | 2 +-
deps/npm/html/doc/api/npm-outdated.html | 2 +-
deps/npm/html/doc/api/npm-owner.html | 2 +-
deps/npm/html/doc/api/npm-pack.html | 2 +-
deps/npm/html/doc/api/npm-prefix.html | 2 +-
deps/npm/html/doc/api/npm-prune.html | 2 +-
deps/npm/html/doc/api/npm-publish.html | 2 +-
deps/npm/html/doc/api/npm-rebuild.html | 2 +-
deps/npm/html/doc/api/npm-restart.html | 2 +-
deps/npm/html/doc/api/npm-root.html | 2 +-
deps/npm/html/doc/api/npm-run-script.html | 2 +-
deps/npm/html/doc/api/npm-search.html | 2 +-
deps/npm/html/doc/api/npm-shrinkwrap.html | 2 +-
deps/npm/html/doc/api/npm-start.html | 2 +-
deps/npm/html/doc/api/npm-stop.html | 2 +-
deps/npm/html/doc/api/npm-submodule.html | 2 +-
deps/npm/html/doc/api/npm-tag.html | 2 +-
deps/npm/html/doc/api/npm-test.html | 2 +-
deps/npm/html/doc/api/npm-uninstall.html | 2 +-
deps/npm/html/doc/api/npm-unpublish.html | 2 +-
deps/npm/html/doc/api/npm-update.html | 2 +-
deps/npm/html/doc/api/npm-version.html | 2 +-
deps/npm/html/doc/api/npm-view.html | 2 +-
deps/npm/html/doc/api/npm-whoami.html | 2 +-
deps/npm/html/doc/api/npm.html | 4 +-
deps/npm/html/doc/cli/npm-adduser.html | 2 +-
deps/npm/html/doc/cli/npm-bin.html | 2 +-
deps/npm/html/doc/cli/npm-bugs.html | 2 +-
deps/npm/html/doc/cli/npm-build.html | 2 +-
deps/npm/html/doc/cli/npm-bundle.html | 2 +-
deps/npm/html/doc/cli/npm-cache.html | 2 +-
deps/npm/html/doc/cli/npm-completion.html | 2 +-
deps/npm/html/doc/cli/npm-config.html | 2 +-
deps/npm/html/doc/cli/npm-dedupe.html | 2 +-
deps/npm/html/doc/cli/npm-deprecate.html | 2 +-
deps/npm/html/doc/cli/npm-docs.html | 2 +-
deps/npm/html/doc/cli/npm-edit.html | 2 +-
deps/npm/html/doc/cli/npm-explore.html | 2 +-
deps/npm/html/doc/cli/npm-help-search.html | 2 +-
deps/npm/html/doc/cli/npm-help.html | 2 +-
deps/npm/html/doc/cli/npm-init.html | 2 +-
deps/npm/html/doc/cli/npm-install.html | 2 +-
deps/npm/html/doc/cli/npm-link.html | 2 +-
deps/npm/html/doc/cli/npm-ls.html | 4 +-
deps/npm/html/doc/cli/npm-outdated.html | 2 +-
deps/npm/html/doc/cli/npm-owner.html | 2 +-
deps/npm/html/doc/cli/npm-pack.html | 2 +-
deps/npm/html/doc/cli/npm-prefix.html | 2 +-
deps/npm/html/doc/cli/npm-prune.html | 2 +-
deps/npm/html/doc/cli/npm-publish.html | 2 +-
deps/npm/html/doc/cli/npm-rebuild.html | 2 +-
deps/npm/html/doc/cli/npm-restart.html | 2 +-
deps/npm/html/doc/cli/npm-rm.html | 2 +-
deps/npm/html/doc/cli/npm-root.html | 2 +-
deps/npm/html/doc/cli/npm-run-script.html | 2 +-
deps/npm/html/doc/cli/npm-search.html | 2 +-
deps/npm/html/doc/cli/npm-shrinkwrap.html | 2 +-
deps/npm/html/doc/cli/npm-star.html | 2 +-
deps/npm/html/doc/cli/npm-stars.html | 2 +-
deps/npm/html/doc/cli/npm-start.html | 2 +-
deps/npm/html/doc/cli/npm-stop.html | 2 +-
deps/npm/html/doc/cli/npm-submodule.html | 2 +-
deps/npm/html/doc/cli/npm-tag.html | 2 +-
deps/npm/html/doc/cli/npm-test.html | 2 +-
deps/npm/html/doc/cli/npm-uninstall.html | 2 +-
deps/npm/html/doc/cli/npm-unpublish.html | 2 +-
deps/npm/html/doc/cli/npm-update.html | 2 +-
deps/npm/html/doc/cli/npm-version.html | 2 +-
deps/npm/html/doc/cli/npm-view.html | 2 +-
deps/npm/html/doc/cli/npm-whoami.html | 2 +-
deps/npm/html/doc/cli/npm.html | 4 +-
deps/npm/html/doc/files/npm-folders.html | 2 +-
deps/npm/html/doc/files/npm-global.html | 2 +-
deps/npm/html/doc/files/npm-json.html | 2 +-
deps/npm/html/doc/files/npmrc.html | 2 +-
deps/npm/html/doc/files/package.json.html | 2 +-
deps/npm/html/doc/index.html | 2 +-
deps/npm/html/doc/misc/npm-coding-style.html | 2 +-
deps/npm/html/doc/misc/npm-config.html | 2 +-
deps/npm/html/doc/misc/npm-developers.html | 2 +-
deps/npm/html/doc/misc/npm-disputes.html | 2 +-
deps/npm/html/doc/misc/npm-faq.html | 2 +-
deps/npm/html/doc/misc/npm-index.html | 2 +-
deps/npm/html/doc/misc/npm-registry.html | 2 +-
deps/npm/html/doc/misc/npm-scripts.html | 2 +-
deps/npm/html/doc/misc/removing-npm.html | 2 +-
deps/npm/html/doc/misc/semver.html | 2 +-
deps/npm/lib/cache.js | 6 +-
deps/npm/lib/utils/error-handler.js | 2 +
deps/npm/man/man1/npm-ls.1 | 2 +-
deps/npm/man/man1/npm.1 | 2 +-
deps/npm/man/man3/npm.3 | 2 +-
.../sha/node_modules/readable-stream/LICENSE | 27 +
.../node_modules/readable-stream/README.md | 768 ++++++++
.../node_modules/readable-stream/duplex.js | 1 +
.../readable-stream/examples/CAPSLOCKTYPER.JS | 32 +
.../readable-stream/examples/typer-fsr.js | 15 +
.../readable-stream/examples/typer.js | 17 +
.../sha/node_modules/readable-stream/fs.js | 1705 +++++++++++++++++
.../readable-stream/lib/_stream_duplex.js | 69 +
.../lib/_stream_passthrough.js | 41 +
.../readable-stream/lib/_stream_readable.js | 876 +++++++++
.../readable-stream/lib/_stream_transform.js | 206 ++
.../readable-stream/lib/_stream_writable.js | 347 ++++
.../node_modules/readable-stream/package.json | 35 +
.../readable-stream/passthrough.js | 1 +
.../node_modules/readable-stream/readable.js | 6 +
.../readable-stream/test/common.js | 191 ++
.../readable-stream/test/fixtures/x1024.txt | 1 +
.../test/simple/test-stream2-basic.js | 475 +++++
.../test/simple/test-stream2-compatibility.js | 50 +
.../test/simple/test-stream2-finish-pipe.js | 41 +
.../simple/test-stream2-large-read-stall.js | 82 +
.../test/simple/test-stream2-objects.js | 348 ++++
.../test-stream2-pipe-error-handling.js | 105 +
.../test/simple/test-stream2-push.js | 138 ++
.../simple/test-stream2-read-sync-stack.js | 54 +
...st-stream2-readable-empty-buffer-no-eof.js | 119 ++
.../simple/test-stream2-readable-from-list.js | 120 ++
.../test-stream2-readable-legacy-drain.js | 75 +
.../test-stream2-readable-non-empty-end.js | 78 +
.../test/simple/test-stream2-set-encoding.js | 312 +++
.../test/simple/test-stream2-transform.js | 435 +++++
.../test/simple/test-stream2-unpipe-drain.js | 76 +
.../test/simple/test-stream2-unpipe-leak.js | 74 +
.../test/simple/test-stream2-writable.js | 328 ++++
.../node_modules/readable-stream/transform.js | 1 +
.../node_modules/readable-stream/writable.js | 1 +
.../sha/node_modules/readable-stream/zlib.js | 452 +++++
deps/npm/node_modules/sha/package.json | 2 +-
deps/npm/package.json | 9 +-
147 files changed, 8086 insertions(+), 196 deletions(-)
create mode 100644 deps/npm/node_modules/sha/node_modules/readable-stream/LICENSE
create mode 100644 deps/npm/node_modules/sha/node_modules/readable-stream/README.md
create mode 100644 deps/npm/node_modules/sha/node_modules/readable-stream/duplex.js
create mode 100644 deps/npm/node_modules/sha/node_modules/readable-stream/examples/CAPSLOCKTYPER.JS
create mode 100644 deps/npm/node_modules/sha/node_modules/readable-stream/examples/typer-fsr.js
create mode 100644 deps/npm/node_modules/sha/node_modules/readable-stream/examples/typer.js
create mode 100644 deps/npm/node_modules/sha/node_modules/readable-stream/fs.js
create mode 100644 deps/npm/node_modules/sha/node_modules/readable-stream/lib/_stream_duplex.js
create mode 100644 deps/npm/node_modules/sha/node_modules/readable-stream/lib/_stream_passthrough.js
create mode 100644 deps/npm/node_modules/sha/node_modules/readable-stream/lib/_stream_readable.js
create mode 100644 deps/npm/node_modules/sha/node_modules/readable-stream/lib/_stream_transform.js
create mode 100644 deps/npm/node_modules/sha/node_modules/readable-stream/lib/_stream_writable.js
create mode 100644 deps/npm/node_modules/sha/node_modules/readable-stream/package.json
create mode 100644 deps/npm/node_modules/sha/node_modules/readable-stream/passthrough.js
create mode 100644 deps/npm/node_modules/sha/node_modules/readable-stream/readable.js
create mode 100644 deps/npm/node_modules/sha/node_modules/readable-stream/test/common.js
create mode 100644 deps/npm/node_modules/sha/node_modules/readable-stream/test/fixtures/x1024.txt
create mode 100644 deps/npm/node_modules/sha/node_modules/readable-stream/test/simple/test-stream2-basic.js
create mode 100644 deps/npm/node_modules/sha/node_modules/readable-stream/test/simple/test-stream2-compatibility.js
create mode 100644 deps/npm/node_modules/sha/node_modules/readable-stream/test/simple/test-stream2-finish-pipe.js
create mode 100644 deps/npm/node_modules/sha/node_modules/readable-stream/test/simple/test-stream2-large-read-stall.js
create mode 100644 deps/npm/node_modules/sha/node_modules/readable-stream/test/simple/test-stream2-objects.js
create mode 100644 deps/npm/node_modules/sha/node_modules/readable-stream/test/simple/test-stream2-pipe-error-handling.js
create mode 100644 deps/npm/node_modules/sha/node_modules/readable-stream/test/simple/test-stream2-push.js
create mode 100644 deps/npm/node_modules/sha/node_modules/readable-stream/test/simple/test-stream2-read-sync-stack.js
create mode 100644 deps/npm/node_modules/sha/node_modules/readable-stream/test/simple/test-stream2-readable-empty-buffer-no-eof.js
create mode 100644 deps/npm/node_modules/sha/node_modules/readable-stream/test/simple/test-stream2-readable-from-list.js
create mode 100644 deps/npm/node_modules/sha/node_modules/readable-stream/test/simple/test-stream2-readable-legacy-drain.js
create mode 100644 deps/npm/node_modules/sha/node_modules/readable-stream/test/simple/test-stream2-readable-non-empty-end.js
create mode 100644 deps/npm/node_modules/sha/node_modules/readable-stream/test/simple/test-stream2-set-encoding.js
create mode 100644 deps/npm/node_modules/sha/node_modules/readable-stream/test/simple/test-stream2-transform.js
create mode 100644 deps/npm/node_modules/sha/node_modules/readable-stream/test/simple/test-stream2-unpipe-drain.js
create mode 100644 deps/npm/node_modules/sha/node_modules/readable-stream/test/simple/test-stream2-unpipe-leak.js
create mode 100644 deps/npm/node_modules/sha/node_modules/readable-stream/test/simple/test-stream2-writable.js
create mode 100644 deps/npm/node_modules/sha/node_modules/readable-stream/transform.js
create mode 100644 deps/npm/node_modules/sha/node_modules/readable-stream/writable.js
create mode 100644 deps/npm/node_modules/sha/node_modules/readable-stream/zlib.js
diff --git a/deps/npm/AUTHORS b/deps/npm/AUTHORS
index 4d964f4bd81..f159ffae2d1 100644
--- a/deps/npm/AUTHORS
+++ b/deps/npm/AUTHORS
@@ -1,48 +1,48 @@
# Authors sorted by whether or not they're me
-Isaac Z. Schlueter (http://blog.izs.me/)
-Steve Steiner (http://websaucesoftware.com/blog/)
-Mikeal Rogers (http://www.mikealrogers.com/)
-Aaron Blohowiak (http://aaronblohowiak.com/)
-Martyn Smith (http://dollyfish.net.nz/)
-Mathias Pettersson (http://mape.me/)
-Brian Hammond (http://fictorial.com/)
-Charlie Robbins (http://www.charlierobbins.com/)
-Francisco Treacy (http://franciscotreacy.com/)
-Cliffano Subagio (http://blog.cliffano.com/)
-Christian Eager (http://perpenduum.com)
-Dav Glass (http://blog.davglass.com)
+Isaac Z. Schlueter
+Steve Steiner
+Mikeal Rogers
+Aaron Blohowiak
+Martyn Smith
+Mathias Pettersson
+Brian Hammond
+Charlie Robbins
+Francisco Treacy
+Cliffano Subagio
+Christian Eager
+Dav Glass
Alex K. Wolfe
-James Sanders (http://james-sanders.com/)
-Reid Burke (http://reidburke.com/)
-Arlo Breault (http://thoughtherder.com/)
-Timo Derstappen (http://teemow.com)
+James Sanders
+Reid Burke
+Arlo Breault
+Timo Derstappen
Bradley Meck
-Bart Teeuwisse (http://thecodemill.biz/)
-Ben Noordhuis (http://bnoordhuis.nl/)
-Tor Valamo (http://www.magnimedia.no/)
-Whyme.Lyu <5longluna@gmail.com> (http://whyme.kuantu.com/)
+Bart Teeuwisse
+Ben Noordhuis
+Tor Valamo
+Whyme.Lyu <5longluna@gmail.com>
Olivier Melcher
-Tomaž Muraus (http://www.tomaz-muraus.info)
-Evan Meagher (http://evanmeagher.net/)
-Orlando Vazquez (http://2wycked.net/)
+Tomaž Muraus
+Evan Meagher
+Orlando Vazquez
George Miroshnykov
-Geoff Flarity (http://ca.linkedin.com/pub/geoff-flarity/a/536/43a)
+Geoff Flarity
Pete Kruckenberg
-Laurie Harper (http://laurie.holoweb.net/)
+Laurie Harper
Chris Wong
-Max Goodman (http://chromacode.com/)
+Max Goodman
Scott Bronson
Federico Romero
-Visnu Pitiyanuvath (http://visnup.com)
-Irakli Gozalishvili (http://jeditoolkit.com/)
-Mark Cahill (http://www.tiemonster.info/)
+Visnu Pitiyanuvath
+Irakli Gozalishvili
+Mark Cahill
Zearin
Iain Sproat
-Trent Mick (http://trentm.com/)
-Felix Geisendörfer (http://www.debuggable.com/)
-Conny Brunnkvist (http://twitter.com/connyb)
-Will Elwood (https://github.com/welwood08)
-Oleg Efimov (http://sannis.ru)
+Trent Mick
+Felix Geisendörfer
+Conny Brunnkvist
+Will Elwood
+Oleg Efimov
Martin Cooper
Jameson Little
cspotcode
@@ -90,3 +90,26 @@ Paul Miller
seebees
Carl Lange
Jan Lehnardt
+Alexey Kreschuk
+Di Wu
+Florian Margaine
+Forbes Lindesay
+Ian Babrou
+Jaakko Manninen
+Johan Nordberg
+Johan Sköld
+Larz Conwell
+Luke Arduini
+Marcel Klehr
+Mathias Bynens
+Matt Lunn
+Matt McClure
+Nirk Niggler
+Paolo Fragomeni
+Jake Verbaten (Raynos)
+Robert Kowalski
+Schabse Laks
+Stuart Knightley
+Stuart P. Bentley
+Vaz Allen
+elisee
diff --git a/deps/npm/LICENSE b/deps/npm/LICENSE
index c0f51a741b9..bdca79502be 100644
--- a/deps/npm/LICENSE
+++ b/deps/npm/LICENSE
@@ -1,42 +1,218 @@
-Copyright (c) Isaac Z. Schlueter (the "Original Author")
+Copyright (c) Isaac Z. Schlueter
All rights reserved.
-MIT +no-false-attribs License
-
-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.
-
-Distributions of all or part of the Software intended to be used
-by the recipients as they would use the unmodified Software,
-containing modifications that substantially alter, remove, or
-disable functionality of the Software, outside of the documented
-configuration mechanisms provided by the Software, shall be
-modified such that the Original Author's bug reporting email
-addresses and urls are either replaced with the contact information
-of the parties responsible for the changes, or removed entirely.
-
-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.
+npm is released under the Artistic 2.0 License.
+The text of the License follows:
-Except where noted, this license applies to any and all software
-programs and associated documentation files created by the
-Original Author, when distributed with the Software.
+--------
+
+
+The Artistic License 2.0
+
+Copyright (c) 2000-2006, The Perl Foundation.
+
+Everyone is permitted to copy and distribute verbatim copies
+of this license document, but changing it is not allowed.
+
+Preamble
+
+This license establishes the terms under which a given free software
+Package may be copied, modified, distributed, and/or redistributed.
+The intent is that the Copyright Holder maintains some artistic
+control over the development of that Package while still keeping the
+Package available as open source and free software.
+
+You are always permitted to make arrangements wholly outside of this
+license directly with the Copyright Holder of a given Package. If the
+terms of this license do not permit the full use that you propose to
+make of the Package, you should contact the Copyright Holder and seek
+a different licensing arrangement.
+
+Definitions
+
+ "Copyright Holder" means the individual(s) or organization(s)
+ named in the copyright notice for the entire Package.
+
+ "Contributor" means any party that has contributed code or other
+ material to the Package, in accordance with the Copyright Holder's
+ procedures.
+
+ "You" and "your" means any person who would like to copy,
+ distribute, or modify the Package.
+
+ "Package" means the collection of files distributed by the
+ Copyright Holder, and derivatives of that collection and/or of
+ those files. A given Package may consist of either the Standard
+ Version, or a Modified Version.
+
+ "Distribute" means providing a copy of the Package or making it
+ accessible to anyone else, or in the case of a company or
+ organization, to others outside of your company or organization.
+
+ "Distributor Fee" means any fee that you charge for Distributing
+ this Package or providing support for this Package to another
+ party. It does not mean licensing fees.
+
+ "Standard Version" refers to the Package if it has not been
+ modified, or has been modified only in ways explicitly requested
+ by the Copyright Holder.
+
+ "Modified Version" means the Package, if it has been changed, and
+ such changes were not explicitly requested by the Copyright
+ Holder.
+
+ "Original License" means this Artistic License as Distributed with
+ the Standard Version of the Package, in its current version or as
+ it may be modified by The Perl Foundation in the future.
+
+ "Source" form means the source code, documentation source, and
+ configuration files for the Package.
+
+ "Compiled" form means the compiled bytecode, object code, binary,
+ or any other form resulting from mechanical transformation or
+ translation of the Source form.
+
+
+Permission for Use and Modification Without Distribution
+
+(1) You are permitted to use the Standard Version and create and use
+Modified Versions for any purpose without restriction, provided that
+you do not Distribute the Modified Version.
+
+
+Permissions for Redistribution of the Standard Version
+
+(2) You may Distribute verbatim copies of the Source form of the
+Standard Version of this Package in any medium without restriction,
+either gratis or for a Distributor Fee, provided that you duplicate
+all of the original copyright notices and associated disclaimers. At
+your discretion, such verbatim copies may or may not include a
+Compiled form of the Package.
+
+(3) You may apply any bug fixes, portability changes, and other
+modifications made available from the Copyright Holder. The resulting
+Package will still be considered the Standard Version, and as such
+will be subject to the Original License.
+
+
+Distribution of Modified Versions of the Package as Source
+
+(4) You may Distribute your Modified Version as Source (either gratis
+or for a Distributor Fee, and with or without a Compiled form of the
+Modified Version) provided that you clearly document how it differs
+from the Standard Version, including, but not limited to, documenting
+any non-standard features, executables, or modules, and provided that
+you do at least ONE of the following:
+
+ (a) make the Modified Version available to the Copyright Holder
+ of the Standard Version, under the Original License, so that the
+ Copyright Holder may include your modifications in the Standard
+ Version.
+
+ (b) ensure that installation of your Modified Version does not
+ prevent the user installing or running the Standard Version. In
+ addition, the Modified Version must bear a name that is different
+ from the name of the Standard Version.
+
+ (c) allow anyone who receives a copy of the Modified Version to
+ make the Source form of the Modified Version available to others
+ under
+
+ (i) the Original License or
+
+ (ii) a license that permits the licensee to freely copy,
+ modify and redistribute the Modified Version using the same
+ licensing terms that apply to the copy that the licensee
+ received, and requires that the Source form of the Modified
+ Version, and of any works derived from it, be made freely
+ available in that license fees are prohibited but Distributor
+ Fees are allowed.
+
+
+Distribution of Compiled Forms of the Standard Version
+or Modified Versions without the Source
+
+(5) You may Distribute Compiled forms of the Standard Version without
+the Source, provided that you include complete instructions on how to
+get the Source of the Standard Version. Such instructions must be
+valid at the time of your distribution. If these instructions, at any
+time while you are carrying out such distribution, become invalid, you
+must provide new instructions on demand or cease further distribution.
+If you provide valid instructions or cease distribution within thirty
+days after you become aware that the instructions are invalid, then
+you do not forfeit any of your rights under this license.
+
+(6) You may Distribute a Modified Version in Compiled form without
+the Source, provided that you comply with Section 4 with respect to
+the Source of the Modified Version.
+
+
+Aggregating or Linking the Package
+
+(7) You may aggregate the Package (either the Standard Version or
+Modified Version) with other packages and Distribute the resulting
+aggregation provided that you do not charge a licensing fee for the
+Package. Distributor Fees are permitted, and licensing fees for other
+components in the aggregation are permitted. The terms of this license
+apply to the use and Distribution of the Standard or Modified Versions
+as included in the aggregation.
+
+(8) You are permitted to link Modified and Standard Versions with
+other works, to embed the Package in a larger work of your own, or to
+build stand-alone binary or bytecode versions of applications that
+include the Package, and Distribute the result without restriction,
+provided the result does not expose a direct interface to the Package.
+
+
+Items That are Not Considered Part of a Modified Version
+
+(9) Works (including, but not limited to, modules and scripts) that
+merely extend or make use of the Package, do not, by themselves, cause
+the Package to be a Modified Version. In addition, such works are not
+considered parts of the Package itself, and are not subject to the
+terms of this license.
+
+
+General Provisions
+
+(10) Any use, modification, and distribution of the Standard or
+Modified Versions is governed by this Artistic License. By using,
+modifying or distributing the Package, you accept this license. Do not
+use, modify, or distribute the Package, if you do not accept this
+license.
+
+(11) If your Modified Version has been derived from a Modified
+Version made by someone other than you, you are nevertheless required
+to ensure that your Modified Version complies with the requirements of
+this license.
+
+(12) This license does not grant you the right to use any trademark,
+service mark, tradename, or logo of the Copyright Holder.
+
+(13) This license includes the non-exclusive, worldwide,
+free-of-charge patent license to make, have made, use, offer to sell,
+sell, import and otherwise transfer the Package with respect to any
+patent claims licensable by the Copyright Holder that are necessarily
+infringed by the Package. If you institute patent litigation
+(including a cross-claim or counterclaim) against any party alleging
+that the Package constitutes direct or contributory patent
+infringement, then this Artistic License to you shall terminate on the
+date that such litigation is filed.
+
+(14) Disclaimer of Warranty:
+THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS
+IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED
+WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
+NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL
+LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL
+BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF
+ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+--------
+
"Node.js" and "node" trademark Joyent, Inc. npm is not officially
part of the Node.js project, and is neither owned by nor
@@ -55,11 +231,5 @@ Copyright (c) by Tjarda Koster, http://jelloween.deviantart.com
included for use in the npm website and documentation,
used with permission.
-This program uses "request", Copyright (c) Mikeal Rogers,
-according to the terms of the Apache license.
-
-This program uses "mkdirp", Copyright (c) James Halliday,
-according to the terms of the MIT/X11 license.
-
-This program uses "opener", Copyright (c) Domenic Denicola,
-according to the terms of the DWTFPL2 license.
+This program uses several Node modules contained in the node_modules/
+subdirectory, according to the terms of their respective licenses.
diff --git a/deps/npm/html/doc/README.html b/deps/npm/html/doc/README.html
index d9c309b1026..2cd2cb537da 100644
--- a/deps/npm/html/doc/README.html
+++ b/deps/npm/html/doc/README.html
@@ -240,7 +240,7 @@ will no doubt tell you to put the output in a gist or email.
-
+