0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
Commit Graph

10045 Commits

Author SHA1 Message Date
Timothy J Fontaine
99c9930ad6 Merge remote-tracking branch 'upstream/v0.10' into v0.11.13-release 2014-05-01 17:49:51 -07:00
Timothy J Fontaine
b148cbe09d 2014.05.01, Version 0.10.28 (Stable)
* npm: upgrade to v1.4.9
2014-05-01 17:47:47 -07:00
isaacs
dbec0a0cd8 npm: upgrade to v1.4.9
* Send referer header (with any potentially private stuff redacted)
* Fix critical typo bug in previous npm release
2014-05-01 16:30:33 -07:00
Timothy J Fontaine
89223ae860 2014.05.01, Version 0.11.13 (Unstable)
* v8: upgrade to 3.24.35.22

* buffer: add compare and equals methods (Sean McArthur)

* buffer: improve {read,write}{U}Int* methods (Nick Apperson)

* buffer: return uint if MSB is 1 in readUInt32 (goussardg)

* buffer: truncate buffer after string decode (Fedor Indutny)

* child_process: fix assertion error in spawnSync (Shigeki Ohtsu)

* crypto: fix memory leak in CipherBase::Final (Fedor Indutny)

* crypto: improve error messages (Ingmar Runge)

* crypto: move `createCredentials` to tls (Fedor Indutny)

* crypto: work around OpenSSL oddness (Fedor Indutny)

* dgram: introduce `reuseAddr` option (Fedor Indutny)

* domain: don't crash on "throw null" (Alex Kocharin)

* events: check if _events is an own property (Vladimir Kurchatkin)

* fs: improve performance of all stat functions (James Pickard)

* fs: return blksize on stats object (Trevor Norris)

* http: add request.flush() method (Ben Noordhuis)

* http: better client "protocol not supported" error (Nathan Rajlich)

* http: use defaultAgent.protocol in protocol check (Nathan Rajlich)

* main: Handle SIGINT properly. (Geir Hauge)

* net: bind to `::` TCP address by default (Fedor Indutny)

* readline: consider newlines for cursor position (Yazhong Liu)

* stream: split `objectMode` for Duplex (Vladimir Kurchatkin)

* tls: `getPeerCertificate(detailed)` (Fedor Indutny)

* tls: do not call SNICallback unless present (Fedor Indutny)

* tls: force readable/writable to `true` (Fedor Indutny)

* tls: support OCSP on client and server (Fedor Indutny)

* util: made util.isArray a direct alias for Array.isArray (Evan Carroll)
2014-05-01 16:06:44 -07:00
Timothy J Fontaine
8637a40ea8 Merge remote-tracking branch 'upstream/v0.10'
Conflicts:
	AUTHORS
	ChangeLog
	src/node_version.h
2014-05-01 15:44:47 -07:00
Timothy J Fontaine
1285008fca Now working on 0.10.28 2014-05-01 15:30:07 -07:00
Timothy J Fontaine
7abd826366 Merge branch 'v0.10.27-release' into v0.10 2014-05-01 15:29:52 -07:00
Timothy J Fontaine
cb7911f78a 2014.05.01, Version 0.10.27 (Stable)
* npm: upgrade to v1.4.8

* openssl: upgrade to 1.0.1g

* uv: update to v0.10.27

* dns: fix certain txt entries (Fedor Indutny)

* assert: Ensure reflexivity of deepEqual (Mike Pennisi)

* child_process: fix deadlock when sending handles (Fedor Indutny)

* child_process: fix sending handle twice (Fedor Indutny)

* crypto: do not lowercase cipher/hash names (Fedor Indutny)

* dtrace: workaround linker bug on FreeBSD (Fedor Indutny)

* http: do not emit EOF non-readable socket (Fedor Indutny)

* http: invoke createConnection when no agent (Nathan Rajlich)

* stream: remove useless check (Brian White)

* timer: don't reschedule timer bucket in a domain (Greg Brail)

* url: treat  the same as / (isaacs)

* util: format as Error if instanceof Error (Rod Vagg)
2014-05-01 14:04:20 -07:00
Timothy J Fontaine
b19b60a05c Merge remote-tracking branch 'upstream/v0.10'
Reverted 9520adeb37

Conflicts:
	deps/cares/src/ares_parse_txt_reply.c
	deps/uv/.mailmap
	deps/uv/AUTHORS
	deps/uv/ChangeLog
	deps/uv/include/uv.h
	deps/uv/src/unix/error.c
	deps/uv/src/unix/process.c
	deps/uv/src/version.c
	deps/uv/src/win/pipe.c
	deps/uv/src/win/signal.c
	deps/uv/src/win/util.c
	deps/uv/test/test-spawn.c
	deps/uv/vcbuild.bat
	deps/v8/src/platform-posix.cc
	deps/v8/tools/gyp/v8.gyp
	lib/util.js
	src/node.cc
	test/simple/test-util-format.js
	test/simple/test-util.js
2014-05-01 13:54:23 -07:00
isaacs
f76c3938d0 npm: upgrade to v1.4.8
* Check SHA before using files from cache
* adduser: allow change of the saved password
* Make `npm install` respect `config.unicode`
* Fix lifecycle to pass `Infinity` for config env value
* Don't return 0 exit code on invalid command
* cache: Handle 404s and other HTTP errors as errors
* bump tap dep, make tests stderr a bit quieter
* Resolve ~ in path configs to env.HOME
* Include npm version in default user-agent conf
* npm init: Use ISC as default license, use save-prefix for deps
* Many test and doc fixes
2014-05-01 11:09:00 -07:00
Trevor Norris
d1fe6857ba buffer: normalize compare() output
Because of differences in memcmp() implementation, normalize output to
return -1, 0 or 1 only.

Signed-off-by: Timothy J Fontaine <tjfontaine@gmail.com>
2014-05-01 09:40:54 -07:00
Timothy J Fontaine
1038959dbf uv: update to v0.10.27 2014-05-01 09:27:39 -07:00
Fedor Indutny
3d3d48d4b7 deps: update uv to v0.11.25 2014-05-01 20:26:26 +04:00
Vladimir Kurchatkin
d0fc5538d1 stream: split objectMode for Duplex
This commit introduces `readableObjectMode` and
`writableObjectMode` options for Duplex streams.
This can be used mostly to make parsers and
serializers with Transform streams.

Also the docs section about stream state objects
is removed, because it is not relevant anymore.
The example from the section is remade to show
new options.

fixes #6284

Signed-off-by: Timothy J Fontaine <tjfontaine@gmail.com>
2014-04-30 10:44:31 -07:00
Timothy J Fontaine
7b72e15665 test: update test-dns.js after a60a9b0
resolveTxt now returns a 2-d array for all the chunks string chunks
relating to the record
2014-04-30 09:14:55 -07:00
Shigeki Ohtsu
ab7a3d098d child_process: fix assertion error in spawnSync
When ExitCallback was not called with an error such as ENOENT in
uv_spawn, the process handle still remains refed and needs to be closed.

Signed-off-by: Timothy J Fontaine <tjfontaine@gmail.com>
2014-04-30 09:02:18 -07:00
Ingmar Runge
26a1b712ec crypto: improve error messages
1) ThrowCryptoTypeErrors was not actually used for
   type-related errors. Removed it.
2) For AEAD modes, OpenSSL does not set any internal
   error information if Final does not complete suc-
   cessfully. Therefore, "TypeError:error:00000000:l
   ib(0):func(0):reason(0)" would be the error mess-
   age. Use a default message for these cases.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-04-29 14:20:14 +04:00
Forrest L Norvell
793c76e5c6 docs: add cautionary note to emitter.removeAllListeners
Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-04-29 14:15:10 +04:00
Rasmus Christian Pedersen
d13e0297c3 crypto: fix a couple of VC++ warnings
Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-04-29 14:13:28 +04:00
Sean McArthur
226f98a356 buffer: add compare and equals methods
compare() works like String.localeCompare such that:

    Buffer.compare(a, b) === a.compare(b);

equals() does a native check to see if two buffers are equal.

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
2014-04-28 22:09:48 -07:00
Ben Noordhuis
3f3a71e61e deps: fix v8 link error with glibc < 2.17
Commit f9ced08 switches V8 on Linux over from gettimeofday() to
clock_getres() and clock_gettime().  As of glibc 2.17, those functions
live in libc.  For older versions, we need to pull them in from librt.

Fixes the following link-time error;

    Release/obj.target/deps/v8/tools/gyp/libv8_base.a(platform-posix.o):
    In function `v8::internal::OS::Ticks()':
    platform-posix.cc:(.text+0x93c):
    undefined reference to `clock_gettime'
    platform-posix.cc:(.text+0x989):
    undefined reference to `clock_getres'

Fixes #7514.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-04-28 19:34:07 +04:00
Rod Vagg
250782d139 util: format as Error if instanceof Error
Conflicts:
	lib/util.js
	test/simple/test-util-format.js

This is a backport to fix #7253

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-04-26 00:52:49 +04:00
Denys Zariaiev
681fe599d7 vm: assign Environment to created context
ContextifyContext::CreateV8Context is now create context
with Environment pointer

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-04-26 00:34:55 +04:00
Ben Noordhuis
f9ced08de3 deps: make v8 use CLOCK_REALTIME_COARSE
Date.now() indirectly calls gettimeofday() on Linux and that's a system
call that is extremely expensive on virtualized systems when the host
operating system has to emulate access to the hardware clock.

Case in point: output from `perf record -c 10000 -e cycles:u -g -i`
for a benchmark/http_simple bytes/8 benchmark with a light load of
50 concurrent clients:

    53.69%     node  node                 [.] v8::internal::OS::TimeCurrentMillis()
               |
               --- v8::internal::OS::TimeCurrentMillis()
                  |
                  |--99.77%-- v8::internal::Runtime_DateCurrentTime(v8::internal::Arguments, v8::internal::Isolate*)
                  |          0x23587880618e

That's right - over half of user time spent inside the V8 function that
calls gettimeofday().

Notably, nearly all system time gets attributed to acpi_pm_read(), the
kernel function that reads the ACPI power management timer:

    32.49%     node  [kernel.kallsyms]    [k] acpi_pm_read
               |
               --- acpi_pm_read
                  |
                  |--98.40%-- __getnstimeofday
                  |          getnstimeofday
                  |          |
                  |          |--71.61%-- do_gettimeofday
                  |          |          sys_gettimeofday
                  |          |          system_call_fastpath
                  |          |          0x7fffbbaf6dbc
                  |          |          |
                  |          |          |--98.72%-- v8::internal::OS::TimeCurrentMillis()

The cost of the gettimeofday() system call is normally measured in
nanoseconds but we were seeing 100 us averages and spikes >= 1000 us.
The numbers were so bad, my initial hunch was that the node process was
continuously getting rescheduled inside the system call...

v8::internal::OS::TimeCurrentMillis()'s most frequent caller is
v8::internal::Runtime_DateCurrentTime(), the V8 run-time function
that's behind Date.now().  The timeout handling logic in lib/http.js
and lib/net.js calls into lib/timers.js and that module will happily
call Date.now() hundreds or even thousands of times per second.
If you saw exports._unrefActive() show up in --prof output a lot,
now you know why.

That's why this commit makes V8 switch over to clock_gettime() on Linux.
In particular, it checks if CLOCK_REALTIME_COARSE is available and has
a resolution <= 1 ms because in that case the clock_gettime() call can
be fully serviced from the vDSO.

It speeds up the aforementioned benchmark by about 100% on the affected
systems and should go a long way toward addressing the latency issues
that StrongLoop customers have been reporting.

This patch will be upstreamed as a CR against V8 3.26.  I'm sending it
as a pull request for v0.10 first because that's what our users are
running and because the delta between 3.26 and 3.14 is too big to
reasonably back-port the patch.  I'll open a pull request for the
master branch once the CR lands upstream.

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-04-24 14:02:05 -07:00
Julian Gruber
0ee99565f9 doc: fix missing link in net api
Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-04-24 19:59:41 +04:00
Julian Gruber
b0fa931e07 doc: fix order in net api
Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-04-24 19:59:41 +04:00
Ben Noordhuis
bd24ab2bd7 http: add request.flush() method
Forcibly flushes the request headers.  You need this with long-lived
HTTP connections where the first data isn't written until the connection
has been established (think: tunneling requests over HTTP CONNECT.)

Fixes #7296.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-04-24 10:43:51 +04:00
Fedor Indutny
a60a9b0dbd deps: provide TXT chunk info in c-ares
Provide more information in `ares_txt_reply` to coalesce chunks from the
same record into one string.

fix #7367
2014-04-24 10:40:35 +04:00
Fedor Indutny
4601e7c892 Revert "deps: backport b5135bbc from c-ares repo"
This reverts commit 896e19330a.

Proper handling of TXT records requires API change, we can't afford it
in v0.10.

See #7371 for details.
2014-04-24 10:19:30 +04:00
Farrin Reid
3950024c2f doc: tls: added path property to tls.connect
In tls.connect a unix socket connection to a path may be made in
recent versions of node by specifying the value for the path
property.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-04-24 10:14:48 +04:00
Fedor Indutny
89e88e96df crypto: fix memory leak in CipherBase::Final
fix #7497

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-04-23 14:13:43 +04:00
Fedor Indutny
0f3b72460b crypto: work around OpenSSL oddness
OpenSSL behaves oddly: on client `cert_chain` contains
the `peer_certificate`, but on server it doesn't.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-04-22 16:19:57 +04:00
Fedor Indutny
afaff70a9b src: lint after OCSP commits 2014-04-18 02:24:48 +04:00
Fedor Indutny
345c40b661 tls: getPeerCertificate(detailed)
Add `raw` property to certificate, add mode to output full certificate
chain.
2014-04-18 02:21:16 +04:00
Fedor Indutny
b3ef289ffb tls: support OCSP on client and server 2014-04-18 02:21:16 +04:00
Fedor Indutny
77d1f4a91f tls: set _connecting before starting the flow
When creating a TLSSocket instance based on the existing connecting
socket, `_connecting` property is copied after the initialization of
`net.Socket`. However, since `net.Socket` constructor will call
`.read(0)` if the `readable` is true - error may happen at this code
chunk in net.js:

    Socket.prototype._read = function(n) {
      debug('_read');

      if (this._connecting || !this._handle) {
        debug('_read wait for connection');
        this.once('connect', this._read.bind(this, n));
    ...

Leading to a test failures on windows:

 - test/simple/test-tls-connect-given-socket.js

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-04-17 14:27:09 +04:00
isaacs
75bc11cf12 npm: upgrade to 1.4.7
* isaacs, Robert Kowalski, Benjamin Coe: Test Improvements
* isaacs doc: Add canonical url
* isaacs view: handle unpublished packages properly
* Raynos (Jake Verbaten) do not log if silent
* Julian Gruber fix no such property error
* isaacs npmconf@0.1.14
* Thorsten Lorenz adding save-prefix configuration option
* isaacs npm-registry-client@0.4.7
* isaacs cache: treat missing versions as a 404
* isaacs cache: Save shasum, write resolved/etc data to cache
* isaacs cache: Always fetch root doc
* isaacs cache: don't repack unnecessarily from tmp
* Andrey Kislyuk Don't crash if shrinkwrap-dependencies were not passed in pkginfo
* Robert Kowalski fix link in faq
* Jean Lauliac Add a peerDependencies section in package.json doc
* isaacs read-installed@2.0.2
2014-04-15 15:31:36 -07:00
isaacs
9520adeb37 url: treat \ the same as /
See https://code.google.com/p/chromium/issues/detail?id=25916

Parse URLs with backslashes the same as web browsers, by replacing all
backslashes with forward slashes, except those that occur after the
first # character.
2014-04-15 15:30:43 -07:00
Vladimir Kurchatkin
2c6b424829 events: check if _events is an own property
Without this check it is possible to have the _events object shared
amongst instances.

Fixes #7157

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
2014-04-15 13:00:31 -07:00
Trevor Norris
c7f424e44b fs: return blksize on stats object
Oversight to not pass blksize to fs.Stats on initialization.

Also added a test to make sure the object property has been set. Since
now on Windows both blksize and blocks will simply be set to undefined.
2014-04-14 16:35:33 -07:00
Fedor Indutny
1bd4f3a605 child_process: fix deadlock when sending handles
Fix possible deadlock, when handles are sent in both direction
simultaneously. In such rare cases, both sides may queue their
`NODE_HANDLE_ACK` replies and wait for them.

fix #7465
2014-04-14 20:15:09 +04:00
Yazhong Liu
940974ed03 net: deduplicate Socket.prototype.address
Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-04-14 20:12:38 +04:00
Fedor Indutny
2272052461 net: bind to :: TCP address by default
Try binding TCP socket to `::` first before falling back to
`0.0.0.0`.
2014-04-14 20:11:57 +04:00
Geir Hauge
c61b0e9cbc
main: Handle SIGINT properly.
As explained by http://www.cons.org/cracauer/sigint.html

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-04-12 12:40:31 +04:00
goussardg
8e823bcbe6 buffer: return uint if MSB is 1 in readUInt32
Fix issue where a signed integer is returned.

Example:

var b = new Buffer(4);
b.writeUInt32BE(0xffffffff);
b.readUInt32BE(0) == -1

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
2014-04-10 14:22:05 -07:00
Fedor Indutny
4c36f3e7e6 buffer: truncate buffer after string decode
When our estimates for a storage size are higher than the actual length
of decoded data, the destination buffer should be truncated. Otherwise
`Buffer::Length` will give misleading information to C++ layer.

fix #7365

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-04-11 01:20:43 +04:00
Fedor Indutny
525fad473b test: remove vm-infinite-recursion
It doesn't work reliably on all platforms.

see #7432

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-04-11 00:54:12 +04:00
William Bert
bfb7de5e75 docs: fix links to streams
Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-04-11 00:52:33 +04:00
Timothy J Fontaine
632c135622 src: use monotonic time for process.uptime()
`process.uptime()` interface will return the amount of time the
current process has been running. To achieve this it was caching the
`uv_uptime` value at program start, and then on the call to
`process.uptime()` returning the delta between the two values.

`uv_uptime` is defined as the number of seconds the operating system
has been up since last boot. On sunos this interface uses `kstat`s
which can be a significantly expensive operation as it requires
exclusive access, but because of the design of `process.uptime()` node
*had* to always call this on start. As a result if you had many node
processes all starting at the same time you would suffer lock
contention as they all tried to read kstats.

Instead of using `uv_uptime` to achieve this, the libuv loop already
has a concept of current loop time in the form of `uv_now()` which is
in fact monotonically increasing, and already stored directly on the
loop. By using this value at start every platform performs at least
one fewer syscall during initialization.

Since the interface to `uv_uptime` is defined as seconds, in the call
to `process.uptime()` we now `uv_update_time` get our delta, divide by
1000 to get seconds, and then convert to an `Integer`. In 0.12 we can
move back to `Number::New` instead and not lose precision.

Caveat: For some platforms `uv_uptime` reports time monotonically
increasing regardless of system hibernation, `uv_now` interface is
also monotonically increasing but may not reflect time spent in
hibernation.
2014-04-10 10:55:02 -07:00
Fedor Indutny
045f765a1a test: add reuseAddr in dgram-multicast...
Add `reuseAddr` option in `test-dgram-multicast-multi-process.js`
2014-04-10 19:55:38 +04:00