diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2013-02-28 19:58:24 +0400 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2013-02-28 19:58:24 +0400 |
commit | cb87920ba9c2871630ff37af6f0131fb1968dc95 (patch) | |
tree | d5e6e18f7b4cdfd184bb18be417b137ff3ad8538 | |
parent | 0c1e7b53d0a33e112107f5387fbde9b2d688fb52 (diff) | |
parent | d87904286024f5ceb6a2d0d5f17e919c775830a0 (diff) |
Merge remote-tracking branch 'origin/v0.8'
Conflicts:
AUTHORS
ChangeLog
deps/uv/src/unix/pipe.c
lib/http.js
src/node_version.h
-rw-r--r-- | AUTHORS | 1 | ||||
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | common.gypi | 1 | ||||
-rw-r--r-- | doc/api/child_process.markdown | 4 | ||||
-rw-r--r-- | doc/blog/release/v0.8.21.md | 86 | ||||
-rw-r--r-- | doc/blog/release/v0.9.10.md | 84 | ||||
-rw-r--r-- | doc/index.html | 4 | ||||
-rw-r--r-- | lib/http.js | 28 | ||||
-rw-r--r-- | src/node_zlib.cc | 21 | ||||
-rw-r--r-- | test/simple/test-http-destroyed-socket-write.js | 11 |
10 files changed, 230 insertions, 23 deletions
@@ -415,3 +415,4 @@ Andy Burke <aburke@bitflood.org> Sugendran Ganess <sugendran@sugendran.net> Jim Schubert <james.schubert@gmail.com> Victor Costan <costan@gmail.com> +Timothy J Fontaine <tjfontaine@gmail.com> diff --git a/ChangeLog b/ChangeLog index 5dd0faedcf2..34d318c8abd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2013.02.25, Version 0.8.21 (Stable) + +* http: Do not free the wrong parser on socket close (isaacs) + +* http: Handle hangup writes more gently (isaacs) + +* zlib: fix assert on bad input (Ben Noordhuis) + +* test: add TAP output to the test runner (Timothy J Fontaine) + +* unix: Handle EINPROGRESS from domain sockets (Ben Noordhuis) + + 2013.02.19, Version 0.9.10 (Unstable) * V8: Upgrade to 3.15.11.15 diff --git a/common.gypi b/common.gypi index 9ecfc4d2a37..72138f36bda 100644 --- a/common.gypi +++ b/common.gypi @@ -121,6 +121,7 @@ 'WarningLevel': 3, 'BufferSecurityCheck': 'true', 'ExceptionHandling': 1, # /EHsc + 'ImageHasSafeExceptionHandlers': 0, # /SAFESEH:NO 'SuppressStartupBanner': 'true', 'WarnAsError': 'false', }, diff --git a/doc/api/child_process.markdown b/doc/api/child_process.markdown index bd04e0e2988..76d42d57017 100644 --- a/doc/api/child_process.markdown +++ b/doc/api/child_process.markdown @@ -6,7 +6,9 @@ Node provides a tri-directional `popen(3)` facility through the `child_process` module. It is possible to stream data through a child's `stdin`, `stdout`, and -`stderr` in a fully non-blocking way. +`stderr` in a fully non-blocking way. (Note that some programs use +line-buffered I/O internally. That doesn't affect node.js but it means +data you send to the child process is not immediately consumed.) To create a child process use `require('child_process').spawn()` or `require('child_process').fork()`. The semantics of each are slightly diff --git a/doc/blog/release/v0.8.21.md b/doc/blog/release/v0.8.21.md new file mode 100644 index 00000000000..7e9539c2d46 --- /dev/null +++ b/doc/blog/release/v0.8.21.md @@ -0,0 +1,86 @@ +date: Mon Feb 25 13:48:51 PST 2013 +version: 0.8.21 +category: release +title: Node v0.8.21 (Stable) +slug: node-v0-8-21-stable + +2013.02.25, Version 0.8.21 (Stable) + +* http: Do not free the wrong parser on socket close (isaacs) + +* http: Handle hangup writes more gently (isaacs) + +* zlib: fix assert on bad input (Ben Noordhuis) + +* test: add TAP output to the test runner (Timothy J Fontaine) + +* unix: Handle EINPROGRESS from domain sockets (Ben Noordhuis) + + +Source Code: http://nodejs.org/dist/v0.8.21/node-v0.8.21.tar.gz + +Macintosh Installer (Universal): http://nodejs.org/dist/v0.8.21/node-v0.8.21.pkg + +Windows Installer: http://nodejs.org/dist/v0.8.21/node-v0.8.21-x86.msi + +Windows x64 Installer: http://nodejs.org/dist/v0.8.21/x64/node-v0.8.21-x64.msi + +Windows x64 Files: http://nodejs.org/dist/v0.8.21/x64/ + +Linux 32-bit Binary: http://nodejs.org/dist/v0.8.21/node-v0.8.21-linux-x86.tar.gz + +Linux 64-bit Binary: http://nodejs.org/dist/v0.8.21/node-v0.8.21-linux-x64.tar.gz + +Solaris 32-bit Binary: http://nodejs.org/dist/v0.8.21/node-v0.8.21-sunos-x86.tar.gz + +Solaris 64-bit Binary: http://nodejs.org/dist/v0.8.21/node-v0.8.21-sunos-x64.tar.gz + +Other release files: http://nodejs.org/dist/v0.8.21/ + +Website: http://nodejs.org/docs/v0.8.21/ + +Documentation: http://nodejs.org/docs/v0.8.21/api/ + +Shasums: +``` +383b9009a587b7390a5a00cef4ece441fb16dd82 node-v0.8.21-darwin-x64.tar.gz +47654ca8ecc93c846e6f7493a19931b99d5e4b87 node-v0.8.21-darwin-x86.tar.gz +46d66f3b95f447811e9253d66050859b4bb81ea0 node-v0.8.21-linux-x64.tar.gz +1f16e50dacd5e942970c28be1e578e6260a116c4 node-v0.8.21-linux-x86.tar.gz +b24b5e0acc53f004122c0cb2df775c4493b1e048 node-v0.8.21-sunos-x64.tar.gz +54ca0c94dff35e941fe90d10755427a15d6519ae node-v0.8.21-sunos-x86.tar.gz +38c5855c1ebd70fde111d50343a163a03cff9765 node-v0.8.21-x86.msi +60cd1fb8f43943bd3ed7c07745df1b3e81bafc13 node-v0.8.21.pkg +8b75377eafb5e77d6dff141c9533202d5a589ce4 node-v0.8.21.tar.gz +c310779c80d21be7556ec0921d5afca8f64792eb node.exe +61b98f9dfbe70184788b6f010ce7667c9cba0fdc node.exp +78c37ac837bbb8fefd691e351b3c20f136b212ee node.lib +40cc197db5c9fc4ded4509b5ae21bc53d178998e node.pdb +ec29a824e51308349f7895c010469f8e59939094 x64/node-v0.8.21-x64.msi +e4c5563c38a01dac1a97f6366175d1fef86da262 x64/node.exe +8e51783d5e03148f01db8386102e4ffc4e30deda x64/node.exp +a6017052052bb469a50327b4f40c990c25da0932 x64/node.lib +fb8d24e5208b14d35997bc3b46e325316e6ad94d x64/node.pdb +``` + +Shasums: +``` +62cd69928ce2da9e8512b3efb96aba353ee54a91 node-v0.8.21-darwin-x64.tar.gz +62cf9b990f8e424e7fdb1d50a46d779e4d508b23 node-v0.8.21-darwin-x86.tar.gz +83e92aec4f4a0167e7c5b3ef04388fc33712d97b node-v0.8.21-linux-x64.tar.gz +83a8aa10dafa196b372958d1052f61fe1c16c2a4 node-v0.8.21-linux-x86.tar.gz +588830b0d095c0ef3583d9f7f574426f5b456e2e node-v0.8.21-sunos-x64.tar.gz +e4eff5914432da3cf12a833aaa0444693671cca1 node-v0.8.21-sunos-x86.tar.gz +8146b2254caa814157aa511075dcf7b42d0ecb59 node-v0.8.21-x86.msi +60cd1fb8f43943bd3ed7c07745df1b3e81bafc13 node-v0.8.21.pkg +65ab7307f1aee12be4c88e396e2510967a52b1c6 node-v0.8.21.tar.gz +5d770ad554ee4a73278b2d90029e758e0a676074 node.exe +17514f32c57c64bd0d367c71ed0e6dc399fc9e12 node.exp +9404eff8562dfb0a6e0e72167278ac6131be5d3a node.lib +94908174f715d2707d48e6d53a1f96f33059f56c node.pdb +36750abf56120a63d9fa9b2b75bdc98dfac051f7 x64/node-v0.8.21-x64.msi +b61b9620e936bc9c19043a02625aed9922aeb653 x64/node.exe +21a0e855e652e7fbe84e7efc1f7a3542fa870372 x64/node.exp +f9d017c07030599e3442a958020381a37402dc81 x64/node.lib +3b35fbac0962aaff46bdd2f06412dcb1f80b9895 x64/node.pdb +``` diff --git a/doc/blog/release/v0.9.10.md b/doc/blog/release/v0.9.10.md new file mode 100644 index 00000000000..d0454bf55b0 --- /dev/null +++ b/doc/blog/release/v0.9.10.md @@ -0,0 +1,84 @@ +category: release +date: Tue Feb 19 14:00:08 PST 2013 +slug: node-v0-9-10-unstable +title: Node v0.9.10 (Unstable) +version: 0.9.10 + +2013.02.19, Version 0.9.10 (Unstable) + +* V8: Upgrade to 3.15.11.15 + +* npm: Upgrade to 1.2.12 + +* fs: Change default WriteStream config, increase perf (isaacs) + +* process: streamlining tick callback logic (Trevor Norris) + +* stream_wrap, udp_wrap: add read-only fd property (Ben Noordhuis) + +* buffer: accept negative indices in Buffer#slice() (Ben Noordhuis) + +* tls: Cycle data when underlying socket drains (isaacs) + +* stream: read(0) should not always trigger _read(n,cb) (isaacs) + +* stream: Empty strings/buffers do not signal EOF any longer (isaacs) + +* crypto: improve cipher/decipher error messages (Ben Noordhuis) + +* net: Respect the 'readable' flag on sockets (isaacs) + +* net: don't suppress ECONNRESET (Ben Noordhuis) + +* typed arrays: copy Buffer in typed array constructor (Ben Noordhuis) + +* typed arrays: make DataView throw on non-ArrayBuffer (Ben Noordhuis) + +* windows: MSI installer enhancements (Scott Blomquist, Jim Schubert) + + +Source Code: http://nodejs.org/dist/v0.9.10/node-v0.9.10.tar.gz + +Macintosh Installer (Universal): http://nodejs.org/dist/v0.9.10/node-v0.9.10.pkg + +Windows Installer: http://nodejs.org/dist/v0.9.10/node-v0.9.10-x86.msi + +Windows x64 Installer: http://nodejs.org/dist/v0.9.10/x64/node-v0.9.10-x64.msi + +Windows x64 Files: http://nodejs.org/dist/v0.9.10/x64/ + +Linux 32-bit Binary: http://nodejs.org/dist/v0.9.10/node-v0.9.10-linux-x86.tar.gz + +Linux 64-bit Binary: http://nodejs.org/dist/v0.9.10/node-v0.9.10-linux-x64.tar.gz + +Solaris 32-bit Binary: http://nodejs.org/dist/v0.9.10/node-v0.9.10-sunos-x86.tar.gz + +Solaris 64-bit Binary: http://nodejs.org/dist/v0.9.10/node-v0.9.10-sunos-x64.tar.gz + +Other release files: http://nodejs.org/dist/v0.9.10/ + +Website: http://nodejs.org/docs/v0.9.10/ + +Documentation: http://nodejs.org/docs/v0.9.10/api/ + +Shasums: +``` +813d5f42b156b7d64f00b86e13d26ada3ef352e5 node-v0.9.10-darwin-x64.tar.gz +99dbe66fd0fc176fb3459ffcf62212dcb27bef10 node-v0.9.10-darwin-x86.tar.gz +3a5a465238cbdbdac9786c204fd27be61ce7159a node-v0.9.10-linux-x64.tar.gz +3340ac206ec1a1f827c954efdfa1351dcfe9f419 node-v0.9.10-linux-x86.tar.gz +b920b2e57c6df1e080966fdeccbfd1b384b156d4 node-v0.9.10-sunos-x64.tar.gz +9c1744352bb1bc71f48f8aea1aff6aeefe35a394 node-v0.9.10-sunos-x86.tar.gz +f1daaafc330cc9993a3a6f7ca8b9cc870b49e75c node-v0.9.10-x86.msi +2b6c70f57c1513e8f5151785b1ac263565983918 node-v0.9.10.pkg +265542c15cf939b7c71a545758d835ed44d791d3 node-v0.9.10.tar.gz +653f24d53f411217d57ed18d73921ff4721f00dd node.exe +7d62da67a7b33628d7d90c9d5037cf564dfc5ce4 node.exp +cfebbcd81db602b2f051328a9924e19ca2cb6235 node.lib +a31694cb9e03d13a616f3cc634852d8dc98e69b8 node.pdb +5f94c1cc9301a8b85082fee7549aa376aedd8ec5 x64/node-v0.9.10-x64.msi +7716c01ce60f7c65100cc405726badf8476afebd x64/node.exe +121d4a721968ba4631d29de07e5d6c326d259b4b x64/node.exp +17f651000f6b0c840efe539ae5257cb894481c49 x64/node.lib +d04242a5ec3a3104931ec8de6a846a8f7746b1fd x64/node.pdb +``` diff --git a/doc/index.html b/doc/index.html index a9a8546bd64..9368d5f5a52 100644 --- a/doc/index.html +++ b/doc/index.html @@ -89,7 +89,9 @@ http.createServer(function (req, res) { }).listen(1337, '127.0.0.1'); console.log('Server running at http://127.0.0.1:1337/');</pre> - <p>To run the server, put the code into a file <code>example.js</code> and execute it with the <code>node</code> program:</p> + <p>To run the server, put the code into a file + <code>example.js</code> and execute it with the + <code>node</code> program from the command line:</p> <pre class="sh_none"> % node example.js Server running at http://127.0.0.1:1337/</pre> diff --git a/lib/http.js b/lib/http.js index e7299cc33be..e5c709da0f9 100644 --- a/lib/http.js +++ b/lib/http.js @@ -437,6 +437,7 @@ function OutgoingMessage() { this._trailer = ''; this.finished = false; + this._hangupClose = false; } util.inherits(OutgoingMessage, Stream); @@ -491,14 +492,24 @@ OutgoingMessage.prototype._writeRaw = function(data, encoding) { return this.connection.write(data, encoding); } else if (this.connection && this.connection.destroyed) { // The socket was destroyed. If we're still trying to write to it, - // then something bad happened. - // If we've already raised an error on this message, then just ignore. - // XXX This was necessary in v0.8, but in v0.10, we no longer ignore - // ECONNRESET anyway. Is this still required? - if (!this._hadError) { - this.emit('error', createHangUpError()); - this._hadError = true; + // then something bad happened, but it could be just that we haven't + // gotten the 'close' event yet. + // + // In v0.10 and later, this isn't a problem, since ECONNRESET isn't + // ignored in the first place. We'll probably emit 'close' on the + // next tick, but just in case it's not coming, set a timeout that + // will emit it for us. + if (!this._hangupClose) { + this._hangupClose = true; + var socket = this.socket; + var timer = setTimeout(function() { + socket.emit('close'); + }); + socket.on('close', function() { + clearTimeout(timer); + }); } + return false; } else { // buffer, as long as we're not destroyed. this._buffer(data, encoding); @@ -1810,7 +1821,8 @@ function connectionListener(socket) { function serverSocketCloseListener() { debug('server socket close'); // mark this parser as reusable - freeParser(parser); + if (this.parser) + freeParser(this.parser); abortIncoming(); } diff --git a/src/node_zlib.cc b/src/node_zlib.cc index 82debb438b7..ebaba6bb114 100644 --- a/src/node_zlib.cc +++ b/src/node_zlib.cc @@ -59,7 +59,22 @@ void InitZlib(v8::Handle<v8::Object> target); class ZCtx : public ObjectWrap { public: - ZCtx(node_zlib_mode mode) : ObjectWrap(), dictionary_(NULL), mode_(mode) {} + ZCtx(node_zlib_mode mode) + : ObjectWrap() + , init_done_(false) + , level_(0) + , windowBits_(0) + , memLevel_(0) + , strategy_(0) + , err_(0) + , dictionary_(NULL) + , dictionary_len_(0) + , flush_(0) + , chunk_size_(0) + , write_in_progress_(false) + , mode_(mode) + { + } ~ZCtx() { @@ -108,6 +123,7 @@ class ZCtx : public ObjectWrap { assert(!ctx->write_in_progress_ && "write already in progress"); ctx->write_in_progress_ = true; + ctx->Ref(); assert(!args[0]->IsUndefined() && "must provide flush value"); @@ -167,8 +183,6 @@ class ZCtx : public ObjectWrap { ZCtx::Process, ZCtx::After); - ctx->Ref(); - return ctx->handle_; } @@ -283,6 +297,7 @@ class ZCtx : public ObjectWrap { MakeCallback(ctx->handle_, onerror_sym, ARRAY_SIZE(args), args); // no hope of rescue. + ctx->write_in_progress_ = false; ctx->Unref(); } diff --git a/test/simple/test-http-destroyed-socket-write.js b/test/simple/test-http-destroyed-socket-write.js index c5629871018..b2498fd8aaf 100644 --- a/test/simple/test-http-destroyed-socket-write.js +++ b/test/simple/test-http-destroyed-socket-write.js @@ -75,15 +75,6 @@ server.listen(common.PORT, function() { var writes = 0; var sawFalseWrite; - var gotError = false; - sec.on('error', function(er) { - assert.equal(gotError, false); - gotError = true; - assert(er.code === 'ECONNRESET'); - clearTimeout(timer); - test(); - }); - function write() { if (++writes === 64) { clearTimeout(timer); @@ -121,7 +112,7 @@ server.listen(common.PORT, function() { console.error('bad happened', sec.output, sec.outputEncodings); assert.equal(sec.output.length, 0); assert.equal(sec.outputEncodings, 0); - assert(gotError); + assert(sawFalseWrite); assert(gotFirstResponse); assert(gotFirstData); assert(gotFirstEnd); |