Showing with 300 additions and 43 deletions.
  1. +1 −0 AUTHORS
  2. +1 −1 README.md
  3. +2 −0 deps/debugger-agent/lib/_debugger_agent.js
  4. +2 −0 lib/_debugger.js
  5. +2 −0 lib/_http_agent.js
  6. +2 −0 lib/_http_client.js
  7. +2 −0 lib/_http_common.js
  8. +2 −0 lib/_http_incoming.js
  9. +2 −0 lib/_http_outgoing.js
  10. +2 −0 lib/_http_server.js
  11. +2 −0 lib/_linklist.js
  12. +2 −0 lib/_stream_duplex.js
  13. +2 −0 lib/_stream_passthrough.js
  14. +5 −3 lib/_stream_readable.js
  15. +2 −0 lib/_stream_transform.js
  16. +2 −0 lib/_stream_writable.js
  17. +2 −0 lib/_tls_common.js
  18. +21 −12 lib/_tls_legacy.js
  19. +2 −0 lib/_tls_wrap.js
  20. +2 −0 lib/assert.js
  21. +2 −0 lib/buffer.js
  22. +2 −0 lib/child_process.js
  23. +2 −0 lib/cluster.js
  24. +4 −2 lib/console.js
  25. +2 −0 lib/constants.js
  26. +11 −7 lib/crypto.js
  27. +3 −1 lib/dgram.js
  28. +2 −0 lib/dns.js
  29. +2 −0 lib/domain.js
  30. +2 −0 lib/events.js
  31. +2 −0 lib/freelist.js
  32. +7 −1 lib/fs.js
  33. +2 −0 lib/http.js
  34. +2 −0 lib/https.js
  35. +2 −0 lib/module.js
  36. +14 −12 lib/net.js
  37. +2 −0 lib/os.js
  38. +2 −0 lib/path.js
  39. +2 −0 lib/querystring.js
  40. +2 −0 lib/readline.js
  41. +2 −0 lib/repl.js
  42. +2 −0 lib/smalloc.js
  43. +2 −0 lib/stream.js
  44. +2 −0 lib/string_decoder.js
  45. +2 −0 lib/sys.js
  46. +2 −0 lib/timers.js
  47. +2 −0 lib/tls.js
  48. +2 −0 lib/tty.js
  49. +2 −0 lib/url.js
  50. +2 −0 lib/util.js
  51. +2 −0 lib/vm.js
  52. +2 −0 lib/zlib.js
  53. +3 −0 src/node.js
  54. +2 −2 src/node_version.h
  55. +5 −0 test/simple/test-cluster-dgram-2.js
  56. +100 −0 test/simple/test-dgram-exclusive-implicit-bind.js
  57. +3 −2 test/simple/test-http-destroyed-socket-write2.js
  58. +34 −0 test/simple/test-use-strict-builtin-modules.js
@@ -200,6 +200,7 @@ Felix Geisendörfer
Feross Aboukhadijeh
Forrest L Norvell
Francois Marier
Frank Cash
Fred K. Schott
Frederico Silva
Friedemann Altrock
@@ -194,7 +194,7 @@ Resources for Newcomers
- [searching the npm registry](http://npmjs.org/)
- [list of companies and projects using node](https://github.com/joyent/node/wiki/Projects,-Applications,-and-Companies-Using-Node)
- [node.js mailing list](http://groups.google.com/group/nodejs)
- irc chatroom, [#node.js on freenode.net](http://webchat.freenode.net?channels=node.js&uio=d4)
- [irc chatroom, #node.js on freenode.net](http://webchat.freenode.net?channels=node.js&uio=d4)
- [community](https://github.com/joyent/node/wiki/Community)
- [contributing](https://github.com/joyent/node/wiki/Contributing)
- [big list of all the helpful wiki pages](https://github.com/joyent/node/wiki/_pages)
@@ -1,3 +1,5 @@
'use strict';

var assert = require('assert');
var net = require('net');
var util = require('util');
@@ -19,6 +19,8 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.

'use strict';

var util = require('util'),
path = require('path'),
net = require('net'),
@@ -19,6 +19,8 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.

'use strict';

var net = require('net');
var util = require('util');
var EventEmitter = require('events').EventEmitter;
@@ -19,6 +19,8 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.

'use strict';

var util = require('util');
var net = require('net');
var url = require('url');
@@ -19,6 +19,8 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.

'use strict';

var FreeList = require('freelist').FreeList;
var HTTPParser = process.binding('http_parser').HTTPParser;

@@ -19,6 +19,8 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.

'use strict';

var util = require('util');
var Stream = require('stream');

@@ -19,6 +19,8 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.

'use strict';

var assert = require('assert').ok;
var Stream = require('stream');
var timers = require('timers');
@@ -19,6 +19,8 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.

'use strict';

var util = require('util');
var net = require('net');
var EventEmitter = require('events').EventEmitter;
@@ -19,6 +19,8 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.

'use strict';

function init(list) {
list._idleNext = list;
list._idlePrev = list;
@@ -19,6 +19,8 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.

'use strict';

// a duplex stream is just a stream that is both readable and writable.
// Since JS doesn't have multiple prototypal inheritance, this class
// prototypally inherits from Readable, and then parasitically from
@@ -19,6 +19,8 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.

'use strict';

// a passthrough stream.
// basically just the most minimal sort of Transform stream.
// Every written chunk gets output as-is.
@@ -19,6 +19,8 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.

'use strict';

module.exports = Readable;
Readable.ReadableState = ReadableState;

@@ -142,8 +144,7 @@ function readableAddChunk(stream, state, chunk, encoding, addToFront) {
stream.emit('error', er);
} else if (chunk === null) {
state.reading = false;
if (!state.ended)
onEofChunk(stream, state);
onEofChunk(stream, state);
} else if (state.objectMode || chunk && chunk.length > 0) {
if (state.ended && !addToFront) {
var e = new Error('stream.push() after EOF');
@@ -388,7 +389,8 @@ function chunkInvalid(state, chunk) {


function onEofChunk(stream, state) {
if (state.decoder && !state.ended) {
if (state.ended) return;
if (state.decoder) {
var chunk = state.decoder.end();
if (chunk && chunk.length) {
state.buffer.push(chunk);
@@ -19,6 +19,8 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.

'use strict';


// a transform stream is a readable/writable stream where you do
// something with the data. Sometimes it's called a "filter",
@@ -19,6 +19,8 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.

'use strict';

// A bit simpler than readable streams.
// Implement an async ._write(chunk, cb), and it'll handle all
// the drain event emission and buffering.
@@ -19,6 +19,8 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.

'use strict';

var util = require('util');
var constants = require('constants');
var tls = require('tls');
@@ -19,6 +19,8 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.

'use strict';

var assert = require('assert');
var events = require('events');
var stream = require('stream');
@@ -426,6 +428,24 @@ CryptoStream.prototype.end = function(chunk, encoding) {
stream.Duplex.prototype.end.call(this, chunk, encoding);
};

/*
* Wait for both `finish` and `end` events to ensure that all data that
* was written on this side was read from the other side.
*/
function _destroyWhenReadAndWriteEndsDone(cryptoStream) {
var waiting = 1;

function finish() {
if (--waiting === 0) cryptoStream.destroy();
}

cryptoStream._opposite.once('end', finish);

if (!cryptoStream._finished) {
cryptoStream.once('finish', finish);
++waiting;
}
}

CryptoStream.prototype.destroySoon = function(err) {
if (this === this.pair.cleartext) {
@@ -440,18 +460,7 @@ CryptoStream.prototype.destroySoon = function(err) {
if (this._writableState.finished && this._opposite._ended) {
this.destroy();
} else {
// Wait for both `finish` and `end` events to ensure that all data that
// was written on this side was read from the other side.
var self = this;
var waiting = 1;
function finish() {
if (--waiting === 0) self.destroy();
}
this._opposite.once('end', finish);
if (!this._finished) {
this.once('finish', finish);
++waiting;
}
_destroyWhenReadAndWriteEndsDone(this);
}
};

@@ -22,6 +22,8 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.

'use strict';

var assert = require('assert');
var crypto = require('crypto');
var net = require('net');
@@ -22,6 +22,8 @@
// 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.

'use strict';

// UTILITY
var util = require('util');
var b = require('buffer');
@@ -19,6 +19,8 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.

'use strict';

var buffer = process.binding('buffer');
var smalloc = process.binding('smalloc');
var util = require('util');
@@ -19,6 +19,8 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.

'use strict';

var StringDecoder = require('string_decoder').StringDecoder;
var EventEmitter = require('events').EventEmitter;
var net = require('net');
@@ -19,6 +19,8 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.

'use strict';

var EventEmitter = require('events').EventEmitter;
var assert = require('assert');
var dgram = require('dgram');
@@ -19,6 +19,8 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.

'use strict';

var util = require('util');

function Console(stdout, stderr) {
@@ -89,13 +91,13 @@ Console.prototype.timeEnd = function(label) {
};


Console.prototype.trace = function() {
Console.prototype.trace = function trace() {
// TODO probably can to do this better with V8's debug object once that is
// exposed.
var err = new Error;
err.name = 'Trace';
err.message = util.format.apply(this, arguments);
Error.captureStackTrace(err, arguments.callee);
Error.captureStackTrace(err, trace);
this.error(err.stack);
};

@@ -19,4 +19,6 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.

'use strict';

module.exports = process.binding('constants');
@@ -19,6 +19,8 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.

'use strict';

// Note: In 0.8 and before, crypto functions all defaulted to using
// binary-encoded strings rather than buffers.

@@ -592,20 +594,22 @@ exports.pbkdf2Sync = function(password, salt, iterations, keylen, digest) {


function pbkdf2(password, salt, iterations, keylen, digest, callback) {
var encoding = exports.DEFAULT_ENCODING;

function next(er, ret) {
if (ret)
ret = ret.toString(encoding);
callback(er, ret);
}

password = toBuf(password);
salt = toBuf(salt);

if (exports.DEFAULT_ENCODING === 'buffer')
if (encoding === 'buffer')
return binding.PBKDF2(password, salt, iterations, keylen, digest, callback);

// at this point, we need to handle encodings.
var encoding = exports.DEFAULT_ENCODING;
if (callback) {
function next(er, ret) {
if (ret)
ret = ret.toString(encoding);
callback(er, ret);
}
binding.PBKDF2(password, salt, iterations, keylen, digest, next);
} else {
var ret = binding.PBKDF2(password, salt, iterations, keylen, digest);
@@ -19,6 +19,8 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.

'use strict';

var assert = require('assert');
var util = require('util');
var events = require('events');
@@ -293,7 +295,7 @@ Socket.prototype.send = function(buffer,
self._healthCheck();

if (self._bindState == BIND_STATE_UNBOUND)
self.bind(0, null);
self.bind({port: 0, exclusive: true}, null);

// If the socket hasn't been bound yet, push the outbound packet onto the
// send queue and send after binding is complete.
@@ -19,6 +19,8 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.

'use strict';

var net = require('net');
var util = require('util');

@@ -19,6 +19,8 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.

'use strict';

var util = require('util');
var EventEmitter = require('events');
var inherits = util.inherits;
@@ -19,6 +19,8 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.

'use strict';

var domain;
var util = require('util');

@@ -19,6 +19,8 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.

'use strict';

// This is a free list to avoid creating so many of the same object.
exports.FreeList = function(name, max, constructor) {
this.name = name;