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

9855 Commits

Author SHA1 Message Date
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
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
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
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
Fedor Indutny
592be014b6
dgram: introduce reuseAddr option
Introduce new signature for both `dgram.createSocket` method and
`dgram.Socket` constructor:

    dgram.createSocket(options, [listener])

Options should contain `type` property and may contain `reuseAddr`
property. When `reuseAddr` is `true` - SO_REUSEADDR will be issued on
socket on bind.

fix #7415

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-04-10 19:39:49 +04:00
Alexis Campailla
c20b209dbb openssl: fix keypress requirement in apps on win32
Re-applying commit 153784b348, which
was overwritten by the update to openssl 1.0.1f.

Original source:

http://openssl.6102.n7.nabble.com/PATCH-s-client-Fix-keypress-requirement-with-redirected-input-on-Windows-td46787.html
2014-04-08 08:56:52 +04:00
Fedor Indutny
3054decc19 test: fix test-crypto 2014-04-08 08:56:12 +04:00
Fedor Indutny
de7c0e8c02 Merge branch 'v0.10'
Conflicts:
	deps/openssl/asm/x64-elf-gas/aes/vpaes-x86_64.s
	deps/openssl/asm/x64-macosx-gas/aes/vpaes-x86_64.s
	deps/openssl/asm/x64-win32-masm/aes/vpaes-x86_64.asm
	deps/openssl/openssl/CHANGES
	deps/openssl/openssl/Makefile
	deps/openssl/openssl/Makefile.org
	deps/openssl/openssl/NEWS
	deps/openssl/openssl/README
	deps/openssl/openssl/crypto/opensslv.h
	deps/openssl/openssl/openssl.spec
	deps/openssl/openssl/ssl/s23_clnt.c
	lib/http.js
	test/simple/test-http-client-readable.js
2014-04-08 08:55:57 +04:00
Fedor Indutny
d6fd118727 deps: update openssl to 1.0.1g 2014-04-08 00:58:37 +04:00
Fedor Indutny
f2b297cc7c http: do not emit EOF non-readable socket
Socket may become not `readable`, but http should not rely on this
property and should not think that it means that no data will ever
arrive from it. In fact, it may arrive in a next tick and, since
`this.push(null)` was already called, it will result in a error like
this:

    Error: stream.push() after EOF
        at readableAddChunk (_stream_readable.js:143:15)
        at IncomingMessage.Readable.push (_stream_readable.js:123:10)
        at HTTPParser.parserOnBody (_http_common.js:132:22)
        at Socket.socketOnData (_http_client.js:277:20)
        at Socket.EventEmitter.emit (events.js:101:17)
        at Socket.Readable.read (_stream_readable.js:367:10)
        at Socket.socketCloseListener (_http_client.js:196:10)
        at Socket.EventEmitter.emit (events.js:123:20)
        at TCP.close (net.js:479:12)

fix #6784
2014-04-08 00:40:22 +04:00
Brian White
c2d32f4c0e doc: add missing space
Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-04-07 17:45:04 +04:00
Saúl Ibarra Corretgé
a0a180a0ad src: fix use of uv_cwd, len includes the NULL byte 2014-04-07 16:37:29 +04:00
Saúl Ibarra Corretgé
42b9343710 src: update uv callbacks after API changes
async, timer, prepare, idle and check handles no longer get a status
parameter since they can never fail.
2014-04-07 16:37:20 +04:00
Fedor Indutny
962f96d341 deps: update libuv to v0.11.23 2014-04-07 16:36:51 +04:00
Evan Carroll
95dbb6bf64 util: made util.isArray a direct alias for Array.isArray 2014-04-03 22:39:42 +04:00
Alex Kocharin
42a33c1bb8 domain: don't crash on "throw null"
Signed-off-by: Trevor Norris <trev.norris@gmail.com>
2014-04-02 15:36:30 -07:00
Dominic Tarr
cdc093b31f docs: correct tls docs. server -> client
when a pfx file is passed to tls.connection,
it is the client private key, not the server's private key.
2014-04-02 15:34:16 +04:00
Yuki KAN
006d42786e lib: use triple equals
Signed-off-by: Trevor Norris <trev.norris@gmail.com>
2014-04-02 02:12:18 -07:00
C. Scott Ananian
08a5b442e4 node: add signature to SET_PROTOTYPE_METHOD
This prevents segfaults when a native method is reassigned to a
different object (which corrupts args.This()).  When unwrapping,
clients should use args.Holder() instead of args.This().

Closes #6690.

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
2014-04-02 01:48:34 -07:00
Nick Apperson
d4fcb23e38 buffer: improve {read,write}{U}Int* methods
Increase the performance and simplify the logic of Buffer#write{U}Int*
and Buffer#read{U}Int* methods by placing the byte manipulation code
directly inline.

Also improve the speed of buffer-write benchmarks by creating a new
call directly to each method by using Function() instead of calling by
buff[fn].

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
2014-04-01 17:31:28 -07:00
Ben Noordhuis
c7214fe355 src: fix up after v8 upgrade
The two biggest changes are that v8::Script::New() has been removed and
that a v8::Script object now has to be explicitly bound to a context if
you want to run it from another context.

We can accommodate both changes without breaking the vm module's public
API or even the internal JS API.
2014-04-02 00:05:25 +04:00
Ben Noordhuis
5e24adbb90 deps: fix up v8 postmortem codegen
Fix up overzealous parses, strip whitespace from class and field names.
2014-04-02 00:05:25 +04:00
Ben Noordhuis
67e078094b deps: upgrade v8 to 3.25.30 2014-04-02 00:05:24 +04:00
Andrew Low
f984555d47 test: make test-smalloc endian aware
The test/simple/test-smalloc.js has an implicit assumption
of the byte order of the data stored for Double and Uint32
values. On a big endian platform this test fails without
these patches.

Use os.endianness() to detect the endian of the platform
and use it to gate the static value used for comparison.
2014-04-01 23:17:43 +04:00
Trevor Norris
8d6fa72d97 v8: upgrade to 3.24.35.22 2014-04-01 11:46:28 -07:00
Ben Noordhuis
490d5ab780 configure: make --v8-options switch more robust
Improve on commit b55c9d6 by not requiring that switches are comma
separated.  This commit makes `./configure --v8-options="--foo --bar"`
work and takes special care to properly escape quotes in the options
string.
2014-04-01 18:55:52 +04:00
James Pickard
e9ce8fc82a fs: improve performance of all stat functions
By building the fs.Stats object in JS, which is returned by all fs stat
functions, calls to v8::Object::Set() are removed. This also includes
creating all associated Date objects in JS, rather than using
v8::Date::New(). Both these changes have significant performance gains.

Note that the returned value from fs.stat changes slightly for non-POSIX
systems. Whereas before the stats object would be missing blocks and
blksize keys, it now has these keys with undefined as the value.

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
2014-03-31 15:02:17 -07:00
Goh Yisheng (Andrew)
47bed4828c doc: typo clean up in tls 2014-03-31 07:40:17 -07:00
Fedor Indutny
5d2aef17ee
crypto: move createCredentials to tls
Move `createCredentials` to `tls` module and rename it to
`createSecureContext`. Make it use default values from `tls` module:
`DEFAULT_CIPHERS` and `DEFAULT_ECDH_CURVE`.

fix #7249
2014-03-29 12:01:43 +04:00
Fedor Indutny
b55c9d68aa configure: --v8-options option
Introduce a way to set some v8 flags at compile time, the values should
be separated by comma.
2014-03-29 11:51:41 +04:00
Nathan Rajlich
6d15b163b0 http: better client "protocol not supported" error
Include the "expected protocol" in the Error message
string, which evaluates to "http:" for the `http`
core module, and "https:" for the `https` module.

Closes #7355.
2014-03-28 11:05:35 -10:00
dcarney@chromium.org
85d595c8c2
deps: apply floating patch to v8
Original commit message below:

fix FunctionCallbackInfo ambiguity

- when compiling tools that embed v8 with g++ FunctionCallbackInfo is currently ambigous
- more info: https://github.com/joyent/node/issues/7337
- original patch is here: https://codereview.appspot.com/78770045/

TBR=svenpanne@chromium.org

Review URL: https://codereview.chromium.org/201573012

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@20217 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-03-28 17:09:36 +04:00
Fedor Indutny
d24946b1b4 tls: do not call SNICallback unless present
When asynchronously parsing ClientHello for session resumption -
SNICallback may not be set. Check if it is present before invoking
it.

fix #7010
2014-03-27 23:26:52 +04:00
Fedor Indutny
ef096f8d8f tls: force readable/writable to true
These are an old and deprecated properties that was used by previous
stream implementation, and are still in use in some user-land modules.

Prior to this commit, they were read from the underlying socket, which
may be non-readable/non-writable while connecting or while staying
uninitialized.

Force set them to `true`, just to make sure that there will be no
inconsistency.

fix #7152
2014-03-27 23:25:30 +04:00
Josh Dague
a9d22247ad build: windows signing should include timestamps
Previously the build artifacts did not include a signed timestamp, so
when the certificate expired the validation of the artifact would fail.
Now we sign against a timestamp server such that the artifact will
always be valid regardless of the disposition of the certificate.

Closes #7360 and #7059.
2014-03-27 11:54:13 -07:00
Fedor Indutny
e781832ea1 crypto: fix lint 2014-03-26 11:52:00 +04:00
Fedor Indutny
a030c7b902 Merge remote-tracking branch 'origin/v0.10'
Conflicts:
	src/node.cc
	src/node_crypto.cc
	src/node_crypto.h
2014-03-26 11:42:57 +04:00
Ben Noordhuis
f68a116c3c src: ensure that openssl's PRNG is fully seeded
Ensure that OpenSSL has enough entropy (at least 256 bits) for its PRNG.

The entropy pool starts out empty and needs to fill up before the PRNG
can be used securely.

OpenSSL normally fills the pool automatically but not when someone
starts generating random numbers before the pool is full: in that case
OpenSSL keeps lowering the entropy estimate to thwart attackers trying
to guess the initial state of the PRNG.

When that happens, we wait until enough entropy is available, something
that normally should never take longer than a few milliseconds.

Fixes #7338.
2014-03-26 11:31:32 +04:00
Ben Noordhuis
70f198ddb1 src: seed V8's random number generator at startup
The default entropy source is /dev/urandom on UNIX platforms, which is
okay but we can do better by seeding it from OpenSSL's entropy pool.

On Windows we can certainly do better; on that platform, V8 seeds the
random number generator using only the current system time.

Fixes #6250.

NB: This is a back-port of commit 7ac2391 from the master branch that
for some reason never got back-ported to the v0.10 branch.

The default on UNIX platforms in v0.10 is different and arguably worse
than it is with master: if no entropy source is provided, V8 3.14 calls
srandom() with a xor of the PID and the current time in microseconds.

That means that on systems with a coarse system clock, the initial
state of the PRNG may be easily guessable.

The situation on Windows is even more dire because there the PRNG is
seeded with only the current time... in milliseconds.
2014-03-26 11:31:32 +04:00
isaacs
bd547d6598 npm: upgrade to 1.4.6
* Documentation upgrades
* Fix glob bug which prevents proper README publishing
* node-gyp upgrade to 0.13
* Documentation updates
* Add --save-exact to save an exact dep (instead of a range)
* alias 't' to 'test'
2014-03-25 17:42:22 -07:00
Nathan Rajlich
69b8279d4b doc: remove agent.request() call in example
The `Agent#request()` function was removed in
f3189ace6b, so don't
use it in the documentation example. The function
wasn't documented in the first place.
2014-03-25 10:02:42 -10:00
Nathan Rajlich
9f23fe1141 http: use defaultAgent.protocol in protocol check
Default to the `defaultAgent.protocol` when comparing the
user-specified `options.protocol` string. This is so that
`http.Agent` instances do not need to specify their own
`protocol` field, since we have the relevant information
already from the `defaultAgent`.

Note that the test case could be separately cherry-picked
to the `v0.10` branch, since it already passes correctly.

Fixes #7349.
Fixes the regression described in: http://git.io/2ds-WQ
2014-03-24 12:59:31 -10:00
Ben Noordhuis
7989f42f86 build: fix g++ 4.8 build, disable -Werror
Turn off -Werror when building V8, it hits -Werror=unused-local-typedefs
with g++ 4.8.  The warning itself is harmless so don't abort the build.

This was originally implemented in commit d2ab314e back in 2011 but the
build process has gone through a few iterations since then, that change
no longer works.
2014-03-23 16:11:08 -07:00