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
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
Timothy J Fontaine
af69f88a9d build: make sure changelog.html is generated 2014-04-08 09:06:28 -07: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
Fedor Indutny
b76a1ff940 vm: share security token between contexts
By default, each `v8::Context` has a different Security Token, which
prevents access to one context from another.

fix #7140
2014-03-21 16:16:58 +04:00
Trevor Norris
b84ebfe886 pipe_wrap: use Instantiate() method
Retrieve a new client object via PipeWrap::Instantiate(). This method
performs appropriate checks to make sure everything is as it should be.
2014-03-17 14:39:37 -07:00
Fedor Indutny
7b9771f569 headers: remove env.h from node_internals.h
`env.h` is an internal header file and should not be copied or exposed
to the users.

Additionally, export convenience `Throw*` methods with `v8::Isolate*` as
a first argument.
2014-03-18 01:16:45 +04:00
Fedor Indutny
4d140746f0 deps: update v8 to 3.24.35.17 2014-03-18 00:33:01 +04:00
Timothy J Fontaine
ee4b9b552d test: update our branched weakref to v8 3.24 2014-03-17 10:19:47 -07:00
Ben Noordhuis
23dfa71dd5 src: fix tracing infrastructure after v8 upgrade
Fix up the dtrace/etw/systemtap infrastructure after the V8 upgrade in
commit 1c7bf24.  The win32 changes are untested but can hardly make
things worse because node doesn't build on windows right now.

Fixes #7313 with some luck.
2014-03-16 16:15:34 +04:00
Ben Noordhuis
c30cc4e3a5 src: don't call DecodeWrite() on Buffers
Don't call DecodeWrite() with a Buffer as its argument because it in
turn calls StringBytes::Write() and that method expects a Local<String>.

"Why then does that function take a Local<Value>?" I hear you ask.
Good question but I don't have the answer.  I added a CHECK for good
measure and what do you know, all of a sudden a large number of crypto
tests started failing.

Calling DecodeWrite(BINARY) on a buffer is nonsensical anyway: if you
want the contents of the buffer, just copy out the data, there is no
need to decode it - and that's exactly what this commit does.

Fixes a great many instances of the following run-time error in debug
builds:

    FATAL ERROR: v8::String::Cast() Could not convert to string
2014-03-16 16:15:34 +04:00
Ben Noordhuis
e87ceb2b42 src: fix up smalloc weak persistent usage
Fix a regression that was introduced in commit ce04c726 after the
upgrade to V8 3.24.

The new weak persistent handle API no longer gives you the original
persistent but still requires that you clear it inside your weak
callback.

Rearrange the code in src/smalloc.cc to keep track of the persistent
handle with the least amount of pain and try hard to share as much
code as possible between the 'just free it' and 'invoke my callback'
versions of the smalloc API.

Fixes #7309.
2014-03-16 16:15:34 +04:00
Ben Noordhuis
ad15d75750 src: add CHECK_{GE,GT,LE,LT} macros
Conform to the Google styleguide more and make cpplint happy, add more
CHECK macros.

Preemptively addresses cpplint's readability/check warnings ("Consider
using CHECK_GT instead of CHECK(a > b)".)
2014-03-16 16:15:34 +04:00
Ben Noordhuis
8eb76075cf src: deduplicate CHECK_EQ/CHECK_NE macros
DRY the macros, there is no need to define them twice depending on
whether NDEBUG is defined or not.
2014-03-16 16:15:33 +04:00