From: isaacs Date: Thu, 7 Feb 2013 00:29:30 +0000 (-0800) Subject: Merge remote-tracking branch 'ry/v0.8' into master X-Git-Tag: v0.9.9~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5cc3569f6d50560cec1c2dab17b9fb251d26a5df;p=platform%2Fupstream%2Fnodejs.git Merge remote-tracking branch 'ry/v0.8' into master Conflicts: AUTHORS ChangeLog deps/npm/html/api/bin.html deps/npm/html/api/bugs.html deps/npm/html/api/commands.html deps/npm/html/api/config.html deps/npm/html/api/deprecate.html deps/npm/html/api/docs.html deps/npm/html/api/edit.html deps/npm/html/api/explore.html deps/npm/html/api/help-search.html deps/npm/html/api/init.html deps/npm/html/api/install.html deps/npm/html/api/link.html deps/npm/html/api/load.html deps/npm/html/api/ls.html deps/npm/html/api/npm.html deps/npm/html/api/outdated.html deps/npm/html/api/owner.html deps/npm/html/api/pack.html deps/npm/html/api/prefix.html deps/npm/html/api/prune.html deps/npm/html/api/publish.html deps/npm/html/api/rebuild.html deps/npm/html/api/restart.html deps/npm/html/api/root.html deps/npm/html/api/run-script.html deps/npm/html/api/search.html deps/npm/html/api/shrinkwrap.html deps/npm/html/api/start.html deps/npm/html/api/stop.html deps/npm/html/api/submodule.html deps/npm/html/api/tag.html deps/npm/html/api/test.html deps/npm/html/api/uninstall.html deps/npm/html/api/unpublish.html deps/npm/html/api/update.html deps/npm/html/api/version.html deps/npm/html/api/view.html deps/npm/html/api/whoami.html deps/npm/html/doc/README.html deps/npm/html/doc/adduser.html deps/npm/html/doc/bin.html deps/npm/html/doc/bugs.html deps/npm/html/doc/build.html deps/npm/html/doc/bundle.html deps/npm/html/doc/cache.html deps/npm/html/doc/changelog.html deps/npm/html/doc/coding-style.html deps/npm/html/doc/completion.html deps/npm/html/doc/config.html deps/npm/html/doc/dedupe.html deps/npm/html/doc/deprecate.html deps/npm/html/doc/developers.html deps/npm/html/doc/disputes.html deps/npm/html/doc/docs.html deps/npm/html/doc/edit.html deps/npm/html/doc/explore.html deps/npm/html/doc/faq.html deps/npm/html/doc/folders.html deps/npm/html/doc/global.html deps/npm/html/doc/help-search.html deps/npm/html/doc/help.html deps/npm/html/doc/index.html deps/npm/html/doc/init.html deps/npm/html/doc/install.html deps/npm/html/doc/json.html deps/npm/html/doc/link.html deps/npm/html/doc/ls.html deps/npm/html/doc/npm.html deps/npm/html/doc/outdated.html deps/npm/html/doc/owner.html deps/npm/html/doc/pack.html deps/npm/html/doc/prefix.html deps/npm/html/doc/prune.html deps/npm/html/doc/publish.html deps/npm/html/doc/rebuild.html deps/npm/html/doc/registry.html deps/npm/html/doc/removing-npm.html deps/npm/html/doc/restart.html deps/npm/html/doc/rm.html deps/npm/html/doc/root.html deps/npm/html/doc/run-script.html deps/npm/html/doc/scripts.html deps/npm/html/doc/search.html deps/npm/html/doc/semver.html deps/npm/html/doc/shrinkwrap.html deps/npm/html/doc/star.html deps/npm/html/doc/start.html deps/npm/html/doc/stop.html deps/npm/html/doc/submodule.html deps/npm/html/doc/tag.html deps/npm/html/doc/test.html deps/npm/html/doc/uninstall.html deps/npm/html/doc/unpublish.html deps/npm/html/doc/update.html deps/npm/html/doc/version.html deps/npm/html/doc/view.html deps/npm/html/doc/whoami.html deps/npm/man/man1/global.1 deps/npm/man/man1/ls.1 deps/npm/man/man1/npm.1 deps/npm/man/man1/rm.1 deps/npm/man/man3/npm.3 deps/npm/node_modules/glob/glob.js deps/npm/node_modules/glob/package.json deps/npm/node_modules/node-gyp/package.json deps/npm/node_modules/npm-registry-client/package.json deps/npm/node_modules/npmconf/package.json deps/npm/node_modules/read-installed/package.json deps/npm/node_modules/rimraf/package.json deps/npm/node_modules/rimraf/rimraf.js deps/npm/package.json deps/uv/src/win/error.c doc/api/crypto.markdown lib/zlib.js src/node_version.h src/node_zlib.cc test/simple/test-buffer.js --- 5cc3569f6d50560cec1c2dab17b9fb251d26a5df diff --cc AUTHORS index 3426826,c069846..96b07b7 --- a/AUTHORS +++ b/AUTHORS @@@ -387,24 -377,5 +387,26 @@@ Tim Bradshaw Chris Dent Dan Milon +Brandon Philips +Frederico Silva +Jan Wynholds +Girish Ramakrishnan +Anthony Pesch +Stephen Gallagher +Sergey Kholodilov +Tim Kuijsten +Michael Axiak +Chad Rhyner +Ben Taber +Luke Arduini +Luke Bayes +Nirk Niggler +James Hight +Mike Harsch +Alexandr Emelin +James Campos +Dave Olszewski +Tim Price +Jake Verbaten + Jacob Gable + Rick Yakubowski diff --cc ChangeLog index 0b49f9c,59d86d0..c3bde67 --- a/ChangeLog +++ b/ChangeLog @@@ -1,332 -1,24 +1,353 @@@ -2013.02.06, Version 0.8.19 (Stable) +2013.01.24, Version 0.9.8 (Unstable) + +* npm: Upgrade to v1.2.3 + +* V8: Upgrade to 3.15.11.10 + +* streams: Support objects other than Buffers (Jake Verbaten) + +* buffer: remove float write range checks (Trevor Norris) + +* http: close connection on 304/204 responses with chunked encoding (Ben Noordhuis) + +* build: fix build with dtrace support on FreeBSD (Fedor Indutny) + +* console: Support formatting options in trace() (isaacs) + +* domain: empty stack on all exceptions (Dave Olszewski) + +* unix, windows: make uv_*_bind() error codes consistent (Andrius Bentkus) + +* linux: add futimes() fallback (Ben Noordhuis) + + +2013.01.18, Version 0.9.7 (Unstable), 9e7bebeb8305edd55735a95955a98fdbe47572e5 + +* V8: Upgrade to 3.15.11.7 + +* npm: Upgrade to 1.2.2 + +* punycode: Upgrade to 1.2.0 (Mathias Bynens) + +* repl: make built-in modules available by default (Felix Böhm) + +* windows: add support for '_Total' perf counters (Scott Blomquist) + +* cluster: make --prof work for workers (Ben Noordhuis) + +* child_process: do not keep list of sent sockets (Fedor Indutny) + +* tls: Follow RFC6125 more strictly (Fedor Indutny) + +* buffer: floating point read/write improvements (Trevor Norris) + +* TypedArrays: Improve dataview perf without endian param (Dean McNamee) + +* module: assert require() called with a non-empty string (Felix Böhm, James Campos) + +* stdio: Set readable/writable flags properly (isaacs) + +* stream: Properly handle large reads from push-streams (isaacs) + + +2013.01.11, Version 0.9.6 (Unstable), 9313fdc71ca8335d5e3a391c103230ee6219b3e2 + +* V8: update to 3.15.11.5 + +* node: remove ev-emul.h (Ben Noordhuis) + +* path: make basename and extname ignore trailing slashes (Bert Belder) + +* typed arrays: fix sunos signed/unsigned char issue (Ben Noordhuis) + +* child_process: Fix {stdio:'inherit'} regression (Ben Noordhuis) + +* child_process: Fix pipe() from child stdio streams (Maciej Małecki) + +* child_process: make fork() execPath configurable (Bradley Meck) + +* stream: Add readable.push(chunk) method (isaacs) + +* dtrace: x64 ustack helper (Fedor Indutny) + +* repl: fix floating point number parsing (Nirk Niggler) + +* repl: allow overriding builtins (Ben Noordhuis) + +* net: add localAddress and localPort to Socket (James Hight) + +* fs: make pool size coincide with ReadStream bufferSize (Shigeki Ohtsu) + +* typed arrays: implement load and store swizzling (Dean McNamee) + +* windows: fix perfctr crash on XP and 2003 (Scott Blomquist) + +* dgram: fix double implicit bind error (Ben Noordhuis) + + +2012.12.30, Version 0.9.5 (Unstable), 01994e8119c24f2284bac0779b32acb49c95bee7 + +* assert: improve support for new execution contexts (lukebayes) + +* domain: use camelCase instead of snake_case (isaacs) + +* domain: Do not use uncaughtException handler (isaacs) + +* fs: make 'end' work with ReadStream without 'start' (Ben Noordhuis) + +* https: optimize createConnection() (Ryunosuke SATO) + +* buffer: speed up base64 encoding by 20% (Ben Noordhuis) + +* doc: Colorize API stabilitity index headers in docs (Luke Arduini) + +* net: socket.readyState corrections (bentaber) + +* http: Performance enhancements for http under streams2 (isaacs) + +* stream: fix to emit end event on http.ClientResponse (Shigeki Ohtsu) + +* stream: fix event handler leak in readstream pipe and unpipe (Andreas Madsen) + +* build: Support ./configure --tag switch (Maciej Małecki) + +* repl: don't touch `require.cache` (Nathan Rajlich) + +* node: Emit 'exit' event when exiting for an uncaught exception (isaacs) + + +2012.12.21, Version 0.9.4 (Unstable), d86d83c75f6343b5368bb7bd328b4466a035e1d4 + +* streams: Update all streaming interfaces to use new classes (isaacs) + +* node: remove idle gc (Ben Noordhuis) + +* http: protect against response splitting attacks (Bert Belder) + +* fs: Raise error when null bytes detected in paths (isaacs) + +* fs: fix 'object is not a function' callback errors (Ben Noordhuis) + +* fs: add autoClose=true option to fs.createReadStream (Farid Neshat) + +* process: add getgroups(), setgroups(), initgroups() (Ben Noordhuis) + +* openssl: optimized asm code on x86 and x64 (Bert Belder) + +* crypto: fix leak in GetPeerCertificate (Fedor Indutny) + +* add systemtap support (Jan Wynholds) + +* windows: add ETW and PerfCounters support (Scott Blomquist) + +* windows: fix normalization of UNC paths (Bert Belder) + +* crypto: fix ssl error handling (Sergey Kholodilov) + +* node: remove eio-emul.h (Ben Noordhuis) + +* os: add os.endianness() function (Nathan Rajlich) + +* readline: don't emit "line" events with a trailing '\n' char (Nathan Rajlich) + +* build: add configure option to generate xcode build files (Timothy J Fontaine) + +* build: allow linking against system libuv, cares, http_parser (Stephen Gallagher) + +* typed arrays: add slice() support to ArrayBuffer (Anthony Pesch) + +* debugger: exit and kill child on SIGTERM or SIGHUP (Fedor Indutny) + +* url: url.format escapes delimiters in path and query (J. Lee Coltrane) + + +2012.10.24, Version 0.9.3 (Unstable), 1ed4c6776e4f52956918b70565502e0f8869829d + +* V8: Upgrade to 3.13.7.4 + +* crypto: Default to buffers instead of binary strings (isaacs, Fedor Indutny) + +* crypto: add getHashes() and getCiphers() (Ben Noordhuis) + +* unix: add custom thread pool, remove libeio (Ben Noordhuis) + +* util: make `inspect()` accept an "options" argument (Nathan Rajlich) + +* https: fix renegotation attack protection (Ben Noordhuis) + +* cluster: make 'listening' handler see actual port (Aaditya Bhatia) + +* windows: use USERPROFILE to get the user's home dir (Bert Belder) + +* path: add platform specific path delimiter (Paul Serby) + +* http: add response.headersSent property (Pavel Lang) + +* child_process: make .fork()'d child auto-exit (Ben Noordhuis) + +* events: add 'removeListener' event (Ben Noordhuis) + +* string_decoder: Add 'end' method, do base64 properly (isaacs) + +* buffer: include encoding value in exception when invalid (Ricky Ng-Adam) + +* http: make http.ServerResponse no longer emit 'end' (isaacs) + +* streams: fix pipe is destructed by 'end' from destination (koichik) + + +2012.09.17, Version 0.9.2 (Unstable), 6e2055889091a424fbb5c500bc3ab9c05d1c28b4 + +* http_parser: upgrade to ad3b631 + +* openssl: upgrade 1.0.1c + +* darwin: use FSEvents to watch directory changes (Fedor Indutny) + +* unix: support missing API on NetBSD (Shigeki Ohtsu) + +* unix: fix EMFILE busy loop (Ben Noordhuis) + +* windows: un-break writable tty handles (Bert Belder) + +* windows: map WSAESHUTDOWN to UV_EPIPE (Bert Belder) + +* windows: make spawn with custom environment work again (Bert Belder) + +* windows: map ERROR_DIRECTORY to UV_ENOENT (Bert Belder) + +* tls, https: validate server certificate by default (Ben Noordhuis) + +* tls, https: throw exception on missing key/cert (Ben Noordhuis) + +* tls: async session storage (Fedor Indutny) + +* installer: don't install header files (Ben Noordhuis) + +* buffer: implement Buffer.prototype.toJSON() (Nathan Rajlich) + +* buffer: added support for writing NaN and Infinity (koichik) + +* http: make http.ServerResponse emit 'end' (Ben Noordhuis) + +* build: ./configure --ninja (Ben Noordhuis, Timothy J Fontaine) + +* installer: fix --without-npm (Ben Noordhuis) + +* cli: make -p equivalent to -pe (Ben Noordhuis) + +* url: Go much faster by using Url class (isaacs) + + +2012.08.28, Version 0.9.1 (Unstable), e6ce259d2caf338fec991c2dd447de763ce99ab7 + +* buffer: Add Buffer.isEncoding(enc) to test for valid encoding values (isaacs) + +* Raise UV_ECANCELED on premature close. (Ben Noordhuis) + +* Remove c-ares from libuv, move to a top-level node dependency (Bert Belder) + +* ref/unref for all HandleWraps, timers, servers, and sockets (Timothy J Fontaine) + +* addon: remove node-waf, superseded by node-gyp (Ben Noordhuis) + +* child_process: emit error on exec failure (Ben Noordhuis) + +* cluster: do not use internal server API (Andreas Madsen) + +* constants: add O_DIRECT (Ian Babrou) + +* crypto: add sync interface to crypto.pbkdf2() (Ben Noordhuis) + +* darwin: emulate fdatasync() (Fedor Indutny) + +* dgram: make .bind() always asynchronous (Ben Noordhuis) + +* events: Make emitter.listeners() side-effect free (isaacs, Joe Andaverde) + +* fs: Throw early on invalid encoding args (isaacs) + +* fs: fix naming of truncate/ftruncate functions (isaacs) + +* http: bubble up parser errors to ClientRequest (Brian White) + +* linux: improve cpuinfo parser on ARM and MIPS (Ben Noordhuis) + +* net: add support for IPv6 addresses ending in :: (Josh Erickson) + +* net: support Server.listen(Pipe) (Andreas Madsen) + +* node: don't scan add-on for "init" symbol (Ben Noordhuis) + +* remove process.uvCounters() (Ben Noordhuis) + +* repl: console writes to repl rather than process stdio (Nathan Rajlich) + +* timers: implement setImmediate (Timothy J Fontaine) + +* tls: fix segfault in pummel/test-tls-ci-reneg-attack (Ben Noordhuis) + +* tools: Move gyp addon tools to node-gyp (Nathan Rajlich) + +* unix: preliminary signal handler support (Ben Noordhuis) + +* unix: remove dependency on ev_child (Ben Noordhuis) + +* unix: work around darwin bug, don't poll() on pipe (Fedor Indutny) + +* util: Formally deprecate util.pump() (Ben Noordhuis) + +* windows: make active and closing handle state independent (Bert Belder) + +* windows: report spawn errors to the exit callback (Bert Belder) + +* windows: signal handling support with uv_signal_t (Bert Belder) + + +2012.07.20, Version 0.9.0 (Unstable), f9b237f478c372fd55e4590d7399dcd8f25f3603 + +* punycode: update to v1.1.1 (Mathias Bynens) + +* c-ares: upgrade to 1.9.0 (Saúl Ibarra Corretgé) + +* dns: ignore rogue DNS servers reported by windows (Saúl Ibarra Corretgé) + +* unix: speed up uv_async_send() (Ben Noordhuis) + +* darwin: get cpu model correctly on mac (Xidorn Quan) + +* nextTick: Handle tick callbacks before any other I/O (isaacs) + +* Enable color customization of `util.inspect` (Pavel Lang) + +* tls: Speed and memory improvements (Fedor Indutny) + +* readline: Use one history item for reentered line (Vladimir Beloborodov) + +* Fix #3521 Make process.env more like a regular Object (isaacs) + + ++2013.02.06, Version 0.8.19 (Stable), 53978bdf420622ff0121c63c0338c9e7c2e60869 + + * npm: Upgrade to v1.2.10 + + * zlib: pass object size hint to V8 (Ben Noordhuis) + + * zlib: reduce memory consumption, release early (Ben Noordhuis) + + * buffer: slow buffer copy compatibility fix (Trevor Norris) + + * zlib: don't assert on malformed dictionary (Ben Noordhuis) + + * zlib: don't assert on missing dictionary (Ben Noordhuis) + + * windows: better ipv6 support (Bert Belder) + + * windows: add error mappings related to unsupported protocols (Bert Belder) + + * windows: map ERROR_DIRECTORY to UV_ENOENT (Bert Belder) + + 2013.01.18, Version 0.8.18 (Stable), 2c4eef0d972838c51999d32c0d251857a713dc18 * npm: Upgrade to v1.2.2 diff --cc lib/zlib.js index bc3e933,b0826a8..e81559d --- a/lib/zlib.js +++ b/lib/zlib.js @@@ -164,7 -153,15 +164,8 @@@ function zlibBuffer(engine, buffer, cal var buf = Buffer.concat(buffers, nread); buffers = []; callback(null, buf); - engine._clear(); ++ engine.close(); } - - engine.on('error', onError); - engine.on('data', onData); - engine.on('end', onEnd); - - engine.write(buffer); - engine.end(); } diff --cc src/node_buffer.cc index be4d815,3f8ebef..ce252f6 --- a/src/node_buffer.cc +++ b/src/node_buffer.cc @@@ -415,19 -405,21 +415,19 @@@ Handle Buffer::Copy(const Argume Buffer *source = ObjectWrap::Unwrap(args.This()); if (!Buffer::HasInstance(args[0])) { - return ThrowException(Exception::TypeError(String::New( - "First arg should be a Buffer"))); + return ThrowTypeError("First arg should be a Buffer"); } - Local target = args[0]->ToObject(); + Local target = args[0]; char* target_data = Buffer::Data(target); size_t target_length = Buffer::Length(target); - size_t target_start = args[1]->Uint32Value(); - size_t source_start = args[2]->Uint32Value(); - size_t source_end = args[3]->IsUint32() ? args[3]->Uint32Value() - : source->length_; + size_t target_start = args[1]->IsUndefined() ? 0 : args[1]->Uint32Value(); + size_t source_start = args[2]->IsUndefined() ? 0 : args[2]->Uint32Value(); + size_t source_end = args[3]->IsUndefined() ? source->length_ + : args[3]->Uint32Value(); if (source_end < source_start) { - return ThrowException(Exception::Error(String::New( - "sourceEnd < sourceStart"))); + return ThrowRangeError("sourceEnd < sourceStart"); } // Copy 0 bytes; we're done diff --cc test/simple/test-buffer.js index c367c41,11165f8..cb1fc97 --- a/test/simple/test-buffer.js +++ b/test/simple/test-buffer.js @@@ -118,76 -72,63 +118,85 @@@ for (var i = 0; i < c.length; i++) } // copy 768 bytes from b into b +b.fill(++cntr); +b.fill(++cntr, 256); var copied = b.copy(b, 0, 256, 1024); -console.log('copied ' + copied + ' bytes from b into c'); +console.log('copied %d bytes from b into b', copied); assert.strictEqual(768, copied); -for (var i = 0; i < c.length; i++) { - assert.equal(i % 256, c[i]); +for (var i = 0; i < b.length; i++) { + assert.strictEqual(cntr, b[i]); } - // copy from b to c with negative targetStart - b.fill(++cntr); - c.fill(++cntr); - var copied = b.copy(c, -1); - console.log('copied %d bytes from b into c w/ negative targetStart', copied); - assert.strictEqual(c.length, copied); - for (var i = 0; i < c.length; i++) { - assert.strictEqual(b[i], c[i]); ++ + // copy from fast to slow buffer + var sb = new SlowBuffer(b.length); + var copied = b.copy(sb); + console.log('copied %d bytes from b into sb'); + for (var i = 0; i < sb.length; i++) { + assert.strictEqual(sb[i], b[i]); + } + + var caught_error = null; + + // try to copy from before the beginning of b + caught_error = null; + try { + var copied = b.copy(c, 0, 100, 10); + } catch (err) { + caught_error = err; } -assert.strictEqual('sourceEnd < sourceStart', caught_error.message); -// try to copy to before the beginning of c -caught_error = null; -try { - var copied = b.copy(c, -1, 0, 10); -} catch (err) { - caught_error = err; +// copy from b to c with negative sourceStart +b.fill(++cntr); +c.fill(++cntr); +var copied = b.copy(c, 0, -1); +assert.strictEqual(c.length, copied); +console.log('copied %d bytes from b into c w/ negative sourceStart', copied); +for (var i = 0; i < c.length; i++) { + assert.strictEqual(b[i], c[i]); } -assert.strictEqual('targetStart out of bounds', caught_error.message); -// try to copy to after the end of c -caught_error = null; -try { - var copied = b.copy(c, 512, 0, 10); -} catch (err) { - caught_error = err; +// check sourceEnd resets to targetEnd if former is greater than the latter +b.fill(++cntr); +c.fill(++cntr); +var copied = b.copy(c, 0, 0, 1025); +console.log('copied %d bytes from b into c', copied); +for (var i = 0; i < c.length; i++) { + assert.strictEqual(b[i], c[i]); } -assert.strictEqual('targetStart out of bounds', caught_error.message); -// try to copy starting before the beginning of b -caught_error = null; -try { - var copied = b.copy(c, 0, -1, 1); -} catch (err) { - caught_error = err; +// copy from fast buffer to slow buffer without parameters +var sb = new SlowBuffer(b.length); +sb.fill(++cntr, 0, sb.length); +b.fill(++cntr); +var copied = b.copy(sb); +console.log('copied %d bytes from fast buffer to slow buffer', copied); +for (var i = 0 ; i < b.length; i++) { + assert.strictEqual(b[i], sb[i]); } -assert.strictEqual('sourceStart out of bounds', caught_error.message); -// try to copy starting after the end of b +// throw with negative sourceEnd +console.log('test copy at negative sourceEnd'); +assert.throws(function() { + b.copy(c, 0, 0, -1); +}, RangeError); + +// throw when sourceStart is greater than sourceEnd +assert.throws(function() { + b.copy(c, 0, 100, 10); +}, RangeError); + +// throw attempting to copy after end of c +assert.throws(function() { + b.copy(c, 512, 0, 10); +}, RangeError); + +var caught_error; + +// invalid encoding for Buffer.toString caught_error = null; try { - var copied = b.copy(c, 0, 1024, 1025); + var copied = b.toString('invalid'); } catch (err) { caught_error = err; }