0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-30 15:30:56 +01:00
Commit Graph

2780 Commits

Author SHA1 Message Date
Trevor Norris
828f14556e src: revert domain using AsyncListeners
This is a slightly modified revert of bc39bdd.

Getting domains to use AsyncListeners became too much of a challenge
with many edge cases. While this is still a goal, it will have to be
deferred for now until more test coverage can be provided.
2014-01-09 13:25:20 -08:00
Fedor Indutny
730e511b35 child_process: better error reporting for exec
Report path to executable and argv on error, stderr is not enough in
many cases.

fix #6796
2014-01-09 00:00:30 +04:00
Fedor Indutny
92b6417098 crypto: introduce .setEngine(engine, [flags]) 2014-01-05 16:42:33 +04:00
Trevor Norris
d9fc6af32a node: change AsyncListener API
There was a flaw in the old API that has been fixed. Now the
asyncListener callback is now the "create" object property in the
callback object, and is optional.
2014-01-03 13:20:23 -08:00
Tuğrul Topuz
bddea032b7 dns: add resolveSoa and 'SOA' rrtype
You can now query for SOA records by either passing 'SOA' to `resolve`
or by using the new `resolveSoa`
2013-12-31 14:30:40 -08:00
Sam Roberts
876d3bd85a cluster: do not synchronously emit 'setup' event
This is a problem present in both v0.10, and v0.11, where the 'setup'
event is synchronously emitted by `cluster.setupMaster()`, a mostly
harmless anti-pattern.
2013-12-31 11:43:44 -08:00
Sam Roberts
dce35146e0 cluster: only forcibly exit worker on unclean exit
Fix inadvertent v0.11 changes to the definition of suicide, particularly
the relationship between suicide state, the disconnect event, and when
exit should occur.

In v0.10, workers don't forcibly exit on disconnect, it doesn't give
them time to do a graceful finish of open client connections, they exit
under normal node rules - when there is nothing left to do. But on
unexpected disconnect they do exit so the workers aren't left around
after the master.

Note that a test as-written was invalid, it failed against the v0.10
cluster API, demonstrating that it was an undocumented API change.
2013-12-31 11:43:43 -08:00
Sam Roberts
6f40abe2d4 cluster: disconnect callback should always occur
Fixes issue in 0.11 where callback doesn't occur if worker count is
currently zero.  In 0.10 callback occurs after worker count is zero, and
occurs in next tick if worker count is currently zero.
2013-12-31 11:43:43 -08:00
Sam Roberts
3c649703c7 cluster: replace erroneous comma with semicolon 2013-12-31 11:43:43 -08:00
pflannery
7ced966a32 timers: setImmediate v8 optimization fix
Prevent v8 disabling optimization for scenario "bad value context for
arguments value".

Solves #6631

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
2013-12-30 14:58:38 -08:00
Yorkie
8d3bc88bbe querystring: remove name from stringify()
QueryString.stringify() allowed a fourth argument that was used as a
conditional in the return value, but was undocumented, not used by core
and always was always false/undefiend. So the argument and conditional
have been removed.

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
2013-12-30 11:41:37 -08:00
Trevor Norris
87cde44280 Revert "util: more strict check for bool/number/string"
This reverts commit 95ee84fabe.
2013-12-20 13:44:56 -08:00
Fedor Indutny
7c3643b767 tls: reintroduce socket.encrypted
Just a property that is always `true` for TLS sockets.

fix #6735
2013-12-21 01:03:05 +04:00
Paul Loyd
2ca6905160 buffer: optimize writeInt* methods
Remove unnecessary encoding within writeInt*
2013-12-21 01:01:17 +04:00
Bert Belder
54da818e4b events: move EE c'tor guts to EventEmitter.init
After landing 6ed861d it is no longer possible to reliably monkey-patch
the EventEmitter constructor. However there's valid use cases for that,
and makes for easier debugging. Therefore, move the guts of the
constructor to a separate function which is monkey-patchable.

Closes #6693
2013-12-20 12:47:24 -08:00
Cam Swords
7ffe2ad616 http: parse the status message in a http response. 2013-12-20 17:55:08 +04:00
Alexis Campailla
9be6470b53 windows: fix dns lookup of localhost with ipv6
Removing a hack intended to shortcut the resolution of 'localhost'
but which doesn't work for ipv6.
This was introduced in 2876141c42.
However it seems that the problems that this was trying to
circumvent has gone away ages ago, when dns resolution on
Windows started relying on Win32 GetAddrInfoW, which was
probably with be2320d408.

Fixes test-net-connect-options-ipv6.js on Windows.
2013-12-19 12:44:50 +04:00
Yorkie
95ee84fabe util: more strict check for bool/number/string 2013-12-18 17:58:02 +04:00
Timothy J Fontaine
069dd07a17 Merge remote-tracking branch 'upstream/v0.10'
Conflicts:
	AUTHORS
	ChangeLog
	deps/uv/.mailmap
	deps/uv/ChangeLog
	deps/uv/build.mk
	deps/uv/src/unix/darwin.c
	deps/uv/src/unix/udp.c
	deps/uv/src/version.c
	deps/uv/test/test-list.h
	src/node_version.h
2013-12-12 11:32:41 -08:00
Wyatt Preul
1d5e797445 module: only cache package main 2013-12-12 09:38:47 -08:00
Fedor Indutny
1e066e4a4a Merge branch 'v0.10'
Conflicts:
	lib/tls.js
	src/node_crypto.cc
	src/node_crypto.h
2013-12-10 23:06:56 +04:00
Fedor Indutny
4a2792cd2f tls: emit 'end' on .receivedShutdown
NOTE: Also removed `.receivedShutdown` method of `Connection` it wasn't
documented anywhere, and was rewritten with `true` after receiving
`close_notify`.

fix #6638
2013-12-10 22:56:01 +04:00
Ingmar Runge
e0d31ea2db crypto: support GCM authenticated encryption mode.
This adds two new member functions getAuthTag and setAuthTag that
are useful for AES-GCM encryption modes. Use getAuthTag after
Cipheriv.final, transmit the tag along with the data and use
Decipheriv.setAuthTag to have the encrypted data verified.
2013-12-08 00:00:02 +04:00
Timothy J Fontaine
fcca3585fe Merge remote-tracking branch 'upstream/v0.10'
Conflicts:
	lib/tls.js
	src/node.js
2013-12-06 21:27:18 -08:00
Lalit Kapoor
aef09601b4 http: DELETE shouldn't default to chunked encoding 2013-12-06 16:25:42 -08:00
Alexis Campailla
0da4e0e843 child_process: don't crash process on internal ops
1. Swallow errors when sending internal NODE_HANDLE_ACK messages, so
   they don't crash the process.
2. Queue process.disconnect() if there are any pending queued messages.

Fixes test-child-process-fork-net2.js on win.
2013-12-06 16:17:52 -08:00
Fedor Indutny
f572b91c3e tls: fix handling of asterisk in SNI context
Wildcard server names should not match subdomains.

Quote from RFC2818:

   ...Names may contain the wildcard
   character * which is considered to match any single domain name
   component or component fragment. E.g., *.a.com matches foo.a.com but
   not bar.foo.a.com. f*.com matches foo.com but not bar.com.

fix #6610
2013-12-05 19:45:19 -08:00
Alexis Campailla
9ba0d905b0 lib: child_process spawn handle ENOENT correctly
child_process spawn wasn't handlig ENOENT correctly on Windows.
This is half a fix for test-child-process-cwd.js.
The other half is going into libuv.
2013-12-05 11:59:22 -08:00
Kai Groner
98be8df571 crypto: Make Decipher._flush() emit errors.
When Decipher processes a stream using an incorrect key, the
DecipherFinal() method throws an unhandled exception at the end of the
stream.
2013-12-04 19:52:15 +04:00
Fedor Indutny
60f777d343 tls: fix pool usage race
When calling `encOut` in loop, `maybeInitFinished()` may invoke
`clearOut`'s loop, leading to the writing of interleaved data
(encrypted and cleartext) into the one shared pool.

Move `maybeInitFinished()` out of the loop and add assertion for
future.
2013-12-02 15:18:04 -08:00
Fedor Indutny
5ce4eed54d http: fix parser double-free in _http_client.js
HTTP Parser instance was freed twice, leading to the reusal of it
in several different requests simultaneously.

The flow:

`socketCloseListener` is firing, which calls `socket.read()` to flush
any queued data, `socket.buffer` has data which emits and fires
`socketOnData` in sync, this triggers a parser error which frees the
parser, `socketCloseListener` resumes execution only to have the wrong
parser associated with the socket.

The fix is to only cache the parser after the flushing from the socket,
and to assert in `socketOnData` that `socket === parser.socket`

fix #6451
2013-11-27 15:37:56 -08:00
Timothy J Fontaine
85c19175ed Merge remote-tracking branch 'upstream/v0.10' 2013-11-26 08:41:09 -08:00
David Chan
b3e4fc6a48 util: Format negative zero as '-0'
Format negative zero as '-0' instead of as '0', as it does not behave
identically to positive zero. ((-0).toString() still returns '0' as
required by ES5 9.8.1.2).

Fixes joyent/node#6548.
Closes joyent/node#6550.
2013-11-25 11:28:30 -08:00
Jeremy Martin
71aabedad4 events: fix TypeError in removeAllListeners
Check that `listeners` is actually an array before trying to manipulate it
because it won't be if no regular event listeners have been registered yet
but there are 'removeListener' event listeners.
2013-11-22 17:42:34 +01:00
Timothy J Fontaine
eaba9417b1 Merge remote-tracking branch 'upstream/v0.10'
Conflicts:
	lib/events.js
	src/udp_wrap.cc
2013-11-20 15:45:50 -08:00
Timothy J Fontaine
40d5e9074a child_process: deliver ENOENT on nextTick
After the uv upgrade, uv_spawn will now fail faster for certain
failures like ENOENT. However, our tests and other people may be
depending on that error being passed to the callback instead of a
throw.
2013-11-20 09:35:08 -08:00
Fedor Indutny
fce0eb416b events: do not accept NaN in setMaxListeners 2013-11-19 13:14:01 +04:00
Timothy J Fontaine
2329a254b4 Merge remote-tracking branch 'upstream/v0.10'
Conflicts:
	AUTHORS
	ChangeLog
	deps/uv/AUTHORS
	deps/uv/ChangeLog
	deps/uv/README.md
	deps/uv/build.mk
	deps/uv/src/unix/core.c
	deps/uv/src/unix/darwin-proctitle.c
	deps/uv/src/unix/darwin.c
	deps/uv/src/unix/fsevents.c
	deps/uv/src/unix/udp.c
	deps/uv/src/version.c
	deps/v8/src/platform-solaris.cc
	deps/v8/test/cctest/test-api.cc
	lib/tls.js
	src/node.h
	src/node_version.h
2013-11-18 13:41:17 -08:00
Trevor Norris
d6df1b9157 buffer: convert values to uint, not int
In many cases values expected to be unsigned were converted to a signed
integer.

Also include some small code cleanup.
2013-11-15 11:48:09 -08:00
Trevor Norris
e5346932bc src: make buffer size errors more explicit
Fixes #6490
2013-11-15 11:48:08 -08:00
Trevor Norris
a263abaa81 buffer: no warning when encoding isn't passed
Buffer#write() was showing the deprecation warning when only
buf.write('string') was passed. This is incorrect since the encoding is
always optional.

Argument order should follow:
  Buffer#write(string[, offset[, length]][, encoding])

(yeah, not confusing at all)
2013-11-15 11:48:03 -08:00
Trevor Norris
c414ec1c2c smalloc: check if object has external memory
Add HasExternalData API to check if Object has externally allocated
memory, and accompanying tests.
2013-11-13 15:29:50 -08:00
Fedor Indutny
65b127572f tls: handle ssl.start() errors 2013-11-13 17:09:25 +04:00
Tim Wood
c9d93f3431 events: don't call once twice
Emitting an event within a `EventEmitter#once` callback of the same
event name will cause subsequent `EventEmitter#once` listeners of the
same name to be called multiple times.

    var emitter = new EventEmitter();

    emitter.once('e', function() {
      emitter.emit('e');
      console.log(1);
    });

    emitter.once('e', function() {
      console.log(2);
    });

    emitter.emit('e');

    // Output
    // 2
    // 1
    // 2

Fix the issue, by calling the listener method only if it was not
already called.
2013-11-13 03:21:04 +04:00
Maciej Małecki
568072ceae repl: do not insert duplicates into completions
Fix invalid `hasOwnProperty` function usage.

For example, before in the REPL:

```
> Ar<Tab>
Array

Array        ArrayBuffer
```

Now:

```
> Ar<Tab>
Array

ArrayBuffer
```

Fixes #6255.
Closes #6498.
2013-11-11 15:45:09 -08:00
Fedor Indutny
ac2263b77f tls: prevent stalls by using read(0)
Do not `.push()` the same data as just passed to `.ondata()`, it
may be read by 'data' event listeners.

fix #6277
2013-11-09 02:07:36 +04:00
isaacs
ea8feced87 http: force socket encoding to be null
Otherwise the string triggers an assertion error in node_http_parser.c,
line 370:

    assert(Buffer::HasInstance(args[0]) == true);

because the first argument is not a Buffer object.
2013-11-07 08:24:50 -08:00
fengmk2
1ce5db4d95 http: cleanup freeSockets when socket destroyed
If the socket was destroyed, we need to remove it from the agent's
`freeSockets` list, otherwise dead socket could be reused by new
request.
2013-11-07 11:42:41 +04:00
Fedor Indutny
a6ddfe20d2 tls: more accurate wrapping of connecting socket
When socket, passed in `tls.connect()` `options` argument is not yet
connected to the server, `_handle` gets assigned to a `net.Socket`,
instead of `TLSSocket`.

When socket is connecting to the remote server (i.e. not yet connected,
but already past dns resolve phase), derive `_connecting` property from
it, because otherwise `afterConnect()` will throw an assertion.

fix #6443
2013-11-05 18:14:28 +04:00
Nathan Rajlich
9bc53d887a http: make DELETE requests set req.method
Fixes #6461.
2013-11-04 09:39:29 -08:00