From 050bbf0bc482178b4b5f4c81c50e22f6bbcb6b13 Mon Sep 17 00:00:00 2001
From: Ryan Dahl
Date: Wed, 13 Apr 2011 18:37:49 -0700
Subject: [PATCH 01/10] TLS use RC4-SHA by default
---
lib/tls.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/tls.js b/lib/tls.js
index 547e9395c68..0adba535e80 100644
--- a/lib/tls.js
+++ b/lib/tls.js
@@ -726,7 +726,7 @@ function Server(/* [options], listener */) {
secureProtocol: self.secureProtocol,
crl: self.crl
});
- //creds.context.setCiphers('RC4-SHA:AES128-SHA:AES256-SHA');
+ creds.context.setCiphers('RC4-SHA:AES128-SHA:AES256-SHA');
var pair = new SecurePair(creds,
true,
From bb621f7c2eb9561af6bca34549294b381a98cdac Mon Sep 17 00:00:00 2001
From: Ryan Dahl
Date: Wed, 13 Apr 2011 13:54:47 -0700
Subject: [PATCH 02/10] CryptoStream.write returns false when queue > 128kb
Previously the return value of write was dependent on if it was paused or
not which was causing a strange error demoed in the previous commit.
Fixes #892
---
lib/tls.js | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/lib/tls.js b/lib/tls.js
index 0adba535e80..b34ed95204e 100644
--- a/lib/tls.js
+++ b/lib/tls.js
@@ -54,13 +54,14 @@ function CryptoStream(pair) {
this._writeState = true;
this._pending = [];
this._pendingCallbacks = [];
+ this._pendingBytes = 0;
}
util.inherits(CryptoStream, stream.Stream);
CryptoStream.prototype.write = function(data /* , encoding, cb */) {
if (this == this.pair.cleartext) {
- debug('cleartext.write called with (((' + data.toString() + ')))');
+ debug('cleartext.write called with ' + data.length + ' bytes');
} else {
debug('encrypted.write called with ' + data.length + ' bytes');
}
@@ -90,10 +91,12 @@ CryptoStream.prototype.write = function(data /* , encoding, cb */) {
this._pending.push(data);
this._pendingCallbacks.push(cb);
+ this._pendingBytes += data.length;
+
this.pair._writeCalled = true;
this.pair._cycle();
- return this._writeState;
+ return this._pendingBytes < 128 * 1024;
};
@@ -263,7 +266,7 @@ CryptoStream.prototype._push = function() {
// Bail out if we didn't read any data.
if (bytesRead == 0) {
- if (this._pendingBytes() == 0 && this._destroyAfterPush) {
+ if (this._internallyPendingBytes() == 0 && this._destroyAfterPush) {
this._done();
}
return;
@@ -272,7 +275,7 @@ CryptoStream.prototype._push = function() {
var chunk = pool.slice(0, bytesRead);
if (this === this.pair.cleartext) {
- debug('cleartext emit "data" called with (((' + chunk.toString() + ')))');
+ debug('cleartext emit "data" with ' + bytesRead + ' bytes');
} else {
debug('encrypted emit "data" with ' + bytesRead + ' bytes');
}
@@ -307,6 +310,8 @@ CryptoStream.prototype._push = function() {
CryptoStream.prototype._pull = function() {
var havePending = this._pending.length > 0;
+ assert(havePending || this._pendingBytes == 0);
+
while (this._pending.length > 0) {
if (!this.pair._ssl) break;
@@ -355,6 +360,9 @@ CryptoStream.prototype._pull = function() {
break;
}
+ this._pendingBytes -= tmp.length;
+ assert(this._pendingBytes >= 0);
+
if (cb) cb();
assert(rv === tmp.length);
@@ -375,7 +383,7 @@ function CleartextStream(pair) {
util.inherits(CleartextStream, CryptoStream);
-CleartextStream.prototype._pendingBytes = function() {
+CleartextStream.prototype._internallyPendingBytes = function() {
if (this.pair._ssl) {
return this.pair._ssl.clearPending();
} else {
@@ -403,7 +411,7 @@ function EncryptedStream(pair) {
util.inherits(EncryptedStream, CryptoStream);
-EncryptedStream.prototype._pendingBytes = function() {
+EncryptedStream.prototype._internallyPendingBytes = function() {
if (this.pair._ssl) {
return this.pair._ssl.encPending();
} else {
@@ -539,24 +547,28 @@ SecurePair.prototype._cycle = function(depth) {
if (!this._cycleEncryptedPullLock) {
this._cycleEncryptedPullLock = true;
+ debug("encrypted._pull");
this.encrypted._pull();
this._cycleEncryptedPullLock = false;
}
if (!this._cycleCleartextPullLock) {
this._cycleCleartextPullLock = true;
+ debug("cleartext._pull");
this.cleartext._pull();
this._cycleCleartextPullLock = false;
}
if (!this._cycleCleartextPushLock) {
this._cycleCleartextPushLock = true;
+ debug("cleartext._push");
this.cleartext._push();
this._cycleCleartextPushLock = false;
}
if (!this._cycleEncryptedPushLock) {
this._cycleEncryptedPushLock = true;
+ debug("encrypted._push");
this.encrypted._push();
this._cycleEncryptedPushLock = false;
}
From 58002d56bc79410c5ff397fc0e1ffec0665db38a Mon Sep 17 00:00:00 2001
From: Ryan Dahl
Date: Wed, 13 Apr 2011 21:20:05 -0700
Subject: [PATCH 03/10] Bump to v0.4.6
---
AUTHORS | 3 +++
ChangeLog | 30 ++++++++++++++++++++++++++++++
doc/index.html | 8 ++++----
src/node_version.h | 2 +-
wscript | 2 +-
5 files changed, 39 insertions(+), 6 deletions(-)
diff --git a/AUTHORS b/AUTHORS
index 7159091579f..cf29f0189e4 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -167,4 +167,7 @@ Dean McNamee
Trevor Burnham
Zachary Scott
Arnout Kazemier
+George Stagas
+Scott McWhirter
+Jakub Lekstan
diff --git a/ChangeLog b/ChangeLog
index e4a09248bbc..bba5127ea3c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,33 @@
+2011.04.13, Version 0.4.6 (stable)
+
+* Don't error on ENOTCONN from shutdown() #670
+
+* Auto completion of built-in debugger suggests prefix match rather than
+ partial match. (koichik)
+
+* circular reference in vm modules. #822 (Jakub Lekstan)
+
+* http response.readable should be false after 'end' #867 (Abe Fettig)
+
+* Implemenet os.cpus() and os.uptime() on Solaris (Scott McWhirter)
+
+* fs.ReadStream: Allow omission of end option for range reads #801
+ (Felix Geisendörfer)
+
+* Buffer.write() with UCS-2 should not be write partial char
+ #916 (koichik)
+
+* Pass secureProtocol through on tls.Server creation (Theo Schlossnagle)
+
+* TLS use RC4-SHA by default
+
+* Don't strangely drop out of event loop on HTTPS client uploads #892
+
+* Doc improvements
+
+* Upgrade v8 to 3.1.8.10
+
+
2011.04.01, Version 0.4.5 (stable)
* Fix listener leak in stream.pipe() (Mikeal Rogers)
diff --git a/doc/index.html b/doc/index.html
index 7f4db3f96bc..3406f83cf2f 100644
--- a/doc/index.html
+++ b/doc/index.html
@@ -26,7 +26,7 @@
Download
ChangeLog
About
- v0.4.5 docs
+ v0.4.6 docs
Wiki
Blog
@@ -108,9 +108,9 @@ server.listen(8124, "127.0.0.1");
- 2011.04.01
- node-v0.4.5.tar.gz
- (Documentation)
+ 2011.04.13
+ node-v0.4.6.tar.gz
+ (Documentation)
Historical: versions, docs
diff --git a/src/node_version.h b/src/node_version.h
index eef324505f2..caef271c942 100644
--- a/src/node_version.h
+++ b/src/node_version.h
@@ -28,7 +28,7 @@
#define NODE_MAJOR_VERSION 0
#define NODE_MINOR_VERSION 4
#define NODE_PATCH_VERSION 6
-#define NODE_VERSION_IS_RELEASE 0
+#define NODE_VERSION_IS_RELEASE 1
#ifndef NODE_STRINGIFY
#define NODE_STRINGIFY(n) NODE_STRINGIFY_HELPER(n)
diff --git a/wscript b/wscript
index 756b530cf8c..f8357c470db 100644
--- a/wscript
+++ b/wscript
@@ -872,7 +872,7 @@ def build(bld):
, 'CPPFLAGS' : " ".join(program.env["CPPFLAGS"]).replace('"', '\\"')
, 'LIBFLAGS' : " ".join(program.env["LIBFLAGS"]).replace('"', '\\"')
, 'PREFIX' : safe_path(program.env["PREFIX"])
- , 'VERSION' : '0.4.5' # FIXME should not be hard-coded, see NODE_VERSION_STRING in src/node_version.
+ , 'VERSION' : '0.4.6' # FIXME should not be hard-coded, see NODE_VERSION_STRING in src/node_version.
}
return x
From 61100788ada9e9dbf3cb04071ac642c1aab849f8 Mon Sep 17 00:00:00 2001
From: Ryan Dahl
Date: Wed, 13 Apr 2011 22:03:48 -0700
Subject: [PATCH 04/10] Now working on v0.4.7
---
src/node_version.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/node_version.h b/src/node_version.h
index caef271c942..fdd27cb3de4 100644
--- a/src/node_version.h
+++ b/src/node_version.h
@@ -27,8 +27,8 @@
#define NODE_MAJOR_VERSION 0
#define NODE_MINOR_VERSION 4
-#define NODE_PATCH_VERSION 6
-#define NODE_VERSION_IS_RELEASE 1
+#define NODE_PATCH_VERSION 7
+#define NODE_VERSION_IS_RELEASE 0
#ifndef NODE_STRINGIFY
#define NODE_STRINGIFY(n) NODE_STRINGIFY_HELPER(n)
From 8417870f513e6f1ab98e07fe95d3430dbec48b87 Mon Sep 17 00:00:00 2001
From: Ryan Dahl
Date: Thu, 14 Apr 2011 00:01:23 -0700
Subject: [PATCH 05/10] Don't emit error on ECONNRESET - just close
Fix #670
---
lib/net.js | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/lib/net.js b/lib/net.js
index e96e3c6900a..8d88c69bba8 100644
--- a/lib/net.js
+++ b/lib/net.js
@@ -635,7 +635,11 @@ Socket.prototype._onReadable = function() {
pool.length - pool.used);
DTRACE_NET_SOCKET_READ(this, bytesRead);
} catch (e) {
- self.destroy(e);
+ if (e.code == 'ECONNRESET') {
+ self.destroy();
+ } else {
+ self.destroy(e);
+ }
return;
}
From 6c5b31bd80d2d38600d84a5be0ae9c5bbad94c01 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Felix=20Geisendo=CC=88rfer?=
Date: Thu, 14 Apr 2011 20:33:54 +0200
Subject: [PATCH 06/10] Fix: Multiple pipes to the same stream were broken
When creating multiple .pipe()s to the same destination stream, the
first source to end would close the destination, breaking all remaining
pipes. This patch fixes the problem by keeping track of all open
pipes, so that we only call end on destinations that have no more
sources piping to them.
closes #929
---
lib/stream.js | 29 ++++++++++++++++++-------
test/simple/test-stream-pipe-cleanup.js | 21 +++++++++++++++++-
2 files changed, 41 insertions(+), 9 deletions(-)
diff --git a/lib/stream.js b/lib/stream.js
index d31a9fe239a..632c87d2e26 100644
--- a/lib/stream.js
+++ b/lib/stream.js
@@ -28,9 +28,13 @@ function Stream() {
util.inherits(Stream, events.EventEmitter);
exports.Stream = Stream;
+var pipes = [];
+
Stream.prototype.pipe = function(dest, options) {
var source = this;
+ pipes.push(dest);
+
function ondata(chunk) {
if (dest.writable) {
if (false === dest.write(chunk)) source.pause();
@@ -52,10 +56,18 @@ Stream.prototype.pipe = function(dest, options) {
if (!options || options.end !== false) {
function onend() {
+ var index = pipes.indexOf(dest);
+ pipes.splice(index, 1);
+
+ if (pipes.indexOf(dest) > -1) {
+ return;
+ }
+
dest.end();
}
source.on('end', onend);
+ source.on('close', onend);
}
/*
@@ -73,34 +85,35 @@ Stream.prototype.pipe = function(dest, options) {
source.emit('resume');
};
}
-
+
var onpause = function() {
source.pause();
}
dest.on('pause', onpause);
-
+
var onresume = function() {
if (source.readable) source.resume();
};
-
+
dest.on('resume', onresume);
-
+
var cleanup = function () {
source.removeListener('data', ondata);
dest.removeListener('drain', ondrain);
source.removeListener('end', onend);
-
+ source.removeListener('close', onend);
+
dest.removeListener('pause', onpause);
dest.removeListener('resume', onresume);
-
+
source.removeListener('end', cleanup);
source.removeListener('close', cleanup);
-
+
dest.removeListener('end', cleanup);
dest.removeListener('close', cleanup);
}
-
+
source.on('end', cleanup);
source.on('close', cleanup);
diff --git a/test/simple/test-stream-pipe-cleanup.js b/test/simple/test-stream-pipe-cleanup.js
index fce4ac82a7d..32ecd153dc8 100644
--- a/test/simple/test-stream-pipe-cleanup.js
+++ b/test/simple/test-stream-pipe-cleanup.js
@@ -28,10 +28,13 @@ var util = require('util');
function Writable () {
this.writable = true;
+ this.endCalls = 0;
stream.Stream.call(this);
}
util.inherits(Writable, stream.Stream);
-Writable.prototype.end = function () {}
+Writable.prototype.end = function () {
+ this.endCalls++;
+}
function Readable () {
this.readable = true;
@@ -56,6 +59,9 @@ for (i = 0; i < limit; i++) {
r.emit('end')
}
assert.equal(0, r.listeners('end').length);
+assert.equal(limit, w.endCalls);
+
+w.endCalls = 0;
for (i = 0; i < limit; i++) {
r = new Readable()
@@ -63,6 +69,19 @@ for (i = 0; i < limit; i++) {
r.emit('close')
}
assert.equal(0, r.listeners('close').length);
+assert.equal(limit, w.endCalls);
+
+w.endCalls = 0;
+
+var r2;
+r = new Readable()
+r2 = new Readable();
+
+r.pipe(w)
+r2.pipe(w)
+r.emit('close')
+r2.emit('close')
+assert.equal(1, w.endCalls);
r = new Readable();
From 74d94b0dd1d10402c765a6c0cf2578ce1a734f99 Mon Sep 17 00:00:00 2001
From: koichik
Date: Fri, 15 Apr 2011 01:54:36 +0900
Subject: [PATCH 07/10] Fix docs - Move module's description to right position
---
doc/api/globals.markdown | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/doc/api/globals.markdown b/doc/api/globals.markdown
index fb971cbb0ee..364a703d4c3 100644
--- a/doc/api/globals.markdown
+++ b/doc/api/globals.markdown
@@ -66,6 +66,7 @@ Example: running `node example.js` from `/Users/mjr`
A reference to the current module. In particular
`module.exports` is the same as the `exports` object. See `src/node.js`
for more information.
+`module` isn't actually a global but rather local to each module.
### setTimeout(cb, ms)
### clearTimeout(t)
@@ -73,5 +74,3 @@ for more information.
### clearInterval(t)
The timer functions are global variables. See the [timers](timers.html) section.
-
-`module` isn't actually a global but rather local to each module.
From ed316ae3508f817b4ae4568b445b39bb86a5f6f2 Mon Sep 17 00:00:00 2001
From: Ryan Dahl
Date: Thu, 14 Apr 2011 15:11:35 -0700
Subject: [PATCH 08/10] Docs: some encodings contains multibyte chars.
fixes #888
---
doc/api/http.markdown | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/doc/api/http.markdown b/doc/api/http.markdown
index 500347dd7e2..09efedebf75 100644
--- a/doc/api/http.markdown
+++ b/doc/api/http.markdown
@@ -259,6 +259,11 @@ be called before `response.end()` is called.
If you call `response.write()` or `response.end()` before calling this, the
implicit/mutable headers will be calculated and call this function for you.
+Note: that Content-Length is given in bytes not characters. The above example
+works because the string `'hello world'` contains only single byte characters.
+If the body contains higher coded characters then `Buffer.byteLength()`
+should be used to determine the number of bytes in a given encoding.
+
### response.statusCode
When using implicit headers (not calling `response.writeHead()` explicitly), this property
From cbdd92e1840e1f2d8df4c0be30d0795c025a7b0b Mon Sep 17 00:00:00 2001
From: Ryan Dahl
Date: Sat, 16 Apr 2011 13:55:03 -0700
Subject: [PATCH 09/10] Add community link on homepage
---
doc/index.html | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/doc/index.html b/doc/index.html
index 3406f83cf2f..5770786a929 100644
--- a/doc/index.html
+++ b/doc/index.html
@@ -28,11 +28,10 @@
About
v0.4.6 docs
- Wiki
- Blog
-
- Jobs
-
+ Wiki
+ Blog
+ Jobs
+ Community
Demo
From d3d35ec3ca63c8e39996c4a9b5f0e3a0d276dcd5 Mon Sep 17 00:00:00 2001
From: Ryan Dahl
Date: Mon, 18 Apr 2011 16:52:53 -0700
Subject: [PATCH 10/10] add docs for console object
---
doc/api/_toc.markdown | 1 +
doc/api/all.markdown | 1 +
doc/api/globals.markdown | 5 ++++
doc/api/stdio.markdown | 51 ++++++++++++++++++++++++++++++++++++++++
4 files changed, 58 insertions(+)
create mode 100644 doc/api/stdio.markdown
diff --git a/doc/api/_toc.markdown b/doc/api/_toc.markdown
index 23df8790887..58419663ae5 100644
--- a/doc/api/_toc.markdown
+++ b/doc/api/_toc.markdown
@@ -2,6 +2,7 @@
* [Synopsis](synopsis.html)
* [Globals](globals.html)
+* [STDIO](stdio.html)
* [Timers](timers.html)
* [Modules](modules.html)
* [C/C++ Addons](addons.html)
diff --git a/doc/api/all.markdown b/doc/api/all.markdown
index fe12ef7e532..5498d17ddae 100644
--- a/doc/api/all.markdown
+++ b/doc/api/all.markdown
@@ -1,6 +1,7 @@
@include synopsis
@include globals
+@include stdio
@include timers
@include modules
@include addons
diff --git a/doc/api/globals.markdown b/doc/api/globals.markdown
index 364a703d4c3..8aceceaed6a 100644
--- a/doc/api/globals.markdown
+++ b/doc/api/globals.markdown
@@ -16,6 +16,11 @@ scope; `var something` inside a Node module will be local to that module.
The process object. See the [process object](process.html#process) section.
+### console
+
+Used to print to stdout and stderr. See the [stdio](stdio.html) section.
+
+
### require()
To require modules. See the [Modules](modules.html#modules) section.
diff --git a/doc/api/stdio.markdown b/doc/api/stdio.markdown
new file mode 100644
index 00000000000..a24d0572c63
--- /dev/null
+++ b/doc/api/stdio.markdown
@@ -0,0 +1,51 @@
+## console
+
+Browser-like object for printing to stdout and stderr.
+
+### console.log()
+
+Prints to stdout with newline. This function can take multiple arguments in a
+`printf()`-like way. Example:
+
+ console.log('count: %d', count);
+
+If formating elements are not found in the first string then `util.inspect`
+is used on each argument.
+
+### console.info()
+
+Same as `console.log`.
+
+### console.warn()
+### console.error()
+
+Same as `console.log` but prints to stderr.
+
+### console.dir(obj)
+
+Uses `util.inspect` on `obj` and prints resulting string to stderr.
+
+### console.time(label)
+
+Mark a time.
+
+
+### console.timeEnd(label)
+
+Finish timer, record output. Example
+
+ console.time('100-elements');
+ while (var i = 0; i < 100; i++) {
+ ;
+ }
+ console.timeEnd('100-elements');
+
+
+### console.trace()
+
+Print a stack trace to stderr of the current position.
+
+### console.assert()
+
+Same as `assert.ok()`.
+