Merge remote-tracking branch 'ry/v0.10'
authorisaacs <i@izs.me>
Thu, 28 Mar 2013 20:11:04 +0000 (13:11 -0700)
committerisaacs <i@izs.me>
Thu, 28 Mar 2013 20:11:04 +0000 (13:11 -0700)
Conflicts:
src/node.cc
src/node_version.h

53 files changed:
AUTHORS
ChangeLog
deps/npm/doc/cli/disputes.md
deps/npm/html/doc/disputes.html
deps/npm/lib/cache.js
deps/npm/man/man1/disputes.1
deps/npm/node_modules/lru-cache/README.md
deps/npm/node_modules/lru-cache/lib/lru-cache.js
deps/npm/node_modules/lru-cache/package.json
deps/npm/node_modules/lru-cache/s.js [new file with mode: 0644]
deps/npm/node_modules/lru-cache/test/basic.js
deps/npm/node_modules/node-gyp/addon.gypi
deps/npm/node_modules/node-gyp/lib/build.js
deps/npm/node_modules/node-gyp/lib/configure.js
deps/npm/node_modules/node-gyp/lib/install.js
deps/npm/node_modules/node-gyp/lib/node-gyp.js
deps/npm/node_modules/node-gyp/package.json
deps/npm/node_modules/tar/package.json
deps/npm/node_modules/tar/test/pack.js
deps/npm/package.json
deps/openssl/openssl.gyp
deps/uv/.mailmap
deps/uv/AUTHORS
deps/uv/ChangeLog [new file with mode: 0644]
deps/uv/README.md
deps/uv/config-mingw.mk
deps/uv/config-unix.mk
deps/uv/include/uv.h
deps/uv/src/unix/stream.c
deps/uv/src/unix/udp.c
deps/uv/src/version.c [new file with mode: 0644]
deps/uv/test/test-udp-send-and-recv.c
deps/uv/uv.gyp
doc/api/addons.markdown
doc/api/child_process.markdown
doc/api/debugger.markdown
doc/api/dns.markdown
doc/api/domain.markdown
doc/api/http.markdown
doc/api/tty.markdown
doc/blog/release/v0.10.2.md [new file with mode: 0644]
lib/_stream_readable.js
lib/domain.js
lib/timers.js
lib/tls.js
src/node.cc
src/node.js
src/node_crypto.cc
test/simple/test-domain-from-timer.js [new file with mode: 0644]
test/simple/test-stream-readable-event.js [new file with mode: 0644]
test/simple/test-tls-client-abort3.js [new file with mode: 0644]
test/simple/test-writedouble.js
test/simple/test-writefloat.js

diff --git a/AUTHORS b/AUTHORS
index 9b392cf..c9c689f 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -429,3 +429,5 @@ Henry Chin <hheennrryy@gmail.com>
 Julian Gruber <julian@juliangruber.com>
 JeongHoon Byun <outsideris@gmail.com>
 Iskren Ivov Chernev <iskren.chernev@gmail.com>
+Alexey Kupershtokh <alexey.kupershtokh@gmail.com>
+Benjamin Ruston <benjy.ruston@gmail.com>
index a626341..bf08851 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,39 @@
-2013.03.21, Version 0.10.1 (Stable)
+2013.03.28, Version 0.10.2 (Stable)
+
+* npm: Upgrade to 1.2.15
+
+* uv: Upgrade to 0.10.3
+
+* tls: handle SSL_ERROR_ZERO_RETURN (Fedor Indutny)
+
+* tls: handle errors before calling C++ methods (Fedor Indutny)
+
+* tls: remove harmful unnecessary bounds checking (Marcel Laverdet)
+
+* crypto: make getCiphers() return non-SSL ciphers (Ben Noordhuis)
+
+* crypto: check randomBytes() size argument (Ben Noordhuis)
+
+* timers: do not calculate Timeout._when property (Alexey Kupershtokh)
+
+* timers: fix off-by-one ms error (Alexey Kupershtokh)
+
+* timers: handle signed int32 overflow in enroll() (Fedor Indutny)
+
+* stream: Fix stall in Transform under very specific conditions (Gil Pedersen)
+
+* stream: Handle late 'readable' event listeners (isaacs)
+
+* stream: Fix early end in Writables on zero-length writes (isaacs)
+
+* domain: fix domain callback from MakeCallback (Trevor Norris)
+
+* child_process: don't emit same handle twice (Ben Noordhuis)
+
+* child_process: fix sending utf-8 to child process (Ben Noordhuis)
+
+
+2013.03.21, Version 0.10.1 (Stable), c274d1643589bf104122674a8c3fd147527a667d
 
 * npm: upgrade to 1.2.15
 
index 751e804..52d2a2e 100644 (file)
@@ -15,9 +15,9 @@ There sometimes arise cases where a user publishes a module, and then
 later, some other user wants to use that name.  Here are some common
 ways that happens (each of these is based on actual events.)
 
-1. Bob writes a JavaScript module `foo`, which is not node-specific.
-   Bob doesn't use node at all.  Joe wants to use `foo` in node, so he
-   wraps it in an npm module.  Some time later, Bob starts using node,
+1. Joe writes a JavaScript module `foo`, which is not node-specific.
+   Joe doesn't use node at all.  Bob   wants to use `foo` in node, so he
+   wraps it in an npm module.  Some time later, Joe starts using node,
    and wants to take over management of his program.
 2. Bob writes an npm module `foo`, and publishes it.  Perhaps much
    later, Joe finds a bug in `foo`, and fixes it.  He sends a pull
@@ -49,7 +49,8 @@ Joe's appropriate course of action in each case is the same.
    the `foo` package.
 3. After a reasonable amount of time, if Bob has not responded, or if
    Bob and Joe can't come to any sort of resolution, email isaacs
-   <i@izs.me> and we'll sort it out.
+   <i@izs.me> and we'll sort it out.  ("Reasonable" is usually about 4
+   weeks, but extra time is allowed around common holidays.)
 
 ## REASONING
 
@@ -71,17 +72,23 @@ Some things are not allowed, and will be removed without discussion if
 they are brought to the attention of the npm registry admins, including
 but not limited to:
 
-1. Malware (that is, a module designed to exploit or harm the machine on
-   which it is installed)
+1. Malware (that is, a package designed to exploit or harm the machine on
+   which it is installed).
 2. Violations of copyright or licenses (for example, cloning an
    MIT-licensed program, and then removing or changing the copyright and
-   license statement)
+   license statement).
 3. Illegal content.
 4. "Squatting" on a package name that you *plan* to use, but aren't
    actually using.  Sorry, I don't care how great the name is, or how
    perfect a fit it is for the thing that someday might happen.  If
    someone wants to use it today, and you're just taking up space with
    an empty tarball, you're going to be evicted.
+5. Putting empty packages in the registry.  Packages must have SOME
+   functionality.  It can be silly, but it can't be *nothing*.  (See
+   also: squatting.)
+6. Doing weird things with the registry, like using it as your own
+   personal application database or otherwise putting non-packagey
+   things into it.
 
 If you see bad behavior like this, please report it right away.
 
index f42aa39..6cbebc9 100644 (file)
@@ -20,9 +20,9 @@
 later, some other user wants to use that name.  Here are some common
 ways that happens (each of these is based on actual events.)</p>
 
-<ol><li>Bob writes a JavaScript module <code>foo</code>, which is not node-specific.
-Bob doesn&#39;t use node at all.  Joe wants to use <code>foo</code> in node, so he
-wraps it in an npm module.  Some time later, Bob starts using node,
+<ol><li>Joe writes a JavaScript module <code>foo</code>, which is not node-specific.
+Joe doesn&#39;t use node at all.  Bob   wants to use <code>foo</code> in node, so he
+wraps it in an npm module.  Some time later, Joe starts using node,
 and wants to take over management of his program.</li><li>Bob writes an npm module <code>foo</code>, and publishes it.  Perhaps much
 later, Joe finds a bug in <code>foo</code>, and fixes it.  He sends a pull
 request to Bob, but Bob doesn&#39;t have the time to deal with it,
@@ -49,7 +49,8 @@ isaacs <a href="mailto:i@izs.me">i@izs.me</a> to the CC list of the email.  Ment
 that Bob can run <code>npm owner add joe foo</code> to add Joe as an owner of
 the <code>foo</code> package.</li><li>After a reasonable amount of time, if Bob has not responded, or if
 Bob and Joe can&#39;t come to any sort of resolution, email isaacs
-<a href="mailto:i@izs.me">i@izs.me</a> and we&#39;ll sort it out.</li></ol>
+<a href="mailto:i@izs.me">i@izs.me</a> and we&#39;ll sort it out.  (&quot;Reasonable&quot; is usually about 4
+weeks, but extra time is allowed around common holidays.)</li></ol>
 
 <h2 id="REASONING">REASONING</h2>
 
@@ -71,14 +72,18 @@ feeling good about the interaction.</p>
 they are brought to the attention of the npm registry admins, including
 but not limited to:</p>
 
-<ol><li>Malware (that is, a module designed to exploit or harm the machine on
-which it is installed)</li><li>Violations of copyright or licenses (for example, cloning an
+<ol><li>Malware (that is, a package designed to exploit or harm the machine on
+which it is installed).</li><li>Violations of copyright or licenses (for example, cloning an
 MIT-licensed program, and then removing or changing the copyright and
-license statement)</li><li>Illegal content.</li><li>&quot;Squatting&quot; on a package name that you <em>plan</em> to use, but aren&#39;t
+license statement).</li><li>Illegal content.</li><li>&quot;Squatting&quot; on a package name that you <em>plan</em> to use, but aren&#39;t
 actually using.  Sorry, I don&#39;t care how great the name is, or how
 perfect a fit it is for the thing that someday might happen.  If
 someone wants to use it today, and you&#39;re just taking up space with
-an empty tarball, you&#39;re going to be evicted.</li></ol>
+an empty tarball, you&#39;re going to be evicted.</li><li>Putting empty packages in the registry.  Packages must have SOME
+functionality.  It can be silly, but it can&#39;t be <em>nothing</em>.  (See
+also: squatting.)</li><li>Doing weird things with the registry, like using it as your own
+personal application database or otherwise putting non-packagey
+things into it.</li></ol>
 
 <p>If you see bad behavior like this, please report it right away.</p>
 
index 4f8fbc4..2007442 100644 (file)
@@ -140,6 +140,7 @@ function read (name, ver, forceBypass, cb) {
   }
 
   readJson(jsonFile, function (er, data) {
+    er = needName(er, data)
     er = needVersion(er, data)
     if (er && er.code !== "ENOENT" && er.code !== "ENOTDIR") return cb(er)
     if (er) return addNamed(name, ver, c)
@@ -722,6 +723,7 @@ function addNameVersion (name, ver, data, cb) {
       if (!er) readJson( path.join( npm.cache, name, ver
                                   , "package", "package.json" )
                        , function (er, data) {
+          er = needName(er, data)
           er = needVersion(er, data)
           if (er && er.code !== "ENOENT" && er.code !== "ENOTDIR") return cb(er)
           if (er) return fetchit()
@@ -1011,6 +1013,7 @@ function addPlacedTarball_ (p, name, uid, gid, resolvedSum, cb) {
           return cb(er)
         }
         readJson(path.join(folder, "package.json"), function (er, data) {
+          er = needName(er, data)
           er = needVersion(er, data)
           if (er) {
             log.error("addPlacedTarball", "Couldn't read json in %j"
@@ -1057,6 +1060,7 @@ function addLocalDirectory (p, name, shasum, cb) {
   if (p.indexOf(npm.cache) === 0) return cb(new Error(
     "Adding a cache directory to the cache will make the world implode."))
   readJson(path.join(p, "package.json"), function (er, data) {
+    er = needName(er, data)
     er = needVersion(er, data)
     if (er) return cb(er)
     deprCheck(data)
@@ -1183,6 +1187,12 @@ function unlock (u, cb) {
   lockFile.unlock(lockFileName(u), cb)
 }
 
+function needName(er, data) {
+  return er ? er
+       : (data && !data.name) ? new Error("No name provided")
+       : null
+}
+
 function needVersion(er, data) {
   return er ? er
        : (data && !data.version) ? new Error("No version provided")
index e5e2f19..162b94a 100644 (file)
@@ -28,9 +28,9 @@ later, some other user wants to use that name\.  Here are some common
 ways that happens (each of these is based on actual events\.)
 .
 .IP "1" 4
-Bob writes a JavaScript module \fBfoo\fR, which is not node\-specific\.
-Bob doesn\'t use node at all\.  Joe wants to use \fBfoo\fR in node, so he
-wraps it in an npm module\.  Some time later, Bob starts using node,
+Joe writes a JavaScript module \fBfoo\fR, which is not node\-specific\.
+Joe doesn\'t use node at all\.  Bob   wants to use \fBfoo\fR in node, so he
+wraps it in an npm module\.  Some time later, Joe starts using node,
 and wants to take over management of his program\.
 .
 .IP "2" 4
@@ -75,7 +75,8 @@ the \fBfoo\fR package\.
 .
 .IP "3" 4
 After a reasonable amount of time, if Bob has not responded, or if
-Bob and Joe can\'t come to any sort of resolution, email isaacs \fIi@izs\.me\fR and we\'ll sort it out\.
+Bob and Joe can\'t come to any sort of resolution, email isaacs \fIi@izs\.me\fR and we\'ll sort it out\.  ("Reasonable" is usually about 4
+weeks, but extra time is allowed around common holidays\.)
 .
 .IP "" 0
 .
@@ -99,13 +100,13 @@ they are brought to the attention of the npm registry admins, including
 but not limited to:
 .
 .IP "1" 4
-Malware (that is, a module designed to exploit or harm the machine on
-which it is installed)
+Malware (that is, a package designed to exploit or harm the machine on
+which it is installed)\.
 .
 .IP "2" 4
 Violations of copyright or licenses (for example, cloning an
 MIT\-licensed program, and then removing or changing the copyright and
-license statement)
+license statement)\.
 .
 .IP "3" 4
 Illegal content\.
@@ -117,6 +118,16 @@ perfect a fit it is for the thing that someday might happen\.  If
 someone wants to use it today, and you\'re just taking up space with
 an empty tarball, you\'re going to be evicted\.
 .
+.IP "5" 4
+Putting empty packages in the registry\.  Packages must have SOME
+functionality\.  It can be silly, but it can\'t be \fInothing\fR\|\.  (See
+also: squatting\.)
+.
+.IP "6" 4
+Doing weird things with the registry, like using it as your own
+personal application database or otherwise putting non\-packagey
+things into it\.
+.
 .IP "" 0
 .
 .P
index ac48e49..03ee0f9 100644 (file)
@@ -26,7 +26,8 @@ away.
 
 ## Options
 
-* `max` The maximum number of items.  Not setting this is kind of
+* `max` The maximum size of the cache, checked by applying the length
+  function to all values in the cache.  Not setting this is kind of
   silly, since that's the whole purpose of this lib, but it defaults
   to `Infinity`.
 * `maxAge` Maximum age in ms.  Items are not pro-actively pruned out
@@ -59,6 +60,15 @@ away.
     Both of these will update the "recently used"-ness of the key.
     They do what you think.
 
+* `peek(key)`
+
+    Returns the key value (or `undefined` if not found) without
+    updating the "recently used"-ness of the key.
+
+    (If you find yourself using this a lot, you *might* be using the
+    wrong sort of data structure, but there are some use cases where
+    it's handy.)
+
 * `del(key)`
 
     Deletes a key out of the cache.
index b8fd860..8c80853 100644 (file)
@@ -48,6 +48,7 @@ function LRUCache (options) {
   var cache = Object.create(null) // hash of items by key
     , lruList = Object.create(null) // list of items in order of use recency
     , mru = 0 // most recently used
+    , lru = 0 // least recently used
     , length = 0 // number of items in the list
     , itemCount = 0
 
@@ -138,6 +139,7 @@ function LRUCache (options) {
     }
     cache = {}
     lruList = {}
+    lru = 0
     mru = 0
     length = 0
     itemCount = 0
@@ -191,38 +193,54 @@ function LRUCache (options) {
   }
 
   this.get = function (key) {
-    if (!hOP(cache, key)) return
+    return get(key, true)
+  }
+
+  this.peek = function (key) {
+    return get(key, false)
+  }
+
+  function get (key, doUse) {
     var hit = cache[key]
-    if (maxAge && (Date.now() - hit.now > maxAge)) {
-      this.del(key)
-      return allowStale ? hit.value : undefined
+    if (hit) {
+      if (maxAge && (Date.now() - hit.now > maxAge)) {
+        del(hit)
+        if (!allowStale) hit = undefined
+      } else {
+        if (doUse) use(hit)
+      }
+      if (hit) hit = hit.value
     }
-    delete lruList[hit.lu]
+    return hit
+  }
+
+  function use (hit) {
+    shiftLU(hit)
     hit.lu = mru ++
     lruList[hit.lu] = hit
-    return hit.value
   }
 
   this.del = function (key) {
-    if (!hOP(cache, key)) return
-    var hit = cache[key]
-    if (dispose) dispose(key, hit.value)
-    delete cache[key]
-    delete lruList[hit.lu]
-    length -= hit.length
-    itemCount --
+    del(cache[key])
   }
 
   function trim () {
-    if (length <= max) return
-    for (var k in lruList) {
-      if (length <= max) break;
-      var hit = lruList[k]
+    while (lru < mru && length > max)
+      del(lruList[lru])
+  }
+
+  function shiftLU(hit) {
+    delete lruList[ hit.lu ]
+    while (lru < mru && !lruList[lru]) lru ++
+  }
+
+  function del(hit) {
+    if (hit) {
       if (dispose) dispose(hit.key, hit.value)
       length -= hit.length
       itemCount --
       delete cache[ hit.key ]
-      delete lruList[k]
+      shiftLU(hit)
     }
   }
 }
index b0ee3f9..d5a4e8c 100644 (file)
@@ -1,7 +1,7 @@
 {
   "name": "lru-cache",
   "description": "A cache object that deletes the least-recently-used items.",
-  "version": "2.2.2",
+  "version": "2.3.0",
   "author": {
     "name": "Isaac Z. Schlueter",
     "email": "i@izs.me"
@@ -15,7 +15,8 @@
     "url": "git://github.com/isaacs/node-lru-cache.git"
   },
   "devDependencies": {
-    "tap": ""
+    "tap": "",
+    "weak": ""
   },
   "license": {
     "type": "MIT",
@@ -51,8 +52,8 @@
       "email": "jesse.dailey@gmail.com"
     }
   ],
-  "readme": "# lru cache\n\nA cache object that deletes the least-recently-used items.\n\n## Usage:\n\n```javascript\nvar LRU = require(\"lru-cache\")\n  , options = { max: 500\n              , length: function (n) { return n * 2 }\n              , dispose: function (key, n) { n.close() }\n              , maxAge: 1000 * 60 * 60 }\n  , cache = LRU(options)\n  , otherCache = LRU(50) // sets just the max size\n\ncache.set(\"key\", \"value\")\ncache.get(\"key\") // \"value\"\n\ncache.reset()    // empty the cache\n```\n\nIf you put more stuff in it, then items will fall out.\n\nIf you try to put an oversized thing in it, then it'll fall out right\naway.\n\n## Options\n\n* `max` The maximum number of items.  Not setting this is kind of\n  silly, since that's the whole purpose of this lib, but it defaults\n  to `Infinity`.\n* `maxAge` Maximum age in ms.  Items are not pro-actively pruned out\n  as they age, but if you try to get an item that is too old, it'll\n  drop it and return undefined instead of giving it to you.\n* `length` Function that is used to calculate the length of stored\n  items.  If you're storing strings or buffers, then you probably want\n  to do something like `function(n){return n.length}`.  The default is\n  `function(n){return 1}`, which is fine if you want to store `n`\n  like-sized things.\n* `dispose` Function that is called on items when they are dropped\n  from the cache.  This can be handy if you want to close file\n  descriptors or do other cleanup tasks when items are no longer\n  accessible.  Called with `key, value`.  It's called *before*\n  actually removing the item from the internal cache, so if you want\n  to immediately put it back in, you'll have to do that in a\n  `nextTick` or `setTimeout` callback or it won't do anything.\n* `stale` By default, if you set a `maxAge`, it'll only actually pull\n  stale items out of the cache when you `get(key)`.  (That is, it's\n  not pre-emptively doing a `setTimeout` or anything.)  If you set\n  `stale:true`, it'll return the stale value before deleting it.  If\n  you don't set this, then it'll return `undefined` when you try to\n  get a stale entry, as if it had already been deleted.\n\n## API\n\n* `set(key, value)`\n* `get(key) => value`\n\n    Both of these will update the \"recently used\"-ness of the key.\n    They do what you think.\n\n* `del(key)`\n\n    Deletes a key out of the cache.\n\n* `reset()`\n\n    Clear the cache entirely, throwing away all values.\n\n* `has(key)`\n\n    Check if a key is in the cache, without updating the recent-ness\n    or deleting it for being stale.\n\n* `forEach(function(value,key,cache), [thisp])`\n\n    Just like `Array.prototype.forEach`.  Iterates over all the keys\n    in the cache, in order of recent-ness.  (Ie, more recently used\n    items are iterated over first.)\n\n* `keys()`\n\n    Return an array of the keys in the cache.\n\n* `values()`\n\n    Return an array of the values in the cache.\n",
+  "readme": "# lru cache\n\nA cache object that deletes the least-recently-used items.\n\n## Usage:\n\n```javascript\nvar LRU = require(\"lru-cache\")\n  , options = { max: 500\n              , length: function (n) { return n * 2 }\n              , dispose: function (key, n) { n.close() }\n              , maxAge: 1000 * 60 * 60 }\n  , cache = LRU(options)\n  , otherCache = LRU(50) // sets just the max size\n\ncache.set(\"key\", \"value\")\ncache.get(\"key\") // \"value\"\n\ncache.reset()    // empty the cache\n```\n\nIf you put more stuff in it, then items will fall out.\n\nIf you try to put an oversized thing in it, then it'll fall out right\naway.\n\n## Options\n\n* `max` The maximum size of the cache, checked by applying the length\n  function to all values in the cache.  Not setting this is kind of\n  silly, since that's the whole purpose of this lib, but it defaults\n  to `Infinity`.\n* `maxAge` Maximum age in ms.  Items are not pro-actively pruned out\n  as they age, but if you try to get an item that is too old, it'll\n  drop it and return undefined instead of giving it to you.\n* `length` Function that is used to calculate the length of stored\n  items.  If you're storing strings or buffers, then you probably want\n  to do something like `function(n){return n.length}`.  The default is\n  `function(n){return 1}`, which is fine if you want to store `n`\n  like-sized things.\n* `dispose` Function that is called on items when they are dropped\n  from the cache.  This can be handy if you want to close file\n  descriptors or do other cleanup tasks when items are no longer\n  accessible.  Called with `key, value`.  It's called *before*\n  actually removing the item from the internal cache, so if you want\n  to immediately put it back in, you'll have to do that in a\n  `nextTick` or `setTimeout` callback or it won't do anything.\n* `stale` By default, if you set a `maxAge`, it'll only actually pull\n  stale items out of the cache when you `get(key)`.  (That is, it's\n  not pre-emptively doing a `setTimeout` or anything.)  If you set\n  `stale:true`, it'll return the stale value before deleting it.  If\n  you don't set this, then it'll return `undefined` when you try to\n  get a stale entry, as if it had already been deleted.\n\n## API\n\n* `set(key, value)`\n* `get(key) => value`\n\n    Both of these will update the \"recently used\"-ness of the key.\n    They do what you think.\n\n* `peek(key)`\n\n    Returns the key value (or `undefined` if not found) without\n    updating the \"recently used\"-ness of the key.\n\n    (If you find yourself using this a lot, you *might* be using the\n    wrong sort of data structure, but there are some use cases where\n    it's handy.)\n\n* `del(key)`\n\n    Deletes a key out of the cache.\n\n* `reset()`\n\n    Clear the cache entirely, throwing away all values.\n\n* `has(key)`\n\n    Check if a key is in the cache, without updating the recent-ness\n    or deleting it for being stale.\n\n* `forEach(function(value,key,cache), [thisp])`\n\n    Just like `Array.prototype.forEach`.  Iterates over all the keys\n    in the cache, in order of recent-ness.  (Ie, more recently used\n    items are iterated over first.)\n\n* `keys()`\n\n    Return an array of the keys in the cache.\n\n* `values()`\n\n    Return an array of the values in the cache.\n",
   "readmeFilename": "README.md",
-  "_id": "lru-cache@2.2.2",
+  "_id": "lru-cache@2.3.0",
   "_from": "lru-cache@latest"
 }
diff --git a/deps/npm/node_modules/lru-cache/s.js b/deps/npm/node_modules/lru-cache/s.js
new file mode 100644 (file)
index 0000000..c2a9e54
--- /dev/null
@@ -0,0 +1,25 @@
+var LRU = require('lru-cache');
+
+var max = +process.argv[2] || 10240;
+var more = 1024;
+
+var cache = LRU({
+  max: max, maxAge: 86400e3
+});
+
+// fill cache
+for (var i = 0; i < max; ++i) {
+  cache.set(i, {});
+}
+
+var start = process.hrtime();
+
+// adding more items
+for ( ; i < max+more; ++i) {
+  cache.set(i, {});
+}
+
+var end = process.hrtime(start);
+var msecs = end[0] * 1E3 + end[1] / 1E6;
+
+console.log('adding %d items took %d ms', more, msecs.toPrecision(5));
index dad13a8..70f3f8b 100644 (file)
@@ -299,3 +299,31 @@ test("stale", function(t) {
     t.end()
   }, 15)
 })
+
+test("lru update via set", function(t) {
+  var cache = LRU({ max: 2 });
+
+  cache.set('foo', 1);
+  cache.set('bar', 2);
+  cache.del('bar');
+  cache.set('baz', 3);
+  cache.set('qux', 4);
+
+  t.equal(cache.get('foo'), undefined)
+  t.equal(cache.get('bar'), undefined)
+  t.equal(cache.get('baz'), 3)
+  t.equal(cache.get('qux'), 4)
+  t.end()
+})
+
+test("least recently set w/ peek", function (t) {
+  var cache = new LRU(2)
+  cache.set("a", "A")
+  cache.set("b", "B")
+  t.equal(cache.peek("a"), "A")
+  cache.set("c", "C")
+  t.equal(cache.get("c"), "C")
+  t.equal(cache.get("b"), "B")
+  t.equal(cache.get("a"), undefined)
+  t.end()
+})
index 5f74155..065b975 100644 (file)
       ['_type=="loadable_module"', {
         'product_extension': 'node',
         'defines': [ 'BUILDING_NODE_EXTENSION' ],
-      }]
+      }],
+      ['_type=="static_library"', {
+        # set to `1` to *disable* the -T thin archive 'ld' flag.
+        # older linkers don't support this flag.
+        'standalone_static_library': '<(standalone_static_library)'
+      }],
     ],
 
     'conditions': [
index ec3b9e0..bf27169 100644 (file)
@@ -119,22 +119,33 @@ function build (gyp, argv, callback) {
   function findMsbuild () {
     log.verbose('could not find "msbuild.exe" in PATH - finding location in registry')
     var notfoundErr = new Error('Can\'t find "msbuild.exe". Do you have Microsoft Visual Studio C++ 2008+ installed?')
-    exec('reg query "HKLM\\Software\\Microsoft\\MSBuild\\ToolsVersions" /s', function (err, stdout, stderr) {
-      var reVers = /Software\\Microsoft\\MSBuild\\ToolsVersions\\([^\r]+)\r\n\s+MSBuildToolsPath\s+REG_SZ\s+([^\r]+)/gi
+    var cmd = 'reg query "HKLM\\Software\\Microsoft\\MSBuild\\ToolsVersions" /s'
+    if (process.arch !== 'ia32')
+      cmd += ' /reg:32'
+    exec(cmd, function (err, stdout, stderr) {
+      var reVers = /ToolsVersions\\([^\\]+)$/i
+        , rePath = /\r\n[ \t]+MSBuildToolsPath[ \t]+REG_SZ[ \t]+([^\r]+)/i
         , msbuilds = []
         , r
         , msbuildPath
       if (err) {
         return callback(notfoundErr)
       }
-      while (r = reVers.exec(stdout)) {
-        if (parseFloat(r[1], 10) >= 3.5) {
-          msbuilds.push({
-            version: parseFloat(r[1], 10),
-            path: r[2]
-          })
+      stdout.split('\r\n\r\n').forEach(function(l) {
+        if (!l) return
+        l = l.trim()
+        if (r = reVers.exec(l.substring(0, l.indexOf('\r\n')))) {
+          var ver = parseFloat(r[1], 10)
+          if (ver >= 3.5) {
+            if (r = rePath.exec(l)) {
+              msbuilds.push({
+                version: ver,
+                path: r[1]
+              })
+            }
+          }
         }
-      }
+      })
       msbuilds.sort(function (x, y) {
         return (x.version < y.version ? -1 : 1)
       })
index e320099..437b839 100644 (file)
@@ -14,7 +14,6 @@ var fs = require('graceful-fs')
   , semver = require('semver')
   , mkdirp = require('mkdirp')
   , cp = require('child_process')
-  , exec = cp.exec
   , spawn = cp.spawn
   , execFile = cp.execFile
   , win = process.platform == 'win32'
@@ -91,7 +90,8 @@ function configure (gyp, argv, callback) {
   }
 
   function checkPythonVersion () {
-    execFile(python, ['-c', 'import platform; print(platform.python_version());'], function (err, stdout) {
+    var env = { TERM: 'dumb', PATH: process.env.PATH };
+    execFile(python, ['-c', 'import platform; print(platform.python_version());'], { env: env }, function (err, stdout) {
       if (err) {
         return callback(err)
       }
@@ -166,11 +166,7 @@ function configure (gyp, argv, callback) {
     var cp = spawn('cmd', ['/C', '%WINDIR%\\SysWOW64\\reg', 'query', 'HKLM\\Software\\Microsoft\\VCExpress\\10.0\\Setup\\VC', '/v', 'ProductDir'])
     cp.on('exit', function (code) {
       hasVCExpress = (code === 0)
-      if (code !== 0) {
-        checkVC2012Express(cb)
-      } else {
-        cb()
-      }
+      checkVC2012Express(cb)
     })
   }
 
@@ -180,7 +176,7 @@ function configure (gyp, argv, callback) {
            if (code !== 0) {
              checkVCExpress64(cb)
            } else {
-             cb()
+             checkVC2012Express(cb)
            }
          })
   }
@@ -291,6 +287,9 @@ function configure (gyp, argv, callback) {
     // don't copy dev libraries with nodedir option
     variables.copy_dev_lib = !gyp.opts.nodedir
 
+    // disable -T "thin" static archives by default
+    variables.standalone_static_library = gyp.opts.thin ? 0 : 1;
+
     // loop through the rest of the opts and add the unknown ones as variables.
     // this allows for module-specific configure flags like:
     //
index ffa6076..d6b7c42 100644 (file)
@@ -38,7 +38,7 @@ function install (gyp, argv, callback) {
     }
   }
 
-  var distUrl = gyp.opts['dist-url'] || 'http://nodejs.org/dist'
+  var distUrl = gyp.opts['dist-url'] || gyp.opts.disturl || 'http://nodejs.org/dist'
 
 
   // Determine which node dev files version we are installing
index 9a88b21..fae8e13 100644 (file)
@@ -86,6 +86,7 @@ proto.configDefs = {
   , python: String    // 'configure'
   , 'dist-url': String // 'install'
   , jobs: String      // 'build'
+  , thin: String      // 'configure'
 }
 
 /**
index 97fd17c..3a785f2 100644 (file)
@@ -10,7 +10,7 @@
     "bindings",
     "gyp"
   ],
-  "version": "0.8.5",
+  "version": "0.9.3",
   "installVersion": 9,
   "author": {
     "name": "Nathan Rajlich",
   "dependencies": {
     "glob": "3",
     "graceful-fs": "1",
-    "fstream": "~0.1.13",
-    "minimatch": "0.2",
-    "mkdirp": "0.3",
+    "fstream": "0",
+    "minimatch": "0",
+    "mkdirp": "0",
     "nopt": "2",
     "npmlog": "0",
     "osenv": "0",
-    "request": "2.9",
+    "request": "2",
     "rimraf": "2",
     "semver": "1",
-    "tar": "~0.1.12",
+    "tar": "0",
     "which": "1"
   },
   "engines": {
   },
   "readme": "node-gyp\n=========\n### Node.js native addon build tool\n\n`node-gyp` is a cross-platform command-line tool written in Node.js for compiling\nnative addon modules for Node.js, which takes away the pain of dealing with the\nvarious differences in build platforms. It is the replacement to the `node-waf`\nprogram which is removed for node `v0.8`. If you have a native addon for node that\nstill has a `wscript` file, then you should definitely add a `binding.gyp` file\nto support the latest versions of node.\n\nMultiple target versions of node are supported (i.e. `0.6`, `0.7`,..., `1.0`,\netc.), regardless of what version of node is actually installed on your system\n(`node-gyp` downloads the necessary development files for the target version).\n\n#### Features:\n\n * Easy to use, consistent interface\n * Same commands to build your module on every platform\n * Supports multiple target versions of Node\n\n\nInstallation\n------------\n\nYou can install with `npm`:\n\n``` bash\n$ npm install -g node-gyp\n```\n\nYou will also need to install:\n\n  * On Unix:\n    * `python`\n    * `make`\n    * A proper C/C++ compiler toolchain, like GCC\n  * On Windows:\n    * [Python][windows-python] ([`v2.7.3`][windows-python-v2.7.3] recommended, `v3.x.x` is __*not*__ supported)\n    * Windows XP/Vista/7:\n      * Microsoft Visual Studio C++ 2010 ([Express][msvc2010] version works well)\n      * For 64-bit builds of node and native modules you will _**also**_ need the [Windows 7 64-bit SDK][win7sdk]\n        * If the install fails, try uninstalling any C++ 2010 x64&x86 Redistributable that you have installed first.\n      * If you get errors that the 64-bit compilers are not installed you may also need the [compiler update for the Windows SDK 7.1]\n    * Windows 8:\n      * Microsoft Visual Studio C++ 2012 for Windows Desktop ([Express][msvc2012] version works well)\n\nNote that OS X is just a flavour of Unix and so needs `python`, `make`, and C/C++.\nAn easy way to obtain these is to install XCode from Apple,\nand then use it to install the command line tools (under Preferences -> Downloads).\n\nHow to Use\n----------\n\nTo compile your native addon, first go to its root directory:\n\n``` bash\n$ cd my_node_addon\n```\n\nThe next step is to generate the appropriate project build files for the current\nplatform. Use `configure` for that:\n\n``` bash\n$ node-gyp configure\n```\n\n__Note__: The `configure` step looks for the `binding.gyp` file in the current\ndirectory to processs. See below for instructions on creating the `binding.gyp` file.\n\nNow you will have either a `Makefile` (on Unix platforms) or a `vcxproj` file\n(on Windows) in the `build/` directory. Next invoke the `build` command:\n\n``` bash\n$ node-gyp build\n```\n\nNow you have your compiled `.node` bindings file! The compiled bindings end up\nin `build/Debug/` or `build/Release/`, depending on the build mode. At this point\nyou can require the `.node` file with Node and run your tests!\n\n__Note:__ To create a _Debug_ build of the bindings file, pass the `--debug` (or\n`-d`) switch when running the either `configure` or `build` command.\n\n\nThe \"binding.gyp\" file\n----------------------\n\nPreviously when node had `node-waf` you had to write a `wscript` file. The\nreplacement for that is the `binding.gyp` file, which describes the configuration\nto build your module in a JSON-like format. This file gets placed in the root of\nyour package, alongside the `package.json` file.\n\nA barebones `gyp` file appropriate for building a node addon looks like:\n\n``` json\n{\n  \"targets\": [\n    {\n      \"target_name\": \"binding\",\n      \"sources\": [ \"src/binding.cc\" ]\n    }\n  ]\n}\n```\n\nSome additional resources for writing `gyp` files:\n\n * [\"Hello World\" node addon example](https://github.com/joyent/node/tree/master/test/addons/hello-world)\n * [gyp user documentation](http://code.google.com/p/gyp/wiki/GypUserDocumentation)\n * [gyp input format reference](http://code.google.com/p/gyp/wiki/InputFormatReference)\n * [*\"binding.gyp\" files out in the wild* wiki page](https://github.com/TooTallNate/node-gyp/wiki/%22binding.gyp%22-files-out-in-the-wild)\n\n\nCommands\n--------\n\n`node-gyp` responds to the following commands:\n\n| **Command**   | **Description**\n|:--------------|:---------------------------------------------------------------\n| `build`       | Invokes `make`/`msbuild.exe` and builds the native addon\n| `clean`       | Removes any the `build` dir if it exists\n| `configure`   | Generates project build files for the current platform\n| `rebuild`     | Runs \"clean\", \"configure\" and \"build\" all in a row\n| `install`     | Installs node development header files for the given version\n| `list`        | Lists the currently installed node development file versions\n| `remove`      | Removes the node development header files for the given version\n\n\nLicense\n-------\n\n(The MIT License)\n\nCopyright (c) 2012 Nathan Rajlich &lt;nathan@tootallnate.net&gt;\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n[windows-python]: http://www.python.org/getit/windows\n[windows-python-v2.7.3]: http://www.python.org/download/releases/2.7.3#download\n[msvc2010]: http://go.microsoft.com/?linkid=9709949\n[msvc2012]: http://go.microsoft.com/?linkid=9816758\n[win7sdk]: http://www.microsoft.com/en-us/download/details.aspx?id=8279\n[compiler update for the Windows SDK 7.1]: http://www.microsoft.com/en-us/download/details.aspx?id=4422\n",
   "readmeFilename": "README.md",
-  "_id": "node-gyp@0.8.5",
-  "_from": "node-gyp@latest"
+  "_id": "node-gyp@0.9.3",
+  "dist": {
+    "shasum": "575868f6bded377c5904e8acffb4921d2f077fbe"
+  },
+  "_from": "node-gyp@0.9.3",
+  "_resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-0.9.3.tgz"
 }
index 9959135..36eae3d 100644 (file)
@@ -6,7 +6,7 @@
   },
   "name": "tar",
   "description": "tar for node",
-  "version": "0.1.16",
+  "version": "0.1.17",
   "repository": {
     "type": "git",
     "url": "git://github.com/isaacs/node-tar.git"
@@ -15,9 +15,6 @@
   "scripts": {
     "test": "tap test/*.js"
   },
-  "engines": {
-    "node": "~0.5.9 || 0.6 || 0.7 || 0.8"
-  },
   "dependencies": {
     "inherits": "1.x",
     "block-stream": "*",
   "license": "BSD",
   "readme": "# node-tar\n\nTar for Node.js.\n\n## Goals of this project\n\n1. Be able to parse and reasonably extract the contents of any tar file\n   created by any program that creates tar files, period.\n\n    At least, this includes every version of:\n\n    * bsdtar\n    * gnutar\n    * solaris posix tar\n    * Joerg Schilling's star (\"Schilly tar\")\n\n2. Create tar files that can be extracted by any of the following tar\n   programs:\n\n    * bsdtar/libarchive version 2.6.2\n    * gnutar 1.15 and above\n    * SunOS Posix tar\n    * Joerg Schilling's star (\"Schilly tar\")\n\n3. 100% test coverage.  Speed is important.  Correctness is slightly\n   more important.\n\n4. Create the kind of tar interface that Node users would want to use.\n\n5. Satisfy npm's needs for a portable tar implementation with a\n   JavaScript interface.\n\n6. No excuses.  No complaining.  No tolerance for failure.\n\n## But isn't there already a tar.js?\n\nYes, there are a few.  This one is going to be better, and it will be\nfanatically maintained, because npm will depend on it.\n\nThat's why I need to write it from scratch.  Creating and extracting\ntarballs is such a large part of what npm does, I simply can't have it\nbe a black box any longer.\n\n## Didn't you have something already?  Where'd it go?\n\nIt's in the \"old\" folder.  It's not functional.  Don't use it.\n\nIt was a useful exploration to learn the issues involved, but like most\nsoftware of any reasonable complexity, node-tar won't be useful until\nit's been written at least 3 times.\n",
   "readmeFilename": "README.md",
-  "_id": "tar@0.1.16",
-  "_from": "tar@~0.1.12"
+  "_id": "tar@0.1.17",
+  "dist": {
+    "shasum": "408c8a95deb8e78a65b59b1a51a333183a32badc"
+  },
+  "_from": "tar@0.1.17",
+  "_resolved": "https://registry.npmjs.org/tar/-/tar-0.1.17.tgz"
 }
index 8be4178..0f50994 100644 (file)
@@ -50,8 +50,7 @@ var tap = require("tap")
         "NODETAR.repository.type": pkg.repository.type,
         "NODETAR.repository.url": pkg.repository.url,
         "NODETAR.main": pkg.main,
-        "NODETAR.scripts.test": pkg.scripts.test,
-        "NODETAR.engines.node": pkg.engines.node } ]
+        "NODETAR.scripts.test": pkg.scripts.test } ]
 
     , [ 'entry',
       { path: 'fixtures/',
index 8c9999a..b77c075 100644 (file)
     "rimraf": "2",
     "request": "~2.9",
     "which": "1",
-    "tar": "~0.1.12",
+    "tar": "~0.1.17",
     "fstream": "~0.1.22",
     "block-stream": "*",
     "inherits": "1",
     "mkdirp": "~0.3.3",
     "read": "~1.0.4",
-    "lru-cache": "~2.2.2",
-    "node-gyp": "~0.8.5",
+    "lru-cache": "~2.3.0",
+    "node-gyp": "~0.9.3",
     "fstream-npm": "~0.1.3",
     "uid-number": "0",
     "archy": "0",
index 0b08ecd..77af4de 100644 (file)
         # No clue what these are for.
         'L_ENDIAN',
         'PURIFY',
-        '_REENTRANT'
+        '_REENTRANT',
+
+        # Heartbeat is a TLS extension, that couldn't be turned off or
+        # asked to be not advertised. Unfortunately this is unacceptable for
+        # Microsoft's IIS, which seems to be ignoring whole ClientHello after
+        # seeing this extension.
+        'OPENSSL_NO_HEARTBEATS',
       ],
       'sources': [
         'openssl/ssl/bio_ssl.c',
index 2d98623..560a650 100644 (file)
@@ -1,13 +1,16 @@
-# update AUTHORS with:
-#   git log --all --reverse --format='%aN <%aE>' | perl -ne 'BEGIN{print "# Authors ordered by first contribution.\n"} print unless $h{$_}; $h{$_} = 1' > AUTHORS
-<rm@joyent.com> <rm@fingolfin.org>
-<ryan@joyent.com> <ry@tinyclouds.org>
-<bertbelder@gmail.com> <info@2bs.nl>
-<alan@prettyrobots.com> <alan@blogometer.com>
-San-Tai Hsu <vanilla@fatpipi.com>
-Isaac Z. Schlueter <i@izs.me>
-Saúl Ibarra Corretgé <saghul@gmail.com>
-Yuki OKUMURA <mjt@cltn.org>
+Alan Gutierrez <alan@prettyrobots.com> <alan@blogometer.com>
+Bert Belder <bertbelder@gmail.com> <info@2bs.nl>
+Bert Belder <bertbelder@gmail.com> <user@ChrUbuntu.(none)>
+Brandon Philips <brandon.philips@rackspace.com> <brandon@ifup.org>
+Brian White <mscdex@mscdex.net> <mscdex@gmail.com>
 Frank Denis <github@pureftpd.org>
+Isaac Z. Schlueter <i@izs.me>
+Robert Mustacchi <rm@joyent.com> <rm@fingolfin.org>
+Ryan Dahl <ryan@joyent.com> <ry@tinyclouds.org>
 Ryan Emery <seebees@gmail.com>
+San-Tai Hsu <vanilla@fatpipi.com>
+Saúl Ibarra Corretgé <saghul@gmail.com>
+Shigeki Ohtsu <ohtsu@iij.ad.jp> <ohtsu@ohtsu.org>
+Timothy J. Fontaine <tjfontaine@gmail.com>
 Yasuhiro Matsumoto <mattn.jp@gmail.com>
+Yuki Okumura <mjt@cltn.org>
index d28143b..435f734 100644 (file)
@@ -28,7 +28,7 @@ Marek Jelen <marek@jelen.biz>
 Fedor Indutny <fedor.indutny@gmail.com>
 Saúl Ibarra Corretgé <saghul@gmail.com>
 Felix Geisendörfer <felix@debuggable.com>
-Yuki OKUMURA <mjt@cltn.org>
+Yuki Okumura <mjt@cltn.org>
 Roman Shtylman <shtylman@gmail.com>
 Frank Denis <github@pureftpd.org>
 Carter Allen <CarterA@opt-6.com>
@@ -44,7 +44,6 @@ Dan VerWeire <dverweire@gmail.com>
 Brandon Benvie <brandon@bbenvie.com>
 Brandon Philips <brandon.philips@rackspace.com>
 Nathan Rajlich <nathan@tootallnate.net>
-Brandon Philips <brandon@ifup.org>
 Charlie McConnell <charlie@charlieistheman.com>
 Vladimir Dronnikov <dronnikov@gmail.com>
 Aaron Bieber <qbit@deftly.net>
@@ -54,8 +53,29 @@ Erik Dubbelboer <erik@dubbelboer.com>
 Keno Fischer <kenof@stanford.edu>
 Ira Cooper <Ira.Cooper@mathworks.com>
 Andrius Bentkus <andrius.bentkus@gmail.com>
-Brian White <mscdex@gmail.com>
 Iñaki Baz Castillo <ibc@aliax.net>
 Mark Cavage <mark.cavage@joyent.com>
 George Yohng <georgegh@oss3d.com>
 Xidorn Quan <quanxunzhen@gmail.com>
+Roman Neuhauser <rneuhauser@suse.cz>
+Shuhei Tanuma <shuhei.tanuma@gmail.com>
+Bryan Cantrill <bcantrill@acm.org>
+Trond Norbye <trond.norbye@gmail.com>
+Tim Holy <holy@wustl.edu>
+Prancesco Pertugio <meh@schizofreni.co>
+Leonard Hecker <leonard.hecker91@gmail.com>
+Andrew Paprocki <andrew@ishiboo.com>
+Luigi Grilli <luigi.grilli@gmail.com>
+Shannen Saez <shannenlaptop@gmail.com>
+Artur Adib <arturadib@gmail.com>
+Hiroaki Nakamura <hnakamur@gmail.com>
+Ting-Yu Lin <ph.minamo@cytisan.com>
+Stephen Gallagher <sgallagh@redhat.com>
+Shane Holloway <shane.holloway@ieee.org>
+Andrew Shaffer <darawk@gmail.com>
+Vlad Tudose <vlad.tudose@intel.com>
+Ben Leslie <benno@benno.id.au>
+Tim Bradshaw <tfb@cley.com>
+Timothy J. Fontaine <tjfontaine@gmail.com>
+Marc Schlaich <marc.schlaich@googlemail.com>
+Brian Mazza <louseman@gmail.com>
diff --git a/deps/uv/ChangeLog b/deps/uv/ChangeLog
new file mode 100644 (file)
index 0000000..ff26795
--- /dev/null
@@ -0,0 +1,45 @@
+2013.02.04, Version 0.10.3 (Stable)
+
+Changes since version 0.10.2:
+
+* include: remove extraneous const from uv_version() (Ben Noordhuis)
+
+* doc: update README, replace `OS` by `PLATFORM` (Ben Noordhuis)
+
+* build: simplify .buildstamp rule (Ben Noordhuis)
+
+* build: disable -Wstrict-aliasing on darwin (Ben Noordhuis)
+
+* darwin: don't select(&exceptfds) in fallback path (Ben Noordhuis)
+
+* unix: don't clear flags after closing UDP handle (Saúl Ibarra Corretgé)
+
+
+2013.03.25, Version 0.10.2 (Stable)
+
+This is the first officially versioned release of libuv. Starting now
+libuv will make releases independently of Node.js.
+
+Changes since Node.js v0.10.0:
+
+* test: add tap output for windows (Timothy J. Fontaine)
+
+* unix: fix uv_tcp_simultaneous_accepts() logic (Ben Noordhuis)
+
+* include: bump UV_VERSION_MINOR (Ben Noordhuis)
+
+* unix: improve uv_guess_handle() implementation (Ben Noordhuis)
+
+* stream: run try_select only for pipes and ttys (Fedor Indutny)
+
+Changes since Node.js v0.10.1:
+
+* build: rename OS to PLATFORM (Ben Noordhuis)
+
+* unix: make uv_timer_init() initialize repeat (Brian Mazza)
+
+* unix: make timers handle large timeouts (Ben Noordhuis)
+
+* build: add OBJC makefile var (Ben Noordhuis)
+
+* Add `uv_version()` and `uv_version_string()` APIs (Bert Belder)
index cdddbd2..54740ca 100644 (file)
@@ -64,7 +64,7 @@ To build via Makefile simply execute:
 
 MinGW users should run this instead:
 
-    make OS=mingw
+    make PLATFORM=mingw
 
 Out-of-tree builds are supported:
 
index 400a6c4..84df27a 100644 (file)
@@ -35,7 +35,7 @@ RUNNER_LDFLAGS=$(LDFLAGS)
 RUNNER_LIBS=-lws2_32 -lpsapi -liphlpapi
 RUNNER_SRC=test/runner-win.c
 
-libuv.a: $(WIN_OBJS) src/fs-poll.o src/inet.o src/uv-common.o
+libuv.a: $(WIN_OBJS) src/fs-poll.o src/inet.o src/uv-common.o src/version.o
        $(AR) rcs $@ $^
 
 src/%.o: src/%.c include/uv.h include/uv-private/uv-win.h
index b5eeec1..f9f2c15 100644 (file)
@@ -18,6 +18,8 @@
 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 # IN THE SOFTWARE.
 
+OBJC ?= $(CC)
+
 E=
 CSTDFLAG=--std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter
 CFLAGS += -g
@@ -53,6 +55,7 @@ OBJS += src/unix/udp.o
 OBJS += src/fs-poll.o
 OBJS += src/uv-common.o
 OBJS += src/inet.o
+OBJS += src/version.o
 
 ifeq (sunos,$(PLATFORM))
 CPPFLAGS += -D__EXTENSIONS__ -D_XOPEN_SOURCE=500
@@ -145,7 +148,7 @@ include/uv-private/uv-unix.h: \
 src/unix/internal.h: src/unix/linux-syscalls.h
 
 src/.buildstamp src/unix/.buildstamp test/.buildstamp:
-       mkdir -p $(dir $@)
+       mkdir -p $(@D)
        touch $@
 
 src/unix/%.o src/unix/%.pic.o: src/unix/%.c include/uv.h include/uv-private/uv-unix.h src/unix/internal.h src/unix/.buildstamp
@@ -161,4 +164,4 @@ clean-platform:
        $(RM) test/run-{tests,benchmarks}.dSYM $(OBJS) $(OBJS:%.o=%.pic.o)
 
 %.pic.o %.o:  %.m
-       $(CC) $(CPPFLAGS) $(CFLAGS) -c $^ -o $@
+       $(OBJC) $(CPPFLAGS) $(CFLAGS) -c $^ -o $@
index 3986ec8..454783f 100644 (file)
@@ -229,6 +229,20 @@ typedef enum {
 
 
 /*
+ * Returns the libuv version packed into a single integer. 8 bits are used for
+ * each component, with the patch number stored in the 8 least significant
+ * bits. E.g. for libuv 1.2.3 this would return 0x010203.
+ */
+UV_EXTERN unsigned int uv_version(void);
+
+/*
+ * Returns the libuv version number as a string. For non-release versions
+ * "-pre" is appended, so the version number could be "1.2.3-pre".
+ */
+UV_EXTERN const char* uv_version_string(void);
+
+
+/*
  * This function must be called before any other functions in libuv.
  *
  * All functions besides uv_run() are non-blocking.
index d00fe23..d95fa0d 100644 (file)
@@ -131,7 +131,6 @@ static void uv__stream_osx_select(void* arg) {
   char buf[1024];
   fd_set sread;
   fd_set swrite;
-  fd_set serror;
   int events;
   int fd;
   int r;
@@ -154,17 +153,15 @@ static void uv__stream_osx_select(void* arg) {
     /* Watch fd using select(2) */
     FD_ZERO(&sread);
     FD_ZERO(&swrite);
-    FD_ZERO(&serror);
 
     if (uv_is_readable(stream))
       FD_SET(fd, &sread);
     if (uv_is_writable(stream))
       FD_SET(fd, &swrite);
-    FD_SET(fd, &serror);
     FD_SET(s->int_fd, &sread);
 
     /* Wait indefinitely for fd events */
-    r = select(max_fd + 1, &sread, &swrite, &serror, NULL);
+    r = select(max_fd + 1, &sread, &swrite, NULL, NULL);
     if (r == -1) {
       if (errno == EINTR)
         continue;
@@ -203,8 +200,6 @@ static void uv__stream_osx_select(void* arg) {
       events |= UV__POLLIN;
     if (FD_ISSET(fd, &swrite))
       events |= UV__POLLOUT;
-    if (FD_ISSET(fd, &serror))
-      events |= UV__POLLERR;
 
     uv_mutex_lock(&s->mutex);
     s->events |= events;
@@ -249,7 +244,8 @@ static void uv__stream_osx_select_cb(uv_async_t* handle, int status) {
   s->events = 0;
   uv_mutex_unlock(&s->mutex);
 
-  assert(0 == (events & UV__POLLERR));
+  assert(events != 0);
+  assert(events == (events & (UV__POLLIN | UV__POLLOUT)));
 
   /* Invoke callback on event-loop */
   if ((events & UV__POLLIN) && uv__io_active(&stream->io_watcher, UV__POLLIN))
index e1a12f2..3fb8af9 100644 (file)
@@ -79,7 +79,6 @@ void uv__udp_finish_close(uv_udp_t* handle) {
   }
 
   /* Now tear down the handle. */
-  handle->flags = 0;
   handle->recv_cb = NULL;
   handle->alloc_cb = NULL;
   /* but _do not_ touch close_cb */
diff --git a/deps/uv/src/version.c b/deps/uv/src/version.c
new file mode 100644 (file)
index 0000000..0ee0753
--- /dev/null
@@ -0,0 +1,60 @@
+/* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN 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.
+ */
+
+
+ /*
+ * Versions with an even minor version (e.g. 0.6.1 or 1.0.4) are API and ABI
+ * stable. When the minor version is odd, the API can change between patch
+ * releases.
+ */
+
+#define UV_VERSION_MAJOR 0
+#define UV_VERSION_MINOR 10
+#define UV_VERSION_PATCH 3
+#define UV_VERSION_IS_RELEASE 1
+
+
+#define UV_VERSION  ((UV_VERSION_MAJOR << 16) | \
+                     (UV_VERSION_MINOR <<  8) | \
+                     (UV_VERSION_PATCH))
+
+#define UV_STRINGIFY(v) UV_STRINGIFY_HELPER(v)
+#define UV_STRINGIFY_HELPER(v) #v
+
+#define UV_VERSION_STRING_BASE  UV_STRINGIFY(UV_VERSION_MAJOR) "." \
+                                UV_STRINGIFY(UV_VERSION_MINOR) "." \
+                                UV_STRINGIFY(UV_VERSION_PATCH)
+
+#if UV_VERSION_IS_RELEASE
+# define UV_VERSION_STRING  UV_VERSION_STRING_BASE
+#else
+# define UV_VERSION_STRING  UV_VERSION_STRING_BASE "-pre"
+#endif
+
+
+unsigned int uv_version(void) {
+  return UV_VERSION;
+}
+
+
+const char* uv_version_string(void) {
+  return UV_VERSION_STRING;
+}
index 37df5b6..1ffa6aa 100644 (file)
@@ -53,6 +53,7 @@ static uv_buf_t alloc_cb(uv_handle_t* handle, size_t suggested_size) {
 
 static void close_cb(uv_handle_t* handle) {
   CHECK_HANDLE(handle);
+  ASSERT(uv_is_closing(handle));
   close_cb_called++;
 }
 
index 0810bcc..db90ee9 100644 (file)
@@ -56,6 +56,7 @@
         'src/inet.c',
         'src/uv-common.c',
         'src/uv-common.h',
+        'src/version.c'
       ],
       'conditions': [
         [ 'OS=="win"', {
             '-pedantic',
             '-Wall',
             '-Wextra',
-            '-Wstrict-aliasing',
             '-Wno-unused-parameter',
           ],
           'sources': [
             '_DARWIN_USE_64_BIT_INODE=1',
           ]
         }],
+        [ 'OS!="mac"', {
+          # Enable on all platforms except OS X. The antique gcc/clang that
+          # ships with Xcode emits waaaay too many false positives.
+          'cflags': [ '-Wstrict-aliasing' ],
+        }],
         [ 'OS=="linux"', {
           'sources': [
             'src/unix/linux-core.c',
     }
   ]
 }
-
-
index 8725f94..370de49 100644 (file)
@@ -12,8 +12,8 @@ knowledge of several libraries:
 
  - [libuv](https://github.com/joyent/libuv), C event loop library.
    Anytime one needs to wait for a file descriptor to become readable,
-   wait for a timer, or wait for a signal to received one will need to
-   interface with libuv. That is, if you perform any I/O, libuv will
+   wait for a timer, or wait for a signal to be received one will need
+   to interface with libuv. That is, if you perform any I/O, libuv will
    need to be used.
 
  - Internal Node libraries. Most importantly is the `node::ObjectWrap`
index b652e88..dade323 100644 (file)
@@ -26,6 +26,19 @@ which can be piped to and from.
 The ChildProcess class is not intended to be used directly.  Use the
 `spawn()` or `fork()` methods to create a Child Process instance.
 
+### Event:  'error'
+
+* `err` {Error Object} the error.
+
+Emitted when:
+
+1. The process could not be spawned, or
+2. The process could not be killed, or
+3. Sending a message to the child process failed for whatever reason.
+
+See also [`ChildProcess#kill()`](#child_process_child_kill_signal) and
+[`ChildProcess#send()`](#child_process_child_send_message_sendhandle).
+
 ### Event:  'exit'
 
 * `code` {Number} the exit code, if it exited normally.
@@ -125,8 +138,15 @@ be sent `'SIGTERM'`. See `signal(7)` for a list of available signals.
     // send SIGHUP to process
     grep.kill('SIGHUP');
 
-Note that while the function is called `kill`, the signal delivered to the child
-process may not actually kill it.  `kill` really just sends a signal to a process.
+May emit an `'error'` event when the signal cannot be delivered. Sending a
+signal to a child process that has already exited is not an error but may
+have unforeseen consequences: if the PID (the process ID) has been reassigned
+to another process, the signal will be delivered to that process instead.
+What happens next is anyone's guess.
+
+Note that while the function is called `kill`, the signal delivered to the
+child process may not actually kill it.  `kill` really just sends a signal
+to a process.
 
 See `kill(2)`
 
@@ -172,6 +192,9 @@ The `sendHandle` option to `child.send()` is for sending a TCP server or
 socket object to another process. The child will receive the object as its
 second argument to the `message` event.
 
+Emits an `'error'` event if the message cannot be sent, for example because
+the child process has already exited.
+
 #### Example: sending server object
 
 Here is an example of sending a server:
index 63f2d49..2c68c1d 100644 (file)
@@ -97,7 +97,7 @@ prints the active watchers. To remove a watcher, type
 * `next`, `n` - Step next
 * `step`, `s` - Step in
 * `out`, `o` - Step out
-* `pause` - Pause running code (like pause button in Developer TOols)
+* `pause` - Pause running code (like pause button in Developer Tools)
 
 ### Breakpoints
 
index f6cec4c..1ad6e65 100644 (file)
@@ -7,7 +7,7 @@ use C-Ares except for `dns.lookup` which uses `getaddrinfo(3)` in a thread
 pool. C-Ares is much faster than `getaddrinfo` but the system resolver is
 more constant with how other programs operate. When a user does
 `net.connect(80, 'google.com')` or `http.get({ host: 'google.com' })` the
-`dns.lookup` method is used. Users who need to do a large number of look ups
+`dns.lookup` method is used. Users who need to do a large number of lookups
 quickly should use the methods that go through C-Ares.
 
 Here is an example which resolves `'www.google.com'` then reverse
index d0a6c87..4a0ee67 100644 (file)
@@ -7,17 +7,159 @@ single group.  If any of the event emitters or callbacks registered to a
 domain emit an `error` event, or throw an error, then the domain object
 will be notified, rather than losing the context of the error in the
 `process.on('uncaughtException')` handler, or causing the program to
-exit with an error code.
+exit immediately with an error code.
 
-This feature is new in Node version 0.8.  It is a first pass, and is
-expected to change significantly in future versions.  Please use it and
-provide feedback.
+## Warning: Don't Ignore Errors!
 
-Due to their experimental nature, the Domains features are disabled unless
-the `domain` module is loaded at least once.  No domains are created or
-registered by default.  This is by design, to prevent adverse effects on
-current programs.  It is expected to be enabled by default in future
-Node.js versions.
+<!-- type=misc -->
+
+Domain error handlers are not a substitute for closing down your
+process when an error occurs.
+
+By the very nature of how `throw` works in JavaScript, there is almost
+never any way to safely "pick up where you left off", without leaking
+references, or creating some other sort of undefined brittle state.
+
+The safest way to respond to a thrown error is to shut down the
+process.  Of course, in a normal web server, you might have many
+connections open, and it is not reasonable to abruptly shut those down
+because an error was triggered by someone else.
+
+The better approach is send an error response to the request that
+triggered the error, while letting the others finish in their normal
+time, and stop listening for new requests in that worker.
+
+In this way, `domain` usage goes hand-in-hand with the cluster module,
+since the master process can fork a new worker when a worker
+encounters an error.  For node programs that scale to multiple
+machines, the terminating proxy or service registry can take note of
+the failure, and react accordingly.
+
+For example, this is not a good idea:
+
+```javascript
+// XXX WARNING!  BAD IDEA!
+
+var d = require('domain').create();
+d.on('error', function(er) {
+  // The error won't crash the process, but what it does is worse!
+  // Though we've prevented abrupt process restarting, we are leaking
+  // resources like crazy if this ever happens.
+  // This is no better than process.on('uncaughtException')!
+  console.log('error, but oh well', er.message);
+});
+require('http').createServer(function(req, res) {
+  handleRequest(req, res);
+}).listen(PORT);
+```
+
+By using the context of a domain, and the resilience of separating our
+program into multiple worker processes, we can react more
+appropriately, and handle errors with much greater safety.
+
+```javascript
+// Much better!
+
+var cluster = require('cluster');
+var PORT = +process.env.PORT || 1337;
+
+if (cluster.isMaster) {
+  // In real life, you'd probably use more than just 2 workers,
+  // and perhaps not put the master and worker in the same file.
+  //
+  // You can also of course get a bit fancier about logging, and
+  // implement whatever custom logic you need to prevent DoS
+  // attacks and other bad behavior.
+  //
+  // See the options in the cluster documentation.
+  //
+  // The important thing is that the master does very little,
+  // increasing our resilience to unexpected errors.
+
+  cluster.fork();
+  cluster.fork();
+
+  cluster.on('disconnect', function(worker) {
+    console.error('disconnect!');
+    cluster.fork();
+  });
+
+} else {
+  // the worker
+  //
+  // This is where we put our bugs!
+
+  var domain = require('domain');
+
+  // See the cluster documentation for more details about using
+  // worker processes to serve requests.  How it works, caveats, etc.
+
+  var server = require('http').createServer(function(req, res) {
+    var d = domain.create();
+    d.on('error', function(er) {
+      console.error('error', er.stack);
+
+      // Note: we're in dangerous territory!
+      // By definition, something unexpected occurred,
+      // which we probably didn't want.
+      // Anything can happen now!  Be very careful!
+
+      try {
+        // make sure we close down within 30 seconds
+        var killtimer = setTimeout(function() {
+          process.exit(1);
+        }, 30000);
+        // But don't keep the process open just for that!
+        killtimer.unref();
+
+        // stop taking new requests.
+        server.close();
+
+        // Let the master know we're dead.  This will trigger a
+        // 'disconnect' in the cluster master, and then it will fork
+        // a new worker.
+        cluster.worker.disconnect();
+
+        // try to send an error to the request that triggered the problem
+        res.statusCode = 500;
+        res.setHeader('content-type', 'text/plain');
+        res.end('Oops, there was a problem!\n');
+      } catch (er2) {
+        // oh well, not much we can do at this point.
+        console.error('Error sending 500!', er2.stack);
+      }
+    });
+
+    // Because req and res were created before this domain existed,
+    // we need to explicitly add them.
+    // See the explanation of implicit vs explicit binding below.
+    d.add(req);
+    d.add(res);
+
+    // Now run the handler function in the domain.
+    d.run(function() {
+      handleRequest(req, res);
+    });
+  });
+  server.listen(PORT);
+}
+
+// This part isn't important.  Just an example routing thing.
+// You'd put your fancy application logic here.
+function handleRequest(req, res) {
+  switch(req.url) {
+    case '/error':
+      // We do some async stuff, and then...
+      setTimeout(function() {
+        // Whoops!
+        flerb.bark();
+      });
+      break;
+    default:
+      res.end('ok');
+  }
+}
+```
 
 ## Additions to Error objects
 
@@ -38,7 +180,7 @@ are added to it.
 
 <!--type=misc-->
 
-If domains are in use, then all new EventEmitter objects (including
+If domains are in use, then all **new** EventEmitter objects (including
 Stream objects, requests, responses, etc.) will be implicitly bound to
 the active domain at the time of their creation.
 
@@ -53,7 +195,7 @@ were, then it would be too easy to prevent request and response objects
 from being properly garbage collected.
 
 If you *want* to nest Domain objects as children of a parent Domain,
-then you must explicitly add them, and then dispose of them later.
+then you must explicitly add them.
 
 Implicit binding routes thrown errors and `'error'` events to the
 Domain's `error` event, but does not register the EventEmitter on the
@@ -94,14 +236,8 @@ serverDomain.run(function() {
       try {
         res.writeHead(500);
         res.end('Error occurred, sorry.');
-        res.on('close', function() {
-          // forcibly shut down any other things added to this domain
-          reqd.dispose();
-        });
       } catch (er) {
         console.error('Error sending 500', er, req.url);
-        // tried our best.  clean up anything remaining.
-        reqd.dispose();
       }
     });
   }).listen(1337);
index c17c6b2..a6f0641 100644 (file)
@@ -230,7 +230,7 @@ The response implements the [Writable Stream][] interface. This is an
 
 `function () { }`
 
-Indicates that the underlaying connection was terminated before
+Indicates that the underlying connection was terminated before
 `response.end()` was called or able to flush.
 
 ### response.writeContinue()
index 104fb8c..36e1f2d 100644 (file)
@@ -46,7 +46,7 @@ of the `tty.ReadStream` instance.
 to the resulting mode.
 
 
-## Class WriteStream
+## Class: WriteStream
 
 A `net.Socket` subclass that represents the writable portion of a tty. In normal
 circumstances, `process.stdout` will be the only `tty.WriteStream` instance
diff --git a/doc/blog/release/v0.10.2.md b/doc/blog/release/v0.10.2.md
new file mode 100644 (file)
index 0000000..92e834d
--- /dev/null
@@ -0,0 +1,87 @@
+date: Thu Mar 28 13:00:39 PDT 2013
+version: 0.10.2
+category: release
+title: Node v0.10.2 (Stable)
+slug: node-v0-10-2-stable
+
+2013.03.28, Version 0.10.2 (Stable)
+
+* npm: Upgrade to 1.2.15
+
+* uv: Upgrade to 0.10.3
+
+* tls: handle SSL_ERROR_ZERO_RETURN (Fedor Indutny)
+
+* tls: handle errors before calling C++ methods (Fedor Indutny)
+
+* tls: remove harmful unnecessary bounds checking (Marcel Laverdet)
+
+* crypto: make getCiphers() return non-SSL ciphers (Ben Noordhuis)
+
+* crypto: check randomBytes() size argument (Ben Noordhuis)
+
+* timers: do not calculate Timeout._when property (Alexey Kupershtokh)
+
+* timers: fix off-by-one ms error (Alexey Kupershtokh)
+
+* timers: handle signed int32 overflow in enroll() (Fedor Indutny)
+
+* stream: Fix stall in Transform under very specific conditions (Gil Pedersen)
+
+* stream: Handle late 'readable' event listeners (isaacs)
+
+* stream: Fix early end in Writables on zero-length writes (isaacs)
+
+* domain: fix domain callback from MakeCallback (Trevor Norris)
+
+* child_process: don't emit same handle twice (Ben Noordhuis)
+
+* child_process: fix sending utf-8 to child process (Ben Noordhuis)
+
+
+Source Code: http://nodejs.org/dist/v0.10.2/node-v0.10.2.tar.gz
+
+Macintosh Installer (Universal): http://nodejs.org/dist/v0.10.2/node-v0.10.2.pkg
+
+Windows Installer: http://nodejs.org/dist/v0.10.2/node-v0.10.2-x86.msi
+
+Windows x64 Installer: http://nodejs.org/dist/v0.10.2/x64/node-v0.10.2-x64.msi
+
+Windows x64 Files: http://nodejs.org/dist/v0.10.2/x64/
+
+Linux 32-bit Binary: http://nodejs.org/dist/v0.10.2/node-v0.10.2-linux-x86.tar.gz
+
+Linux 64-bit Binary: http://nodejs.org/dist/v0.10.2/node-v0.10.2-linux-x64.tar.gz
+
+Solaris 32-bit Binary: http://nodejs.org/dist/v0.10.2/node-v0.10.2-sunos-x86.tar.gz
+
+Solaris 64-bit Binary: http://nodejs.org/dist/v0.10.2/node-v0.10.2-sunos-x64.tar.gz
+
+Other release files: http://nodejs.org/dist/v0.10.2/
+
+Website: http://nodejs.org/docs/v0.10.2/
+
+Documentation: http://nodejs.org/docs/v0.10.2/api/
+
+Shasums:
+
+```
+860ed25d3e77d4676b5512f87f3f98b6783ee258  node-v0.10.2-darwin-x64.tar.gz
+811eb3b66651dfffeaf928496e8eecab5c9304fb  node-v0.10.2-darwin-x86.tar.gz
+0013be477da5d066471390c9964f796356b48948  node-v0.10.2-linux-x64.tar.gz
+97c3a052d833bfc799bc9b748520a15cfb189a58  node-v0.10.2-linux-x86.tar.gz
+17bc5bf26af7da790e6b0c4cbb2b73ea1c9f2ed5  node-v0.10.2-sunos-x64.tar.gz
+5e02e35cc15ae56953921ad4c8e45b849c736e20  node-v0.10.2-sunos-x86.tar.gz
+2adb1bf5919fb8adeaf96edd8a8ed16d71a3f8f8  node-v0.10.2-x86.msi
+73ff97a4d2d3bb1f468db2654b5b59a28f868cce  node-v0.10.2.pkg
+759a05eff48ff0b54e55748012c5c45502f7cecd  node-v0.10.2.tar.gz
+6c1336a61395747fed20a12c8977a2b2ecf23354  node.exe
+f0775d4f649ee9c3d5614fdb26e64bc7d000cd5d  node.exp
+9860c6eb9062fbdc50b515f4ccab179f74dd3ec8  node.lib
+d41d99a3921022533c1760e15447ce3acf050a7d  node.pdb
+1dbd11a5278831356daca035fe5bbbe1062798b4  x64/node-v0.10.2-x64.msi
+d36abd4ecf02c522e8c75fce24eab1ce800d6458  x64/node.exe
+295a950fe3c1c3ceb04249474388b891bf2a39ed  x64/node.exp
+b64eabafc3f9498552b3ea97bd0d922db1f90f75  x64/node.lib
+1f31d6c0079e9f2c9a6de3d956649d83ca6e7a25  x64/node.pdb
+```
index b81f2a8..e30a327 100644 (file)
@@ -65,6 +65,7 @@ function ReadableState(options, stream) {
   // that we're awaiting a 'readable' event emission.
   this.needReadable = false;
   this.emittedReadable = false;
+  this.readableListening = false;
 
 
   // object stream flag. Used to make read(n) ignore n and to
@@ -235,7 +236,7 @@ Readable.prototype.read = function(n) {
   // the 'readable' event and move on.
   if (n === 0 &&
       state.needReadable &&
-      state.length >= state.highWaterMark) {
+      (state.length >= state.highWaterMark || state.ended)) {
     emitReadable(this);
     return null;
   }
@@ -378,7 +379,6 @@ function emitReadable(stream) {
 }
 
 function emitReadable_(stream) {
-  var state = stream._readableState;
   stream.emit('readable');
 }
 
@@ -655,8 +655,19 @@ Readable.prototype.on = function(ev, fn) {
   if (ev === 'data' && !this._readableState.flowing)
     emitDataEvents(this);
 
-  if (ev === 'readable' && !this._readableState.reading)
-    this.read(0);
+  if (ev === 'readable' && this.readable) {
+    var state = this._readableState;
+    if (!state.readableListening) {
+      state.readableListening = true;
+      state.emittedReadable = false;
+      state.needReadable = true;
+      if (!state.reading) {
+        this.read(0);
+      } else if (state.length) {
+        emitReadable(this, state);
+      }
+    }
+  }
 
   return res;
 };
index 5d38177..80a64c6 100644 (file)
@@ -32,9 +32,8 @@ var endMethods = ['end', 'abort', 'destroy', 'destroySoon'];
 // a few side effects.
 events.usingDomains = true;
 
-// replace tickers with domain specific implementation
-process.nextTick = process._nextDomainTick;
-process._tickCallback = process._tickDomainCallback;
+// let the process know we're using domains
+process._usingDomains();
 
 exports.Domain = Domain;
 
index 3900d61..8431b2d 100644 (file)
@@ -263,12 +263,15 @@ var Timeout = function(after) {
   this._idleTimeout = after;
   this._idlePrev = this;
   this._idleNext = this;
-  this._when = Date.now() + after;
+  this._idleStart = null;
+  this._onTimeout = null;
 };
 
 Timeout.prototype.unref = function() {
   if (!this._handle) {
-    var delay = this._when - Date.now();
+    var now = Date.now();
+    if (!this._idleStart) this._idleStart = now;
+    var delay = this._idleStart + this._idleTimeout - now;
     if (delay < 0) delay = 0;
     exports.unenroll(this);
     this._handle = new Timer();
index 334f411..f0cdaac 100644 (file)
@@ -335,7 +335,10 @@ CryptoStream.prototype._write = function write(data, encoding, cb) {
       written = this.pair.ssl.encIn(data, 0, data.length);
     }
 
-    var self = this;
+    // Handle and report errors
+    if (this.pair.ssl && this.pair.ssl.error) {
+      return cb(this.pair.error(true));
+    }
 
     // Force SSL_read call to cycle some states/data inside OpenSSL
     this.pair.cleartext.read(0);
@@ -345,11 +348,6 @@ CryptoStream.prototype._write = function write(data, encoding, cb) {
       this.pair.encrypted.read(0);
     }
 
-    // Handle and report errors
-    if (this.pair.ssl && this.pair.ssl.error) {
-      return cb(this.pair.error());
-    }
-
     // Get NPN and Server name when ready
     this.pair.maybeInitFinished();
 
@@ -919,24 +917,28 @@ SecurePair.prototype.destroy = function() {
 };
 
 
-SecurePair.prototype.error = function() {
+SecurePair.prototype.error = function(returnOnly) {
   var err = this.ssl.error;
   this.ssl.error = null;
 
   if (!this._secureEstablished) {
-    if (!err) {
-      err = new Error('socket hang up');
-      err.code = 'ECONNRESET';
+    // Emit ECONNRESET instead of zero return
+    if (!err || err.message === 'ZERO_RETURN') {
+      var connReset = new Error('socket hang up');
+      connReset.code = 'ECONNRESET';
+      connReset.sslError = err && err.message;
+
+      err = connReset;
     }
     this.destroy();
-    this.emit('error', err);
+    if (!returnOnly) this.emit('error', err);
   } else if (this._isServer &&
              this._rejectUnauthorized &&
              /peer did not return a certificate/.test(err.message)) {
     // Not really an error.
     this.destroy();
   } else {
-    this.cleartext.emit('error', err);
+    if (!returnOnly) this.cleartext.emit('error', err);
   }
   return err;
 };
index 93dbd4d..467ba3e 100644 (file)
@@ -102,7 +102,6 @@ Persistent<String> domain_symbol;
 // declared in node_internals.h
 Persistent<Object> process;
 
-static Persistent<Function> process_tickDomainCallback;
 static Persistent<Function> process_tickFromSpinner;
 static Persistent<Function> process_tickCallback;
 
@@ -134,6 +133,7 @@ static bool use_debug_agent = false;
 static bool debug_wait_connect = false;
 static int debug_port=5858;
 static int max_stack_size = 0;
+static bool using_domains = false;
 
 // used by C++ modules as well
 bool no_deprecation = false;
@@ -899,6 +899,30 @@ Handle<Value> FromConstructorTemplate(Persistent<FunctionTemplate> t,
 }
 
 
+Handle<Value> UsingDomains(const Arguments& args) {
+  HandleScope scope;
+  if (using_domains)
+    return scope.Close(Undefined());
+  using_domains = true;
+  Local<Value> tdc_v = process->Get(String::New("_tickDomainCallback"));
+  Local<Value> ndt_v = process->Get(String::New("_nextDomainTick"));
+  if (!tdc_v->IsFunction()) {
+    fprintf(stderr, "process._tickDomainCallback assigned to non-function\n");
+    abort();
+  }
+  if (!ndt_v->IsFunction()) {
+    fprintf(stderr, "process._nextDomainTick assigned to non-function\n");
+    abort();
+  }
+  Local<Function> tdc = tdc_v.As<Function>();
+  Local<Function> ndt = ndt_v.As<Function>();
+  process->Set(String::New("_tickCallback"), tdc);
+  process->Set(String::New("nextTick"), ndt);
+  process_tickCallback = Persistent<Function>::New(tdc);
+  return Undefined();
+}
+
+
 Handle<Value>
 MakeDomainCallback(const Handle<Object> object,
                    const Handle<Function> callback,
@@ -906,17 +930,6 @@ MakeDomainCallback(const Handle<Object> object,
                    Handle<Value> argv[]) {
   // TODO Hook for long stack traces to be made here.
 
-  // lazy load _tickDomainCallback
-  if (process_tickDomainCallback.IsEmpty()) {
-    Local<Value> cb_v = process->Get(String::New("_tickDomainCallback"));
-    if (!cb_v->IsFunction()) {
-      fprintf(stderr, "process._tickDomainCallback assigned to non-function\n");
-      abort();
-    }
-    Local<Function> cb = cb_v.As<Function>();
-    process_tickDomainCallback = Persistent<Function>::New(node_isolate, cb);
-  }
-
   // lazy load domain specific symbols
   if (enter_symbol.IsEmpty()) {
     enter_symbol = NODE_PSYMBOL("enter");
@@ -931,19 +944,22 @@ MakeDomainCallback(const Handle<Object> object,
 
   TryCatch try_catch;
 
-  domain = domain_v->ToObject();
-  assert(!domain.IsEmpty());
-  if (domain->Get(disposed_symbol)->IsTrue()) {
-    // domain has been disposed of.
-    return Undefined(node_isolate);
-  }
-  enter = Local<Function>::Cast(domain->Get(enter_symbol));
-  assert(!enter.IsEmpty());
-  enter->Call(domain, 0, NULL);
+  bool has_domain = domain_v->IsObject();
+  if (has_domain) {
+    domain = domain_v->ToObject();
+    assert(!domain.IsEmpty());
+    if (domain->Get(disposed_symbol)->IsTrue()) {
+      // domain has been disposed of.
+      return Undefined(node_isolate);
+    }
+    enter = Local<Function>::Cast(domain->Get(enter_symbol));
+    assert(!enter.IsEmpty());
+    enter->Call(domain, 0, NULL);
 
-  if (try_catch.HasCaught()) {
-    FatalException(try_catch);
-    return Undefined(node_isolate);
+    if (try_catch.HasCaught()) {
+      FatalException(try_catch);
+      return Undefined(node_isolate);
+    }
   }
 
   Local<Value> ret = callback->Call(object, argc, argv);
@@ -953,13 +969,15 @@ MakeDomainCallback(const Handle<Object> object,
     return Undefined(node_isolate);
   }
 
-  exit = Local<Function>::Cast(domain->Get(exit_symbol));
-  assert(!exit.IsEmpty());
-  exit->Call(domain, 0, NULL);
+  if (has_domain) {
+    exit = Local<Function>::Cast(domain->Get(exit_symbol));
+    assert(!exit.IsEmpty());
+    exit->Call(domain, 0, NULL);
 
-  if (try_catch.HasCaught()) {
-    FatalException(try_catch);
-    return Undefined(node_isolate);
+    if (try_catch.HasCaught()) {
+      FatalException(try_catch);
+      return Undefined(node_isolate);
+    }
   }
 
   if (tick_infobox.length == 0) {
@@ -969,7 +987,7 @@ MakeDomainCallback(const Handle<Object> object,
   }
 
   // process nextTicks after call
-  process_tickDomainCallback->Call(process, 0, NULL);
+  process_tickCallback->Call(process, 0, NULL);
 
   if (try_catch.HasCaught()) {
     FatalException(try_catch);
@@ -1033,10 +1051,8 @@ MakeCallback(const Handle<Object> object,
   HandleScope scope(node_isolate);
 
   Local<Function> callback = object->Get(symbol).As<Function>();
-  Local<Value> domain = object->Get(domain_symbol);
 
-  // has domain, off with you
-  if (!domain->IsNull() && !domain->IsUndefined())
+  if (using_domains)
     return scope.Close(MakeDomainCallback(object, callback, argc, argv));
   return scope.Close(MakeCallback(object, callback, argc, argv));
 }
@@ -2347,9 +2363,7 @@ Handle<Object> SetupProcessObject(int argc, char *argv[]) {
   versions->Set(String::NewSymbol("node"), String::New(NODE_VERSION+1));
   versions->Set(String::NewSymbol("v8"), String::New(V8::GetVersion()));
   versions->Set(String::NewSymbol("ares"), String::New(ARES_VERSION_STR));
-  versions->Set(String::NewSymbol("uv"), String::New(
-               NODE_STRINGIFY(UV_VERSION_MAJOR) "."
-               NODE_STRINGIFY(UV_VERSION_MINOR)));
+  versions->Set(String::NewSymbol("uv"), String::New(uv_version_string()));
   versions->Set(String::NewSymbol("zlib"), String::New(ZLIB_VERSION));
 #if HAVE_OPENSSL
   // Stupid code to slice out the version string.
@@ -2495,6 +2509,8 @@ Handle<Object> SetupProcessObject(int argc, char *argv[]) {
 
   NODE_SET_METHOD(process, "binding", Binding);
 
+  NODE_SET_METHOD(process, "_usingDomains", UsingDomains);
+
   // values use to cross communicate with processNextTick
   Local<Object> info_box = Object::New();
   info_box->SetIndexedPropertiesToExternalArrayData(&tick_infobox,
index 5e40fab..e5833cb 100644 (file)
     var index = 1;
     var depth = 2;
 
-    process._tickCallback = _tickCallback;
-    process._tickFromSpinner = _tickFromSpinner;
-    // needs to be accessible from cc land
-    process._tickDomainCallback = _tickDomainCallback;
     process.nextTick = nextTick;
+    // needs to be accessible from cc land
     process._nextDomainTick = _nextDomainTick;
+    process._tickCallback = _tickCallback;
+    process._tickDomainCallback = _tickDomainCallback;
+    process._tickFromSpinner = _tickFromSpinner;
 
     // the maximum number of times it'll process something like
     // nextTick(function f(){nextTick(f)})
index 5adb7e5..37a7c25 100644 (file)
@@ -945,6 +945,11 @@ int Connection::HandleSSLError(const char* func, int rv, ZeroStatus zs) {
     DEBUG_PRINT("[%p] SSL: %s want read\n", ssl_, func);
     return 0;
 
+  } else if (err == SSL_ERROR_ZERO_RETURN) {
+    handle_->Set(String::New("error"),
+                 Exception::Error(String::New("ZERO_RETURN")));
+    return rv;
+
   } else {
     HandleScope scope(node_isolate);
     BUF_MEM* mem;
diff --git a/test/simple/test-domain-from-timer.js b/test/simple/test-domain-from-timer.js
new file mode 100644 (file)
index 0000000..3e73a5c
--- /dev/null
@@ -0,0 +1,39 @@
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN 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.
+
+
+// Simple tests of most basic domain functionality.
+
+var common = require('../common');
+var assert = require('assert');
+
+// timeouts call the callback directly from cc, so need to make sure the
+// domain will be used regardless
+setTimeout(function() {
+  var domain = require('domain');
+  var d = domain.create();
+  d.run(function() {
+    process.nextTick(function() {
+      console.trace('in nexttick', process.domain === d)
+      assert.equal(process.domain, d);
+    });
+  });
+});
diff --git a/test/simple/test-stream-readable-event.js b/test/simple/test-stream-readable-event.js
new file mode 100644 (file)
index 0000000..fdbcb48
--- /dev/null
@@ -0,0 +1,106 @@
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN 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.
+
+var common = require('../common');
+var assert = require('assert');
+
+var Readable = require('stream').Readable;
+
+(function first() {
+  // First test, not reading when the readable is added.
+  // make sure that read(0) triggers a readable event.
+  var r = new Readable({
+    highWaterMark: 3
+  });
+
+  r._read = function(n) {
+    r.push(new Buffer(new Array(n + 1).join('x')));
+  };
+
+  // This triggers a 'readable' event, which is lost.
+  r.push(new Buffer('blerg'));
+
+  var caughtReadable = false;
+  setTimeout(function() {
+    r.on('readable', function() {
+      caughtReadable = true;
+    });
+  });
+
+  process.on('exit', function() {
+    assert(caughtReadable);
+    console.log('ok 1');
+  });
+})();
+
+(function second() {
+  // second test, make sure that readable is re-emitted if there's
+  // already a length, while it IS reading.
+
+  var r = new Readable({
+    highWaterMark: 3
+  });
+
+  r._read = function(n) {
+    setTimeout(function() {
+      r.push(new Buffer(new Array(n + 1).join('x')));
+    });
+  };
+
+  // This triggers a 'readable' event, which is lost.
+  r.push(new Buffer('blerg'));
+
+  var caughtReadable = false;
+  process.nextTick(function() {
+    r.on('readable', function() {
+      caughtReadable = true;
+    });
+  });
+
+  process.on('exit', function() {
+    assert(caughtReadable);
+    console.log('ok 2');
+  });
+})();
+
+(function third() {
+  // Third test, not reading when the stream has not passed
+  // the highWaterMark but *has* reached EOF.
+  var r = new Readable({
+    highWaterMark: 30
+  });
+
+  // This triggers a 'readable' event, which is lost.
+  r.push(new Buffer('blerg'));
+  r.push(null);
+
+  var caughtReadable = false;
+  setTimeout(function() {
+    r.on('readable', function() {
+      caughtReadable = true;
+    });
+  });
+
+  process.on('exit', function() {
+    assert(caughtReadable);
+    console.log('ok 3');
+  });
+})();
diff --git a/test/simple/test-tls-client-abort3.js b/test/simple/test-tls-client-abort3.js
new file mode 100644 (file)
index 0000000..7272518
--- /dev/null
@@ -0,0 +1,68 @@
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN 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.
+
+if (!process.versions.openssl) {
+  console.error('Skipping because node compiled without OpenSSL.');
+  process.exit(0);
+}
+
+var common = require('../common');
+var common = require('../common');
+var tls = require('tls');
+var fs = require('fs');
+var assert = require('assert');
+
+var options = {
+  key: fs.readFileSync(common.fixturesDir + '/test_key.pem'),
+  cert: fs.readFileSync(common.fixturesDir + '/test_cert.pem')
+};
+
+var gotError = 0,
+    gotRequest = 0,
+    connected = 0;
+
+var server = tls.createServer(options, function(c) {
+  gotRequest++;
+  c.on('data', function(data) {
+    console.log(data.toString());
+  });
+
+  c.on('close', function() {
+    server.close();
+  });
+}).listen(common.PORT, function() {
+  var c = tls.connect(common.PORT, { rejectUnauthorized: false }, function() {
+    connected++;
+    c.pair.ssl.shutdown();
+    c.write('123');
+    c.destroy();
+  });
+
+  c.once('error', function() {
+    gotError++;
+  });
+});
+
+process.once('exit', function() {
+  assert.equal(gotError, 1);
+  assert.equal(gotRequest, 1);
+  assert.equal(connected, 1);
+});
index 69bed92..c4bdc1b 100644 (file)
@@ -168,7 +168,9 @@ function test(clazz) {
 
   buffer.writeDoubleBE(NaN, 0);
   buffer.writeDoubleLE(NaN, 8);
-  ASSERT.equal(0x7F, buffer[0]);
+  // Darwin ia32 does the other kind of NaN.
+  // Compiler bug.  No one really cares.
+  ASSERT(0x7F === buffer[0] || 0xFF === buffer[0]);
   ASSERT.equal(0xF8, buffer[1]);
   ASSERT.equal(0x00, buffer[2]);
   ASSERT.equal(0x00, buffer[3]);
@@ -183,7 +185,9 @@ function test(clazz) {
   ASSERT.equal(0x00, buffer[12]);
   ASSERT.equal(0x00, buffer[13]);
   ASSERT.equal(0xF8, buffer[14]);
-  ASSERT.equal(0x7F, buffer[15]);
+  // Darwin ia32 does the other kind of NaN.
+  // Compiler bug.  No one really cares.
+  ASSERT(0x7F === buffer[15] || 0xFF === buffer[15]);
   ASSERT.ok(isNaN(buffer.readDoubleBE(0)));
   ASSERT.ok(isNaN(buffer.readDoubleLE(8)));
 }
index 626a11f..f72cede 100644 (file)
@@ -99,7 +99,9 @@ function test(clazz) {
 
   buffer.writeFloatBE(-Infinity, 0);
   buffer.writeFloatLE(-Infinity, 4);
-  ASSERT.equal(0xFF, buffer[0]);
+  // Darwin ia32 does the other kind of NaN.
+  // Compiler bug.  No one really cares.
+  ASSERT(0xFF === buffer[0] || 0x7F === buffer[0]);
   ASSERT.equal(0x80, buffer[1]);
   ASSERT.equal(0x00, buffer[2]);
   ASSERT.equal(0x00, buffer[3]);
@@ -112,14 +114,18 @@ function test(clazz) {
 
   buffer.writeFloatBE(NaN, 0);
   buffer.writeFloatLE(NaN, 4);
-  ASSERT.equal(0x7F, buffer[0]);
+  // Darwin ia32 does the other kind of NaN.
+  // Compiler bug.  No one really cares.
+  ASSERT(0x7F === buffer[0] || 0xFF === buffer[0]);
   ASSERT.equal(0xc0, buffer[1]);
   ASSERT.equal(0x00, buffer[2]);
   ASSERT.equal(0x00, buffer[3]);
   ASSERT.equal(0x00, buffer[4]);
   ASSERT.equal(0x00, buffer[5]);
   ASSERT.equal(0xc0, buffer[6]);
-  ASSERT.equal(0x7F, buffer[7]);
+  // Darwin ia32 does the other kind of NaN.
+  // Compiler bug.  No one really cares.
+  ASSERT(0x7F === buffer[7] || 0xFF === buffer[7]);
   ASSERT.ok(isNaN(buffer.readFloatBE(0)));
   ASSERT.ok(isNaN(buffer.readFloatLE(4)));
 }