From 1efac74958c03d6edcab7e1880fc841db7a8eb30 Mon Sep 17 00:00:00 2001 From: Brian White Date: Fri, 18 Feb 2011 19:02:16 -0500 Subject: [PATCH 1/6] Fix os.cpus() on cygwin --- src/platform_cygwin.cc | 12 ++++++++---- src/platform_linux.cc | 9 +++++++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/platform_cygwin.cc b/src/platform_cygwin.cc index 416cb1735f..9338d4f4b8 100644 --- a/src/platform_cygwin.cc +++ b/src/platform_cygwin.cc @@ -99,8 +99,7 @@ static inline char* _getProcessTitle() { if (GetLastError()) { _winapi_perror("GetConsoleTitleW"); return NULL; - } - else { + } else { // The title is empty, so return empty string process_title = strdup("\0"); return process_title; @@ -252,6 +251,7 @@ int Platform::GetExecutablePath(char* buffer, size_t* size) { } int Platform::GetCPUInfo(Local *cpus) { + HandleScope scope; Local cpuinfo; Local cputimes; unsigned int ticks = (unsigned int)sysconf(_SC_CLK_TCK), @@ -285,14 +285,17 @@ int Platform::GetCPUInfo(Local *cpus) { if (fpStat) { while (fgets(line, 511, fpStat) != NULL) { - if (strncmp(line, "cpu ", 4) == 0) + if (strncmp(line, "cpu ", 4) == 0) { continue; - else if (strncmp(line, "intr ", 5) == 0) + } else if (strncmp(line, "cpu", 3) != 0) { break; + } + sscanf(line, "%*s %llu %llu %llu %llu", &ticks_user, &ticks_nice, &ticks_sys, &ticks_idle); snprintf(speedPath, sizeof(speedPath), "/sys/devices/system/cpu/cpu%u/cpufreq/cpuinfo_max_freq", i); + fpSpeed = fopen(speedPath, "r"); if (fpSpeed) { if (fgets(line, 511, fpSpeed) != NULL) { @@ -355,4 +358,5 @@ int Platform::GetLoadAvg(Local *loads) { return -1; } + } // namespace node diff --git a/src/platform_linux.cc b/src/platform_linux.cc index 00732a0c03..473997727b 100644 --- a/src/platform_linux.cc +++ b/src/platform_linux.cc @@ -183,15 +183,19 @@ int Platform::GetCPUInfo(Local *cpus) { if (fpStat) { while (fgets(line, 511, fpStat) != NULL) { - if (strncmp(line, "cpu ", 4) == 0) + if (strncmp(line, "cpu ", 4) == 0) { continue; - else if (strncmp(line, "intr ", 5) == 0) + } else if (strncmp(line, "cpu", 3) != 0) { break; + } + sscanf(line, "%*s %llu %llu %llu %llu %*llu %llu", &ticks_user, &ticks_nice, &ticks_sys, &ticks_idle, &ticks_intr); snprintf(speedPath, sizeof(speedPath), "/sys/devices/system/cpu/cpu%u/cpufreq/cpuinfo_max_freq", i); + fpSpeed = fopen(speedPath, "r"); + if (fpSpeed) { if (fgets(line, 511, fpSpeed) != NULL) { sscanf(line, "%u", &cpuspeed); @@ -199,6 +203,7 @@ int Platform::GetCPUInfo(Local *cpus) { } fclose(fpSpeed); } + cpuinfo = Object::New(); cputimes = Object::New(); cputimes->Set(String::New("user"), Number::New(ticks_user * multiplier)); From 8b9dbdad272d58b3db7cfa8956dad6b7db5d7c0e Mon Sep 17 00:00:00 2001 From: isaacs Date: Thu, 17 Feb 2011 17:38:36 -0800 Subject: [PATCH 2/6] Closes GH-687 Don't read fs read stream if not open --- lib/fs.js | 3 +++ test/simple/test-fs-read-stream.js | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/lib/fs.js b/lib/fs.js index 62712d57f8..3eb31a99fc 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -921,6 +921,9 @@ ReadStream.prototype.resume = function() { this.buffer = null; } + // hasn't opened yet. + if (null == this.fd) return; + this._read(); }; diff --git a/test/simple/test-fs-read-stream.js b/test/simple/test-fs-read-stream.js index b152eed309..026afcb2a0 100644 --- a/test/simple/test-fs-read-stream.js +++ b/test/simple/test-fs-read-stream.js @@ -119,3 +119,8 @@ stream.on('data', function(chunk) { stream.on('end', function() { assert.equal('x', stream.data); }); + +// pause and then resume immediately. +var pauseRes = fs.createReadStream(rangeFile); +pauseRes.pause(); +pauseRes.resume(); From c72ae27be12c9fd609b818cd18a6f75ffc6f6333 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Sat, 19 Feb 2011 16:56:56 -0800 Subject: [PATCH 3/6] test-tls-securepair-server: don't shutdown stdout --- test/simple/test-tls-securepair-server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/simple/test-tls-securepair-server.js b/test/simple/test-tls-securepair-server.js index 4f10488949..ece3c5d01f 100644 --- a/test/simple/test-tls-securepair-server.js +++ b/test/simple/test-tls-securepair-server.js @@ -117,7 +117,7 @@ server.listen(common.PORT, function() { } }); - client.stdout.pipe(process.stdout); + client.stdout.pipe(process.stdout, { end: false }); client.on('exit', function(code) { opensslExitCode = code; From c2a62951f64d5584d76fea5865e9bd94a898ed8b Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Sat, 19 Feb 2011 17:51:32 -0800 Subject: [PATCH 4/6] TLS sockets should not be writable after 'end' Closes GH-694. --- lib/http.js | 3 ++- lib/tls.js | 3 +++ test/disabled/test-https-loop-to-google.js | 31 ++++++++++++++++++++++ test/simple/test-tls-securepair-server.js | 2 -- 4 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 test/disabled/test-https-loop-to-google.js diff --git a/lib/http.js b/lib/http.js index c208990c90..af6a40932b 100644 --- a/lib/http.js +++ b/lib/http.js @@ -1282,7 +1282,8 @@ Agent.prototype._establishNewConnection = function() { // but outgoingFlush instead. if (!req.shouldKeepAlive) { debug('AGENT socket.end()'); - socket.end(); + if (socket.writable) socket.end(); + assert(!socket.writable); } else { debug('AGENT socket keep-alive'); } diff --git a/lib/tls.js b/lib/tls.js index 9760490b61..e27d1aa0ce 100644 --- a/lib/tls.js +++ b/lib/tls.js @@ -553,6 +553,9 @@ SecurePair.prototype._destroy = function() { this._ssl.close(); this._ssl = null; + self.encrypted.writable = self.encrypted.readable = false; + self.cleartext.writable = self.cleartext.readable = false; + process.nextTick(function() { self.encrypted.emit('end'); if (self.encrypted.onend) self.encrypted.onend(); diff --git a/test/disabled/test-https-loop-to-google.js b/test/disabled/test-https-loop-to-google.js new file mode 100644 index 0000000000..dd3bae8c62 --- /dev/null +++ b/test/disabled/test-https-loop-to-google.js @@ -0,0 +1,31 @@ +// Failing test for https + +// Will fail with "socket hang up" for 4 out of 10 requests +// Tested on node 0.5.0-pre commit 9851574 + + +var https = require('https'); + +for(var i = 0; i < 10; ++i) +{ + https.get( + { + host: 'www.google.com', + path: '/accounts/o8/id', + port: 443, + }, function(res) + { + var data = ''; + res.on('data', function(chunk) + { + data += chunk; + }); + res.on('end', function() + { + console.log(res.statusCode); + }); + }).on('error', function(error) + { + console.log(error); + }); +} diff --git a/test/simple/test-tls-securepair-server.js b/test/simple/test-tls-securepair-server.js index ece3c5d01f..86998b65fe 100644 --- a/test/simple/test-tls-securepair-server.js +++ b/test/simple/test-tls-securepair-server.js @@ -52,8 +52,6 @@ var server = net.createServer(function(socket) { socket.on('end', function() { log('socket end'); - pair.cleartext.write('goodbye\r\n'); - pair.cleartext.end(); }); pair.cleartext.on('error', function(err) { From e8aef84191bc2c1ba2bcaa54f30aabde7f03769b Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Sat, 19 Feb 2011 18:45:34 -0800 Subject: [PATCH 5/6] Bump version to v0.4.1 --- AUTHORS | 1 + ChangeLog | 32 +++++++++++++++++++++++++++++++- doc/index.html | 8 ++++---- src/node_version.h | 2 +- wscript | 2 +- 5 files changed, 38 insertions(+), 7 deletions(-) diff --git a/AUTHORS b/AUTHORS index fd81948b70..aeaa3df82f 100644 --- a/AUTHORS +++ b/AUTHORS @@ -161,3 +161,4 @@ Joe Walnes Koichi Kobayashi Daniel Gröber Konstantin Käfer +Richard Rodger diff --git a/ChangeLog b/ChangeLog index 11c29cd359..4b4b7a218a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,36 @@ +2011.02.19, Version 0.4.1 (stable) + +* Fixed field merging with progressive fields on writeHead() + (TJ Holowaychuk) + +* Make the repl respect node_modules folders (isaacs) + +* Fix for DNS fail in HTTP request (Richard Rodger) + +* Default to port 80 for http.request and http.get. + +* Improve V8 support for Cygwin (Bert Belder) + +* Fix fs.open param parsing. (Felix Geisendörfer) + +* Fixed null signal. + +* Fix various HTTP and HTTPS bugs + +* cmake improvements (Tom Hughes) + +* Fix: TLS sockets should not be writable after 'end' + +* Fix os.cpus() on cygwin (Brian White) + +* MinGW: OpenSSL support (Bert Belder) + +* Upgrade V8 to 3.1.5, libev to 4.4. + + 2011.02.10, Version 0.4.0 (stable) -* require() improvements (isaacs) +* require() improvements (isaacs) - understand package.json (isaacs) - look for 'node_modules' dir diff --git a/doc/index.html b/doc/index.html index 797b121b0f..7ae6022187 100644 --- a/doc/index.html +++ b/doc/index.html @@ -20,7 +20,7 @@
  • Download
  • ChangeLog
  • About
  • -
  • v0.4.0 docs
  • +
  • v0.4.1 docs

  • Wiki
  • @@ -90,9 +90,9 @@ net.createServer(function (socket) {

    - 2011.02.10 - node-v0.4.0.tar.gz - (Documentation) + 2011.02.19 + node-v0.4.1.tar.gz + (Documentation)

    Historical: versions, docs

    diff --git a/src/node_version.h b/src/node_version.h index f94feb2626..6b10128378 100644 --- a/src/node_version.h +++ b/src/node_version.h @@ -7,7 +7,7 @@ #define NODE_MAJOR_VERSION 0 #define NODE_MINOR_VERSION 4 #define NODE_PATCH_VERSION 1 -#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 83beea5e97..de5ee45bce 100644 --- a/wscript +++ b/wscript @@ -824,7 +824,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.0' # FIXME should not be hard-coded, see NODE_VERSION_STRING in src/node_version. + , 'VERSION' : '0.4.1' # FIXME should not be hard-coded, see NODE_VERSION_STRING in src/node_version. } return x From e5a472229bbca00d5fa458e5572b11f07b1279e9 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Sat, 19 Feb 2011 19:06:10 -0800 Subject: [PATCH 6/6] Now working on v0.4.2 --- 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 6b10128378..ccce608425 100644 --- a/src/node_version.h +++ b/src/node_version.h @@ -6,8 +6,8 @@ #define NODE_MAJOR_VERSION 0 #define NODE_MINOR_VERSION 4 -#define NODE_PATCH_VERSION 1 -#define NODE_VERSION_IS_RELEASE 1 +#define NODE_PATCH_VERSION 2 +#define NODE_VERSION_IS_RELEASE 0 #ifndef NODE_STRINGIFY #define NODE_STRINGIFY(n) NODE_STRINGIFY_HELPER(n)