Commit Graph

3378 Commits

Author SHA1 Message Date
Ben Noordhuis
157d2bcc04 buffer: fix gcc 4.2 build breakage
gcc 4.2 on OS X gets confused about the call to node::Buffer::Data().
Fully qualify the function name to help it along.

Fixes the following build error:

    ../../deps/v8/include/v8.h: In function ‘char*
    node::Buffer::Data(v8::Handle<v8::Value>)’:
    ../../deps/v8/include/v8.h:900: error: ‘class v8::Data’
    is not a function,
    ../../src/node_buffer.h:38: error:
    conflict with ‘char* node::Buffer::Data(v8::Handle<v8::Object>)’
    ../../src/node_buffer.cc:94: error:
    in call to ‘Data’
2013-06-20 13:23:12 +02:00
Timothy J Fontaine
a2c4ca09ed string_bytes: properly detect 64bit 2013-06-19 17:16:35 -07:00
Trevor Norris
f5e13ae9b5 buffer: write strings directly from call
Buffer(<String>) used to pass the string to js where it would then be
passed back to cpp for processing. Now only the buffer object
instantiation is done in js and the string is processed in cpp.

Also added a Buffer api that also accepts the encoding.
2013-06-19 13:15:05 -07:00
Fedor Indutny
bf8dc0762a crypto: change assertion to condition in bio
Read head can be the same as write head, even if there's some data to
read.
2013-06-19 22:03:07 +02:00
Trevor Norris
7373c4ddb7 buffer: proper API export for Windows
So that Windows users can properly include smalloc and node_buffer,
NODE_EXTERN was added to the headers that export this functionality.
2013-06-18 15:41:16 -07:00
Trevor Norris
4b40358841 buffer: implement new fill behavior
Old fill would take the char code of the first character and wrap around
the int to fit in the 127 range. Now fill will duplicate whatever string
is given through the entirety of the buffer.

Note: There is one bug around ending on a partial fill of any character
outside the ASCII range.
2013-06-18 15:41:03 -07:00
Trevor Norris
56869d9ae7 buffer: remove c-style casts 2013-06-18 15:39:32 -07:00
Trevor Norris
3a2f273bd7 buffer: use smalloc as backing data store
Memory allocations are now done through smalloc. The Buffer cc class has
been removed completely, but for backwards compatibility have left the
namespace as Buffer.

The .parent attribute is only set if the Buffer is a slice of an
allocation. Which is then set to the alloc object (not a Buffer).

The .offset attribute is now a ReadOnly set to 0, for backwards
compatibility. I'd like to remove it in the future (pre v1.0).

A few alterations have been made to how arguments are either coerced or
thrown. All primitives will now be coerced to their respective values,
and (most) all out of range index requests will throw.

The indexes that are coerced were left for backwards compatibility. For
example: Buffer slice operates more like Array slice, and coerces
instead of throwing out of range indexes. This may change in the future.

The reason for wanting to throw for out of range indexes is because
giving js access to raw memory has high potential risk. To mitigate that
it's easier to make sure the developer is always quickly alerted to the
fact that their code is attempting to access beyond memory bounds.

Because SlowBuffer will be deprecated, and simply returns a new Buffer
instance, all tests on SlowBuffer have been removed.

Heapdumps will now show usage under "smalloc" instead of "Buffer".

ParseArrayIndex was added to node_internals to support proper uint
argument checking/coercion for external array data indexes.

SlabAllocator had to be updated since handle_ no longer exists.
2013-06-18 15:39:13 -07:00
Trevor Norris
252cdfa43b smalloc: add api to manually dispose Persistent
If the user knows the allocation is no longer needed then the memory can
be manually released.

Currently this will not ClearWeak the Persistent, so the callback will
still run.

If the user passed a ClearWeak callback, and then disposed the object,
the buffer callback argument will == NULL.
2013-06-18 15:38:06 -07:00
Trevor Norris
8f3f9f7830 smalloc: initial implementation
smalloc is a simple utility for quickly allocating external memory onto
js objects. This will be used to centralize how memory is managed in
node, and will become the backer for Buffers. So in the future crypto's
SlabBuffer, stream's SlabAllocator will be removed.

Note on the js API: because no arguments are optional the order of
arguments have been placed to match their cc counterparts as closely as
possible.
2013-06-18 15:37:51 -07:00
isaacs
637acb2b34 Now working on 0.10.13 2013-06-18 11:14:57 -07:00
isaacs
a088cf4f93 2013.06.18, Version 0.10.12 (Stable)
* npm: Upgrade to 1.2.32

* readline: make `ctrl + L` clear the screen (Yuan Chuan)

* v8: add setVariableValue debugger command (Ben Noordhuis)

* net: Do not destroy socket mid-write (isaacs)

* v8: fix build for mips32r2 architecture (Andrei Sedoi)

* configure: fix cross-compilation host_arch_cc() (Andrei Sedoi)
2013-06-18 09:50:53 -07:00
Bert Belder
1bf6d78980 stream_wrap: remove bogus assert
Libuv may provide a NULL buffer to the uv_read callback in case of an
error, so with this assert we'd be using the api incorrectly. None of
the current DoRead implementations rely on this constraint, either.
2013-06-18 01:15:25 +02:00
Ben Noordhuis
b9165252e3 src: clean up using directives
Remove the unused ones and alphabetically sort the ones that remain.
2013-06-17 23:32:19 +02:00
Timothy J Fontaine
c0281f1b30 build: fix include order for building on windows
fallout from the tls_wrap feature landing
2013-06-17 10:41:48 -07:00
Linus Mårtensson
5e4e8ec429 build: add android support
Resolves minor discrepancies between android and standard POSIX systems.
In addition, some configure parameters were added, and a helper-script
for android configuration. Ideally, this script should be merged into
the standard configure script.

To build for android, source the android-configure script with an NDK
path:

    source ./android-configure ~/android-ndk-r8d

This will create an android standalone toolchain and export the
necessary environment parameters.

After that, build as normal:

    make -j8

After the build, you should now have android-compatible NodeJS binaries.
2013-06-17 17:21:56 +02:00
Fedor Indutny
212e9cd8c9 tls: session API returns 2013-06-17 14:00:26 +02:00
Ben Noordhuis
0581f5cb60 stream_wrap: fix signed/unsigned comparison warning 2013-06-17 01:23:57 +02:00
Ben Noordhuis
70a75cd41e cares: fix uninitialized variable warning
Suppress the following warning:

  ../../src/cares_wrap.cc: In function ‘v8::Handle<v8::Value>
  node::cares_wrap::SetServers(const v8::Arguments&)’:
  ../../src/cares_wrap.cc:1017:5: warning: ‘uv_ret.uv_err_s::code’
  may be used uninitialized in this function [-Wuninitialized]
2013-06-17 01:22:41 +02:00
Fedor Indutny
03e008ddb8 tls_wrap: embed TLS encryption into streamwrap 2013-06-16 09:30:14 +02:00
Fedor Indutny
4c48a39c65 stream_wrap: introduce StreamWrapCallbacks
StreamWrapCallbacks is a helper class for incepting into uv_stream_t*
management process.
2013-06-15 21:44:51 +02:00
Fedor Indutny
6978e998ee process: abstract out HandleToStream
Originally contributed by @tjfontaine, but modified to be faster and
more generic.
2013-06-15 21:44:50 +02:00
Fedor Indutny
0495b7031c crypto: clear error on return in AddCRL 2013-06-15 21:44:50 +02:00
Fedor Indutny
5dd155a3bb crypto: ensure that read head is always non-empty 2013-06-15 21:43:24 +02:00
Fedor Indutny
4536b27ac1 crypto: do not deallocate embedded buffer 2013-06-14 17:10:04 +02:00
Fedor Indutny
56d9c48573 crypto: fix excessive buffer allocation
Allocate buffer only if the next one isn't free.
2013-06-14 17:10:04 +02:00
isaacs
17d00f1657 Now working on 0.10.12 2013-06-13 11:37:04 -07:00
isaacs
d9d5bc4654 2013.06.13, Version 0.10.11 (Stable)
* uv: upgrade to 0.10.11

* npm: Upgrade to 1.2.30

* openssl: add missing configuration pieces for MIPS (Andrei Sedoi)

* Revert "http: remove bodyHead from 'upgrade' events" (isaacs)

* v8: fix pointer arithmetic undefined behavior (Trevor Norris)

* crypto: fix utf8/utf-8 encoding check (Ben Noordhuis)

* net: Fix busy loop on POLLERR|POLLHUP on older linux kernels (Ben Noordhuis, isaacs)
2013-06-13 10:35:30 -07:00
Trevor Norris
e92f4879eb string_bytes: write strings using new API
StringBytes::Write now uses new v8 API and also does preliminary check
if the string is external, then will use external memory instead.
2013-06-12 14:43:37 -07:00
Trevor Norris
642ea2b668 string_bytes: use external for large strings
When large strings are used they cause v8's GC to spend a lot more time
cleaning up. In these cases it's much faster to use external string
resources.

UTF8 strings do not use external string resources because only one and
two byte external strings are supported.

EXTERN_APEX is the value at which v8's GC overtakes performance.

The following table has the type and buffer size that use to encode the
strings as rough estimates of the percentage of performance gain from
this patch (UTF8 is missing because they cannot be externalized).

encoding  128KB    1MB    5MB
-----------------------------
ASCII       58%   208%   250%
HEX         15%    74%    86%
BASE64      11%    74%    71%
UCS2         2%   225%   398%
BINARY    2234%  1728%  2305%

BINARY is so much faster across the board because of using the new v8
WriteOneByte API.
2013-06-12 14:43:24 -07:00
Trevor Norris
87624ab911 string_bytes: implement new v8 API
v8 has a new API to write out strings to memory. This has been
implemented.

One other change of note is BINARY encoded strings have a new
implementation. This has improved performance substantially.
2013-06-11 15:42:50 -07:00
Trevor Norris
45a08cb216 lint: add mising isolates and minor style fixes 2013-06-11 15:42:49 -07:00
Ben Noordhuis
393d33e7ea src: upgrade after v8 api change
The prototype of v8::Persistent<T>::MakeWeak() has changed. Update the
code in src/ to follow suit.
2013-06-12 00:07:28 +02:00
Fedor Indutny
9ae1d182ba crypto: free excessive memory in NodeBIO
Before this commit NodeBIO never shrank, possibly consuming a lot of
memory (depending on reader's haste).

All buffers between write_head's child and read_head should be
deallocated on read, leaving only space left in write_head and in the
next buffer.
2013-06-08 15:40:57 +04:00
Ben Noordhuis
4bb4f734b3 src: unexport node_isolate
Commit 0bba5902 accidentally (or maybe erroneously) added node_isolate
to src/node.h and src/node_object_wrap.h.

Undo that, said variable is not for public consumption. Add-on authors
should use v8::Isolate::GetCurrent() instead.

I missed that while reviewing. Mea culpa.

Fixes #5639.
2013-06-07 17:01:16 +02:00
isaacs
6ada73383c Now working on v0.10.11 2013-06-04 14:38:41 -07:00
isaacs
25e51c396a 2013.06.04, Version 0.10.10 (Stable)
* uv: Upgrade to 0.10.10

* npm: Upgrade to 1.2.25

* url: Properly parse certain oddly formed urls (isaacs)

* stream: unshift('') is a noop (isaacs)
2013-06-04 12:13:46 -07:00
Ben Noordhuis
a7820a15e7 src: replace ngx-queue.h with queue.h
No functional changes, just one less entry in the LICENSE file.
2013-06-04 12:22:03 +02:00
Nick Desaulniers
72b92e92d3 src: wrap macros in do {...} while (0)
Wrapped two macros in do {...} while (0) blocks and lined up
backslashes.  Uses up semicolon in contexts where a dangling semicolon
is erroneous.
2013-06-04 11:54:05 +02:00
Trevor Norris
4b31a2d8da process: use Tock for nextTickQueue items
v8 plays very well with constructed objects, so we're using one in the
nextTickQueue.
2013-05-30 16:51:41 -07:00
Trevor Norris
bcb85a1d31 src: remove old comment code
Now that maxTickDepth no longer exists there's no depth index on
infoBox. Forgot to remove the comment about this.
2013-05-30 15:09:50 -07:00
Trevor Norris
b846842aff process: remove spinner
Remove the need to call start/stop the uv_idle spinner between
MakeCallbacks. The one place where the tick processor needs to be kicked
is where a user catches uncaughtException. For that we'll now use
setImmediate, which accomplishes the same task.
2013-05-30 14:51:40 -07:00
isaacs
ce54f4ae50 Now working on v0.10.10 2013-05-30 11:28:07 -07:00
isaacs
878ffdbe6a 2013.05.30, Version 0.10.9 (Stable)
* npm: Upgrade to 1.2.24

* uv: Upgrade to v0.10.9

* repl: fix JSON.parse error check (Brian White)

* tls: proper .destroySoon (Fedor Indutny)

* tls: invoke write cb only after opposite read end (Fedor Indutny)

* tls: ignore .shutdown() syscall error (Fedor Indutny)
2013-05-30 10:31:07 -07:00
Trevor Norris
9a6c0853bc process: remove max tick check for domains
maxTickDepth checks have been removed for domains and replaced with a
flag that checks if the last callback threw. If it did then execution of
the remaining tickQueue is deferred to the spinner.

This is to prevent domains from entering a continuous loop when an error
callback also throws an error.
2013-05-30 09:33:21 -07:00
Trevor Norris
0761c90204 process: remove maxTickDepth from _tickCallback
Removes the check for maxTickDepth for non-domain callbacks. So a user
can starve I/O by setting a recursive nextTick.

The domain case is more complex and will be addressed in another commit.
2013-05-30 09:30:19 -07:00
Trevor Norris
5b636feaa8 process: relocate needSpinner calls
It's only necessary to request the spinner once tickDone has been
called, and not on every nextTick.
2013-05-30 09:29:15 -07:00
Andrew Paprocki
49e3fcd058 vm: fix race condition in watchdog cleanup
Previous code was calling uv_loop_delete() directly on a running loop,
which led to race condition aborts/segfaults within libuv.  This change
changes the watchdog thread to call uv_run() with UV_RUN_ONCE so that
the call exits after either the timer times out or uv_async_send() is
called from the main thread in Watchdog::Destroy().  The timer/async
handles are then closed and uv_run() with UV_RUN_DEFAULT is called so
that libuv has a chance to cleanup before the thread exits.  The main
thread meanwhile calls uv_thread_join() and then uv_loop_delete() to
complete the cleanup.
2013-05-30 15:57:25 +02:00
Ben Noordhuis
c188a75103 buffer: guard against integer overflow 2013-05-30 00:13:05 +02:00
Ben Noordhuis
36ebff0470 buffer: simplify ReadFloatGeneric offset checks 2013-05-30 00:13:04 +02:00
Ben Noordhuis
ef0926ce42 os: use IsBigEndian() in GetEndianness() function 2013-05-30 00:13:04 +02:00
Ben Noordhuis
d02f228263 buffer: guard against pointer aliasing issues 2013-05-30 00:12:57 +02:00
Ben Noordhuis
7890a69e4d src: add endianness helper functions 2013-05-30 00:12:57 +02:00
Ben Noordhuis
448adaa456 src: simplify HandleWrap initialization 2013-05-30 00:12:49 +02:00
Ben Noordhuis
4d68daea0f src: replace c-style casts with c++-style casts 2013-05-30 00:12:49 +02:00
Ben Noordhuis
28659aba37 Merge remote-tracking branch 'origin/v0.10'
Conflicts:
	deps/uv/ChangeLog
	deps/uv/src/unix/stream.c
	deps/uv/src/version.c
	lib/tls.js
2013-05-29 23:12:11 +02:00
Fedor Indutny
fa170dd2b2 tls: ignore .shutdown() syscall error
Quote from SSL_shutdown man page:

  The output of SSL_get_error(3) may be misleading,
  as an erroneous SSL_ERROR_SYSCALL may be flagged even though
  no error occurred.

Also, handle all other errors to prevent assertion in `ClearError()`.
2013-05-28 20:14:44 +04:00
isaacs
ba048e72b0 Merge remote-tracking branch 'ry/v0.10'
Conflicts:
	AUTHORS
	ChangeLog
	configure
	deps/uv/ChangeLog
	deps/uv/src/unix/darwin.c
	deps/uv/src/unix/stream.c
	deps/uv/src/version.c
	deps/v8/src/isolate.cc
	deps/v8/src/version.cc
	lib/http.js
	src/node_version.h
2013-05-27 14:46:52 -07:00
isaacs
ccb77e1c9d Now working on 0.10.9 2013-05-24 15:45:46 -07:00
isaacs
30d9e9fdd9 2013.05.24, Version 0.10.8 (Stable)
* v8: update to 3.14.5.9

* uv: upgrade to 0.10.8

* npm: Upgrade to 1.2.23

* http: remove bodyHead from 'upgrade' events (Nathan Zadoks)

* http: Return true on empty writes, not false (isaacs)

* http: save roundtrips, convert buffers to strings (Ben Noordhuis)

* configure: respect the --dest-os flag consistently (Nathan Rajlich)

* buffer: throw when writing beyond buffer (Trevor Norris)

* crypto: Clear error after DiffieHellman key errors (isaacs)

* string_bytes: strip padding from base64 strings (Trevor Norris)
2013-05-24 15:06:33 -07:00
Timothy J Fontaine
007e63bb13 buffer: special case empty string writes
Prior to 119354f we specifically handled passing a zero length string
to write on a buffer, restore that functionality.
2013-05-23 16:32:04 -07:00
Timothy J Fontaine
17e696c312 systemtap: add tapset for node user probes
This makes systemtap tracing prettier, you can do things like `stap -e
'probe node_http_server_request { println(probestr); }'`
2013-05-22 20:19:31 -07:00
Timothy J Fontaine
23509eb9e8 dtrace: unify dtrace and systemtap interfaces 2013-05-22 20:19:31 -07:00
Timothy J Fontaine
f8193ab3c4 timers: use uv_now instead of Date.now
This saves a few calls to gettimeofday which can be expensive, and
potentially subject to clock drift. Instead use the loop time which
uses hrtime internally.

fixes #5497
2013-05-22 20:13:14 -07:00
Trevor Norris
f58eb8f5db src: remove unused comment
Now that Context::New(Isolate*) returns Local, the removed comment is
no longer applicable that there is a Persistent which will need to be
disposed.
2013-05-22 16:09:06 -07:00
Trevor Norris
2868bf94b6 src: upgrade to new v8 api
Small change that Context::New requires an isolate and returns Local
instead of Persistent.
2013-05-22 14:12:25 -07:00
isaacs
0fefcc1690 Merge remote-tracking branch ry/v0.10 into master
Conflicts:
	AUTHORS
	ChangeLog
	src/node_crypto.cc
	src/node_version.h
2013-05-20 14:43:14 -07:00
isaacs
3a2b5030ae crypto: Clear error after DiffieHellman key errors
Fixes #5499
2013-05-20 14:27:32 -07:00
Trevor Norris
d5d5170c35 string_bytes: strip padding from base64 strings
Because of variations in different base64 implementation, it's been
decided to strip all padding from the end of a base64 string and
calculate its size from that.
2013-05-20 13:40:58 -07:00
isaacs
f57ff787aa src: Remove superfluous static_cast 2013-05-17 16:58:05 -07:00
isaacs
bae6d089a4 Now working on 0.10.8 2013-05-17 14:37:44 -07:00
isaacs
61c9f78c63 Merge remote-tracking branch 'ry/v0.10' into master
Conflicts:
	AUTHORS
	ChangeLog
	deps/uv/ChangeLog
	deps/uv/config-unix.mk
	deps/uv/src/unix/stream.c
	deps/uv/src/version.c
	deps/uv/uv.gyp
	src/node.cc
	src/node_buffer.cc
	src/node_crypto.cc
	src/node_version.h
	src/stream_wrap.cc
	src/stream_wrap.h
2013-05-17 14:04:54 -07:00
isaacs
d2fdae197a 2013.05.17, Version 0.10.7 (Stable)
* uv: upgrade to v0.10.7

* npm: Upgrade to 1.2.21

* crypto: Don't ignore verify encoding argument (isaacs)

* buffer, crypto: fix default encoding regression (Ben Noordhuis)

* timers: fix setInterval() assert (Ben Noordhuis)
2013-05-17 13:59:10 -07:00
isaacs
199fa9f8dd crypto: Don't ignore verify encoding argument 2013-05-17 13:55:29 -07:00
Trevor Norris
7998843807 fs_event: use cached Persistent syms instead
Instead of String::New every time, use a Persistent sym. This can be
accomplished in two ways:

1) Local<String> str = *persistent_str_sym;

2) Handle<String> str = persistent_str_sym;

I've chosen to use the latter method for simplicity's sake.

Other small changes include creating syms on Initialize and removing
unnecessary Local casting on return values.
2013-05-16 16:06:01 -07:00
Trevor Norris
999ee45d36 src: add node_isolates
Few primitives weren't being passed node_isolate. Adding them for
consistency.
2013-05-16 15:58:33 -07:00
Ben Noordhuis
f59ab10a64 buffer, crypto: fix default encoding regression
The default encoding is 'buffer'. When the input is a string, treat it
as 'binary'. Fixes the following assertion:

  node: ../src/string_bytes.cc:309: static size_t
  node::StringBytes::StorageSize(v8::Handle<v8::Value>, node::encoding):
  Assertion `0 && "buffer encoding specified but string provided"'
  failed.

Introduced in 64fc34b2.

Fixes #5482.
2013-05-16 17:25:24 +02:00
isaacs
ef2b2a3f52 Now working on v0.10.7 2013-05-14 14:33:56 -07:00
Timothy J Fontaine
8886c6bf62 dns: add getServers and setServers
getServers returns an array of ips that are currently being used for
resolution

setServers takes an array of ips that are to be used for resolution,
this will throw if there's invalid input but preserve the original
configuration
2013-05-14 14:15:24 -07:00
isaacs
5deb1672f2 2013.05.14, Version 0.10.6 (Stable)
* module: Deprecate require.extensions (isaacs)

* stream: make Readable.wrap support objectMode, empty streams (Daniel Moore)

* child_process: fix handle delivery (Ben Noordhuis)

* crypto: Fix performance regression (isaacs)

* src: DRY string encoding/decoding (isaacs)
2013-05-14 13:51:43 -07:00
isaacs
a241deb19a crypto: Pass encodings for Hmac digest 2013-05-14 13:51:43 -07:00
isaacs
c1e8c8de1c crypto: Pass encodings to C++ for Sign/Verify 2013-05-14 13:51:43 -07:00
isaacs
430dc39e87 crypto: use StringBytes::Encode 2013-05-14 13:51:43 -07:00
isaacs
a1eacdf12a crypto: Pass strings to binding layer directly 2013-05-14 13:51:43 -07:00
isaacs
119354f735 buffer: DRY string encoding using StringBytes
This also templatizes the Buffer::*Slice functions, and the template
function probably cannot be safely used outside of Node.  However, it
also SHOULD not be used outside of Node, so this is arguably a feature
as well as a caveat.
2013-05-14 13:51:42 -07:00
isaacs
4e8cddddcb src: use StringBytes for DecodeWrite/DecodeBytes/Encode
Bonus: this makes node::Encode actually work properly with base64,
ucs2, hex, etc.
2013-05-14 13:51:42 -07:00
isaacs
69dac92c36 src: Use StringBytes in StreamWrap 2013-05-14 13:51:42 -07:00
isaacs
64fc34b270 src: Add StringBytes static util class
Four functions:

- StringBytes::StorageSize()
- StringBytes::Size()
- StringBytes::Write()
- StringBytes::Encode()
2013-05-14 13:51:24 -07:00
isaacs
458c8bb9f8 Now working on 0.11.3 2013-05-13 15:54:19 -07:00
isaacs
5d3dc0e4c3 2013.05.13, Version 0.11.2 (Unstable)
* uv: Upgrade to 0.11.2

* V8: Upgrade to 3.19.0

* npm: Upgrade to 1.2.21

* build: Makefile should respect configure --prefix (Timothy J Fontaine)

* cluster: use round-robin load balancing (Ben Noordhuis)

* debugger, cluster: each worker has new debug port (Miroslav Bajtoš)

* debugger: `restart` with custom debug port (Miroslav Bajtoš)

* debugger: breakpoints in scripts not loaded yet (Miroslav Bajtoš)

* event: EventEmitter#setMaxListeners() returns this (Sam Roberts)

* events: add EventEmitter.defaultMaxListeners (Ben Noordhuis)

* install: Support $(PREFIX) install target directory prefix (Olof Johansson)

* os: Include netmask in os.networkInterfaces() (Ben Kelly)

* path: add path.isAbsolute(path) (Ryan Doenges)

* stream: Guarantee ordering of 'finish' event (isaacs)

* streams: introduce .cork/.uncork/._writev (Fedor Indutny)

* vm: add support for timeout argument (Andrew Paprocki)
2013-05-13 14:54:38 -07:00
Ben Noordhuis
7349667467 stream_wrap: MayContainNonAscii() is deprecated
V8 3.19.0 deprecates v8::String::MayContainNonAscii(). It always returns
true so there is not much point in keeping the call site around.
2013-05-13 04:40:14 +02:00
Ben Kelly
8a407f58b9 os: Include netmask in os.networkInterfaces()
re #3765 and #5432
fixes #4743
2013-05-08 17:04:29 -07:00
Miroslav Bajtoš
fbf4641462 src: initialize debug-related uv_async_t handles
uv_async_t handles for dispatching of debug messages and
emitting NODE_DEBUG_ENABLED used to be initialized every time
node::EnableDebug() was called, which happened every time
user sends a SIGUSR1.

Now they are initialized only once from node::Init() during
application start.
2013-05-08 16:53:53 -07:00
Miroslav Bajtoš
43ec1b1c2e debugger, cluster: each worker has new debug port
Implement support for debugging cluster workers. Each worker process
is assigned a new debug port in an increasing sequence.

I.e. when master process uses port 5858, then worker 1 uses port 5859,
worker 2 uses port 5860, and so on.

Introduce new command-line parameter '--debug-port=' which sets debug_port
but does not start debugger. This option works for all node processes, it
is not specific to cluster workers.

Fixes joyent/node#5318.
2013-05-08 16:53:52 -07:00
Brian White
aca275f58d stream_wrap: fix memory leak on early return 2013-05-07 15:05:54 -07:00
Trevor Norris
b7f6e6b42f stream_wrap: remove unused arg from WriteBuffer
WriteBuffer was changed in the cork/uncork implementation (60ed2c54).
The unused argument has been removed.
2013-05-07 14:44:40 -07:00
Andrew Paprocki
c081809344 vm: add support for timeout argument
Add a watchdog class which executes a timer in a separate event loop in
a separate thread that will terminate v8 execution if it expires.

Add timeout argument to functions in vm module which use the watchdog
if a non-zero timeout is specified.
2013-04-29 23:38:19 +02:00
Ben Noordhuis
af1ed99ce2 Merge remote-tracking branch 'origin/v0.10'
Conflicts:
	AUTHORS
	ChangeLog
	deps/uv/ChangeLog
	deps/uv/src/version.c
	lib/http.js
	src/node_crypto.cc
	src/node_os.cc
	src/node_version.h
	test/simple/helper-debugger-repl.js
2013-04-29 14:08:51 +02:00
Fedor Indutny
60ed2c5434 net: implement ._writev for .cork/uncork() support
Add Writev method to StreamWrap class for writing mixed array of strings
and buffers. Expose this method for TCP class.
2013-04-27 21:03:40 +04:00
isaacs
ec5577cf9d Now working on 0.10.6 2013-04-23 14:07:23 -07:00
isaacs
deeaf8fab9 2013.04.23, Version 0.10.5 (Stable)
* uv: Upgrade to 0.10.5 (isaacs)

* build: added support for Visual Studio 2012 (Miroslav Bajtoš)

* http: Don't try to destroy nonexistent sockets (isaacs)

* crypto: LazyTransform on properties, not methods (isaacs)

* assert: put info in err.message, not err.name (Ryan Doenges)

* dgram: fix no address bind() (Ben Noordhuis)

* handle_wrap: fix NULL pointer dereference (Ben Noordhuis)

* os: fix unlikely buffer overflow in os.type() (Ben Noordhuis)

* stream: Fix unshift() race conditions (isaacs)
2013-04-23 13:27:37 -07:00
isaacs
c77747354c os: Fix uname() error handling on sunos
The uname function can return any non-negative int to indicate success.

Strange, but that's how it is documented.  This also fixes a similar
buffer overflow in the even more unlikely event that info.release is
> 255 characters, similar to how 78c5de5 did for info.sysname.
2013-04-22 11:00:52 -07:00
mscdex
c4379a5554 src: fix potential memory leak on early return 2013-04-20 23:30:21 -04:00
mscdex
2322580dfb src: don't initialize variable before assignment 2013-04-20 23:30:20 -04:00
isaacs
e4406b76df Now working on 0.11.2 2013-04-19 09:14:44 -07:00
isaacs
4babd2b46e 2013.04.19, Version 0.11.1 (Unstable)
* V8: upgrade to 3.18.0

* uv: Upgrade to v0.11.1

* http: split into multiple separate modules (Timothy J Fontaine)

* http: escape unsafe characters in request path (Ben Noordhuis)

* url: Escape all unwise characters (isaacs)

* build: depend on v8 postmortem-metadata if enabled (Paddy Byers)

* etw: update prototypes to match dtrace provider (Timothy J Fontaine)

* buffer: change output of Buffer.prototype.toJSON() (David Braun)

* dtrace: actually use the _handle.fd value (Timothy J Fontaine)

* dtrace: pass more arguments to probes (Dave Pacheco)

* build: allow building with dtrace on osx (Dave Pacheco)

* zlib: allow passing options to convenience methods (Kyle Robinson Young)
2013-04-19 08:32:32 -07:00
Trevor Norris
0a4ebc3d2c src: replace Holder() with This()
Switch to always use args.This() to retrieve object instance.
2013-04-19 15:24:01 +02:00
Ben Noordhuis
8e190bf6a1 Merge remote-tracking branch 'origin/v0.10'
Conflicts:
	src/node_os.cc
2013-04-18 12:14:30 +02:00
Trevor Norris
659fb238e7 crypto: fix return Local Handle w/o scope.Close()
A new String was being created and returned, but was not sent through
the scope.Close(), which caused it to be cleaned up before being
returned.
2013-04-18 01:30:36 +02:00
Ben Noordhuis
f044a6f3fa buffer: upgrade to new V8 profiler API 2013-04-17 16:59:39 +02:00
Ben Noordhuis
ccd37226c6 handle_wrap: fix NULL pointer dereference
Fix a NULL pointer dereference in src/handle_wrap.cc which is really a
use-after-close bug.

The test checks that unref() after close() works on process.stdout but
this bug affects everything that derives from HandleWrap. I discovered
it because child processes would sometimes quit for no reason (that is,
no reason until I turned on core dumps.)
2013-04-16 23:11:03 +02:00
Ben Noordhuis
d58ee7e5c7 os: unbreak windows build
Windows doesn't have MAXHOSTNAMELEN. Introduced in afbadde.
2013-04-15 22:39:03 +02:00
Ben Noordhuis
afbaddecd3 os: handle 256 character hostnames
Fix a (rather academic) buffer overflow. MAXHOSTNAMELEN is 256 on most
platforms, which means the buffer wasn't big enough to hold the
trailing nul byte on a system with a maximum length hostname.
2013-04-15 21:13:29 +02:00
Ben Noordhuis
78c5de598b os: fix unlikely buffer overflow in os.type()
* Fix a buffer overflow that happens iff strlen(info.sysname) > 255.
* Check the return value of uname().
2013-04-15 20:57:14 +02:00
Fedor Indutny
259839fe75 Merge branch 'v0.10'
Conflicts:
	ChangeLog
	deps/uv/src/version.c
	src/node.h
	src/node_crypto.cc
	src/node_crypto_bio.cc
	src/node_crypto_bio.h
	src/node_object_wrap.h
	src/node_version.h
2013-04-12 11:30:11 -04:00
isaacs
440bc060b9 Now working on v0.10.5 2013-04-11 11:07:08 -07:00
isaacs
9712aa9f76 2013.04.11, Version 0.10.4 (Stable)
* uv: Upgrade to 0.10.4

* npm: Upgrade to 1.2.18

* v8: Avoid excessive memory growth in JSON.parse (Fedor Indutny)

* child_process, cluster: fix O(n*m) scan of cmd string (Ben Noordhuis)

* net: fix socket.bytesWritten Buffers support (Fedor Indutny)

* buffer: fix offset checks (Łukasz Walukiewicz)

* stream: call write cb before finish event (isaacs)

* http: Support write(data, 'hex') (isaacs)

* crypto: dh secret should be left-padded (Fedor Indutny)

* process: expose NODE_MODULE_VERSION in process.versions (Rod Vagg)

* crypto: fix constructor call in crypto streams (Andreas Madsen)

* net: account for encoding in .byteLength (Fedor Indutny)

* net: fix buffer iteration in bytesWritten (Fedor Indutny)

* crypto: zero is not an error if writing 0 bytes (Fedor Indutny)

* tls: Re-enable check of CN-ID in cert verification (Tobias Müllerleile)
2013-04-11 09:39:16 -07:00
Trevor Norris
f83afd3c74 src: get rid of compiler warning
Removed the following compiler warning from clang:

warning: adding 'int' to a string does not append to the string
[-Wstring-plus-int]
2013-04-10 23:51:17 +02:00
Trevor Norris
8428b52e25 req_wrap: only grab domain object if in use 2013-04-10 23:51:17 +02:00
Trevor Norris
deda899d77 src: add using_domains to node_internals
Make it easy to check if domains are in use
2013-04-10 23:51:17 +02:00
Trevor Norris
33fae69779 domain: change name for domain setup
The name UsingDomains is misleading for a function that initializes
domains for use.
2013-04-10 23:51:16 +02:00
Trevor Norris
591cfe6b7b src: add node_isolate to remaining scopes 2013-04-10 23:51:16 +02:00
Ben Noordhuis
cd96f0aba8 src: don't SetInternalField() in ObjectWrap dtor
Call SetPointerInInternalField(0, NULL) rather than
SetInternalField(0, Undefined()).

Fixes the following spurious NULL pointer dereference in debug builds:

  #0  0x03ad2821 in v8::internal::FixedArrayBase::length ()
  #1  0x03ad1dfc in v8::internal::FixedArray::get ()
  #2  0x03ae05dd in v8::internal::Context::global_object ()
  #3  0x03b6b87d in v8::internal::Context::builtins ()
  #4  0x03ae1871 in v8::internal::Isolate::js_builtins_object ()
  #5  0x03ab4fab in v8::CallV8HeapFunction ()
  #6  0x03ab4d4a in v8::Value::Equals ()
  #7  0x03b4f38b in CheckEqualsHelper ()
  #8  0x03ac0f4b in v8::Object::SetInternalField ()
  #9  0x06a99ddd in node::ObjectWrap::~ObjectWrap ()
  #10 0x06a8b051 in node::Buffer::~Buffer ()
  #11 0x06a8afbb in node::Buffer::~Buffer ()
  #12 0x06a8af5e in node::Buffer::~Buffer ()
  #13 0x06a9e569 in node::ObjectWrap::WeakCallback ()
2013-04-10 15:37:30 +02:00
Fedor Indutny
c9850952c9 crypto: move write_head in bio's Reset() method 2013-04-10 16:55:11 +04:00
Fedor Indutny
798d1772c0 crypto: fix changing buffers in bio
We should go to next buffer if *current* one is full, not the next one.
Otherwise we may hop through buffers and written data will become
interleaved, which will lead to failure.
2013-04-10 16:55:10 +04:00
Fedor Indutny
62a214268a crypto: fix style issues in bio
Stop changing arguments, use local variables for things that change.
2013-04-10 16:55:10 +04:00
Ben Noordhuis
0d5595ac60 Revert "crypto: use better memory BIO implementation"
This change shouldn't have landed in the stable branch. It's a feature,
not a bug fix.

This reverts commit 58f93ffc4a.
This reverts commit 8c8ebe49b6.
This reverts commit ba0f7b8066.
This reverts commit 21f3c5c367.
2013-04-10 13:54:15 +02:00
Ben Noordhuis
eeb4c3216d crypto: remove unused ClientHelloParser field 2013-04-10 01:39:00 +02:00
Fedor Indutny
037bcac7ba crypto: dh secret should be left-padded
DH_compute_secret() may return key that is smaller than input buffer,
in such cases key should be left-padded because it is a BN (big number).

fix #5239
2013-04-08 19:45:35 +04:00
Rod Vagg
ccabd4a6fa process: expose NODE_MODULE_VERSION in process.versions 2013-04-08 16:48:18 +02:00
Fedor Indutny
21f3c5c367 crypto: move write_head in bio's Reset() method 2013-04-08 15:53:25 +04:00
Fedor Indutny
ba0f7b8066 crypto: fix changing buffers in bio
We should go to next buffer if *current* one is full, not the next one.
Otherwise we may hop through buffers and written data will become
interleaved, which will lead to failure.
2013-04-08 15:51:55 +04:00
Fedor Indutny
8c8ebe49b6 crypto: fix style issues in bio
Stop changing arguments, use local variables for things that change.
2013-04-08 15:51:51 +04:00
Fedor Indutny
77715edee8 crypto: zero is not an error if writing 0 bytes
fix #5128
2013-04-07 22:10:19 +04:00
isaacs
2c9a38d059 Merge remote-tracking branch 'ry/v0.10'
Conflicts:
	AUTHORS
	ChangeLog
	deps/v8/src/json-parser.h
	lib/crypto.js
	src/node_version.h
2013-04-05 09:02:48 -07:00
Fedor Indutny
58f93ffc4a crypto: use better memory BIO implementation 2013-04-05 04:12:13 +04:00
isaacs
734a19060c Now working on 0.10.4 2013-04-03 11:28:04 -07:00
isaacs
d4982f6f5e 2013.04.03, Version 0.10.3 (Stable)
* npm: Upgrade to 1.2.17

* child_process: acknowledge sent handles (Fedor Indutny)

* etw: update prototypes to match dtrace provider (Timothy J Fontaine)

* dtrace: pass more arguments to probes (Dave Pacheco)

* build: allow building with dtrace on osx (Dave Pacheco)

* http: Remove legacy ECONNRESET workaround code (isaacs)

* http: Ensure socket cleanup on client response end (isaacs)

* tls: Destroy socket when encrypted side closes (isaacs)

* repl: isSyntaxError() catches "strict mode" errors (Nathan Rajlich)

* crypto: Pass options to ctor calls (isaacs)

* src: tie process.versions.uv to uv_version_string() (Ben Noordhuis)
2013-04-03 10:30:57 -07:00
Timothy J Fontaine
9f65b1edf7 etw: update prototypes to match dtrace provider
The DTrace probes were updated to accomodate platforms that can't
handle structs, update the prototypes for ETW but it's not necessary
to do anything with the new arguments as it's redundant information.
2013-04-03 09:52:56 -07:00
Ben Noordhuis
75463899c8 dtrace: check if _handle property is set
Check that _handle is an object before trying to read its `fd`
property, avoids bogus values.
2013-04-03 09:52:56 -07:00
Timothy J Fontaine
aca31e37f7 dtrace: actually use the _handle.fd value
When using the DTrace/systemtap subsystems it would be helpful to
actually have an fd associated with the requests and responses.
2013-04-03 09:52:56 -07:00
Dave Pacheco
bf22f99f3a dtrace: pass more arguments to probes
OSX and other DTrace implementations don't support dereferencing
structs in probes. To accomodate that pass members from the struct as
arguments so that DTrace is useful on those systems.
2013-04-03 09:52:56 -07:00
Brian White
38106da7cd src: remove unused variables 2013-04-02 18:44:14 +02:00
Timothy J Fontaine
b3a8e0da4a etw: update prototypes to match dtrace provider
The DTrace probes were updated to accomodate platforms that can't
handle structs, update the prototypes for ETW but it's not necessary
to do anything with the new arguments as it's redundant information.
2013-04-01 18:59:48 +02:00
Ben Noordhuis
9b8dd39553 dtrace: check if _handle property is set
Check that _handle is an object before trying to read its `fd`
property, avoids bogus values.
2013-03-30 01:49:21 +01:00
Timothy J Fontaine
aa5da48594 dtrace: actually use the _handle.fd value
When using the DTrace/systemtap subsystems it would be helpful to
actually have an fd associated with the requests and responses.
2013-03-30 01:30:16 +01:00
Dave Pacheco
7634069614 dtrace: pass more arguments to probes
OSX and other DTrace implementations don't support dereferencing
structs in probes. To accomodate that pass members from the struct as
arguments so that DTrace is useful on those systems.
2013-03-30 01:04:00 +01:00
Trevor Norris
2093e7d91a lint: add isolate, remove semicolon 2013-03-30 00:53:56 +01:00
Ben Noordhuis
3f091c7293 src: fix Persistent<> deprecation warning
Pass the Isolate to Persistent<Function>::New(). Fixes the following
warning:

  ../../src/node.cc: In function ‘v8::Handle<v8::Value>
  node::UsingDomains(const v8::Arguments&)’:
  ../../src/node.cc:921: warning: ‘New’ is deprecated
  declared at ../../deps/v8/include/v8.h:4438)
2013-03-29 16:13:25 +01:00
isaacs
46da8c2da6 Now working on 0.11.1 2013-03-28 14:50:43 -07:00
isaacs
bce38b3d74 2013.03.28, Version 0.11.0 (Unstable)
* V8: update to 3.17.13

* os: use %SystemRoot% or %windir% in os.tmpdir() (Suwon Chae)

* util: fix util.inspect() line width calculation (Marcin Kostrzewa)

* buffer: remove _charsWritten (Trevor Norris)

* fs: uv_[fl]stat now reports subsecond resolution (Timothy J Fontaine)

* fs: Throw if error raised and missing callback (bnoordhuis)

* tls: expose SSL_CTX_set_timeout via tls.createServer (Manav Rathi)

* tls: remove harmful unnecessary bounds checking (Marcel Laverdet)

* buffer: write ascii strings using WriteOneByte (Trevor Norris)

* dtrace: fix generation of v8 constants on freebsd (Fedor Indutny)

* dtrace: x64 ustack helper (Fedor Indutny)

* readline: handle wide characters properly (Nao Iizuka)

* repl: Use a domain to catch async errors safely (isaacs)

* repl: emit 'reset' event when context is reset (Sami Samhuri)

* util: custom `inspect()` method may return an Object (Nathan Rajlich)

* console: `console.dir()` bypasses inspect() methods (Nathan Rajlich)
2013-03-28 13:53:13 -07:00
isaacs
97c70a6628 Merge remote-tracking branch 'ry/v0.10'
Conflicts:
	src/node.cc
	src/node_version.h
2013-03-28 13:11:04 -07:00
isaacs
61d254ebdc Node working on 0.10.3 2013-03-28 13:06:24 -07:00
isaacs
8106dc3624 Merge branch 'v0.10.2-release' into v0.10 2013-03-28 13:05:37 -07:00
Ben Noordhuis
902d6cb6d7 src: tie process.versions.uv to uv_version_string() 2013-03-28 20:12:05 +01:00
isaacs
1e0de9c426 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-28 12:07:52 -07:00
Fedor Indutny
4580be0882 tls: handle SSL_ERROR_ZERO_RETURN
see #5004
2013-03-28 21:59:19 +04:00
Trevor Norris
f0b68892d4 domain: fix domain callback from MakeCallback
Since _tickCallback and _tickDomainCallback were both called from
MakeCallback, it was possible for a callback to be called that required
a domain directly to _tickCallback.

The fix was to implement process.usingDomains(). This will set all
applicable functions to their domain counterparts, and set a flag in cc
to let MakeCallback know domain callbacks always need to be checked.

Added test in own file. It's important that the test remains isolated.
2013-03-26 21:26:17 -07:00
Trevor Norris
ccda6bb3ac buffer: remove _charsWritten
_charsWritten is an internal property that was constantly written to,
but never read from. So it has been removed.

Removed documentation reference as well.
2013-03-26 17:53:34 +01:00
Manav Rathi
d20576165a tls: expose SSL_CTX_set_timeout via tls.createServer
Add the `sessionTimeout` integral value to the list of options
recognized by `tls.createServer`.

This option will be useful for applications which need frequently
establish short-lived TLS connections to the same endpoint. The TLS
tickets RFC is an ideal option to reduce the socket setup overhead
for such scenarios, but the default ticket timeout value (5
minutes) is too low to be useful.
2013-03-26 01:37:49 +01:00
Ben Noordhuis
1a65154d72 Merge remote-tracking branch 'origin/v0.10'
Conflicts:
	deps/v8/src/objects-inl.h
	deps/v8/src/objects.h
	src/node_crypto.cc
2013-03-26 00:27:23 +01:00
Ben Noordhuis
cfd0dca9ae crypto: make getCiphers() return non-SSL ciphers
Commit f53441a added crypto.getCiphers() as a function that returns the
names of SSL ciphers.

Commit 14a6c4e then added crypto.getHashes(), which returns the names of
digest algorithms, but that creates a subtle inconsistency: the return
values of crypto.getHashes() are valid arguments to crypto.createHash()
but that is not true for crypto.getCiphers() - the returned values are
only valid for SSL/TLS functions.

Rectify that by adding tls.getCiphers() and making crypto.getCiphers()
return proper cipher names.
2013-03-25 18:42:07 +01:00
Timothy J Fontaine
51f128d64b fs: uv_[fl]stat now reports subsecond resolution
While libuv supports reporting subsecond stat resolution across
platforms, to actually get that resolution your platform and filesystem
must support it (not HFS, ext[23], fat), otherwise the nsecs are 0
2013-03-23 19:32:14 +01:00
Marcel Laverdet
9430ca6865 tls: remove harmful unnecessary bounds checking
The EncIn, EncOut, ClearIn & ClearOut functions are victims of some code
copy + pasting. A common line copied to all of them is:

`if (off >= buffer_length) { ...`

448e0f43 corrected ClearIn's check from `>=` to `>`, but left the others
unchanged (with an incorrect bounds check). However, if you look down at
the next very next bounds check you'll see:

`if (off + len > buffer_length) { ...`

So the check is actually obviated by the next line, and should be
removed.

This fixes an issue where writing a zero-length buffer to an encrypted
pair's *encrypted* stream you would get a crash.
2013-03-24 00:05:37 +07:00
Marcel Laverdet
1526909083 tls: remove harmful unnecessary bounds checking
The EncIn, EncOut, ClearIn & ClearOut functions are victims of some code
copy + pasting. A common line copied to all of them is:

`if (off >= buffer_length) { ...`

448e0f43 corrected ClearIn's check from `>=` to `>`, but left the others
unchanged (with an incorrect bounds check). However, if you look down at
the next very next bounds check you'll see:

`if (off + len > buffer_length) { ...`

So the check is actually obviated by the next line, and should be
removed.

This fixes an issue where writing a zero-length buffer to an encrypted
pair's *encrypted* stream you would get a crash.
2013-03-24 00:04:34 +07:00
Ben Noordhuis
628bd81afb crypto: check randomBytes() size argument
Throw a TypeError if size > 0x3fffffff. Avoids the following V8 fatal
error:

  FATAL ERROR: v8::Object::SetIndexedPropertiesToExternalArrayData()
  length exceeds max acceptable value

Fixes #5126.
2013-03-23 15:50:10 +01:00
isaacs
2f88272ba2 Merge remote-tracking branch 'ry/v0.10' into master
Conflicts:
	src/node.cc
	src/node_version.h
2013-03-21 10:52:01 -07:00
Trevor Norris
f150d56915 src: write ascii strings using WriteOneByte
WriteAscii will be deprecated soon from v8, and performance has
regressed. The v8 team recommended using WriteOneByte instead.
2013-03-21 21:15:28 +04:00
isaacs
9d3a09f9a8 Now working on v0.10.2 2013-03-21 09:14:31 -07:00
isaacs
c274d16435 2013.03.21, Version 0.10.1 (Stable)
* npm: upgrade to 1.2.15

* crypto: Improve performance of non-stream APIs (Fedor Indutny)

* tls: always reset this.ssl.error after handling (Fedor Indutny)

* tls: Prevent mid-stream hangs (Fedor Indutny, isaacs)

* net: improve arbitrary tcp socket support (Ben Noordhuis)

* net: handle 'finish' event only after 'connect' (Fedor Indutny)

* http: Don't hot-path end() for large buffers (isaacs)

* fs: Missing cb errors are deprecated, not a throw (isaacs)

* fs: make write/appendFileSync correctly set file mode (Raymond Feng)

* stream: Return self from readable.wrap (isaacs)

* stream: Never call decoder.end() multiple times (Gil Pedersen)

* windows: enable watching signals with process.on('SIGXYZ') (Bert Belder)

* node: revert removal of MakeCallback (Trevor Norris)

* node: Unwrap without aborting in handle fd getter (isaacs)
2013-03-20 18:15:04 -07:00
Ben Noordhuis
ad819bcc4b src: bump NODE_MODULE_VERSION after abi change 2013-03-20 01:56:29 +01:00
Trevor Norris
f65e14ed1d src: pass Isolate to all applicable api
Update the api to pass node_isolate to all supported methods.

Much thanks to Ben Noordhuis and his work in 51f6e6a.
2013-03-20 01:11:02 +01:00
isaacs
d9036a5d35 dtrace: More style
Continuation lines should be indented with 4 spaces, not a tab.
2013-03-20 01:11:02 +01:00
isaacs
425163e0d6 dtrace: Make D style more D-ish 2013-03-20 01:11:02 +01:00
Fedor Indutny
3375bd8db7 dtrace: x64 ustack helper 2013-03-20 01:11:02 +01:00
Fedor Indutny
3cb5bf1c0d dtrace: fix style in ustack helper 2013-03-20 01:11:02 +01:00
Trevor Norris
831af97df2 v8: revert dtrace fix from 3.14 downgrade
Revert "v8: fix postmortem and dtrace helper build"

This reverts commit aa98539277.
2013-03-20 01:11:01 +01:00
Trevor Norris
0bba590283 bindings: update api
All compile time warnings about using deprecated APIs have been
suppressed by updating node's API. Though there are still many function
calls that can accept Isolate, and still need to be updated.

node_isolate had to be added as an extern variable in node.h and
node_object_wrap.h

Also a couple small fixes for Error handling.

Before v8 3.16.6 the error stack message was lazily written when it was
needed, which allowed you to change the message after instantiation.
Then the stack would be written with the new message the first time it
was accessed. Though that has changed. Now it creates the stack message
on instantiation. So setting a different message afterwards won't be
displayed.

This is not a complete fix for the problem. Getting error without any
message isn't very useful.
2013-03-20 01:11:01 +01:00
Bert Belder
bf83251eea windows: enable watching signals with process.on('SIGXYZ')
This reverts commit ea1cba6246.

The offending commit was intended to land on the v0.8 branch only, but
it accidentally got merged at some point.

Closes #5054.
2013-03-20 00:16:02 +01:00
Trevor Norris
a0867e1c93 node: revert removal of MakeCallback
In 0168109 an implementation of MakeCallback was accidently removed. It
has been re-added.
2013-03-17 13:45:34 +01:00
Ben Noordhuis
ca5022b8f1 net: improve arbitrary tcp socket support
Consider this example:

  // fd 3 is a bound tcp socket
  var s = net.createServer(cb);
  s.listen({ fd: 3 });
  console.log(s.address());  // prints null

This commit makes net.Server#address() print the actual address.

Ditto for non-listen sockets; properties like net.Socket#localAddress
and net.Socket#remoteAddress now return the correct value.

Fixes #5009.
2013-03-14 15:55:30 +01:00
Ben Noordhuis
e99dff4617 deps: upgrade libuv to 7b66ea1 2013-03-14 15:55:26 +01:00
isaacs
5917828622 Merge remote-tracking branch 'ry/v0.10'
Conflicts:
	src/node_version.h
2013-03-13 15:51:24 -07:00
isaacs
110cacd1ed core: Move UNWRAP_NO_ABORT to handle_wrap.h
Otherwise it cannot be used in StreamWrap.

Forgot to include in last patch, broke the build.
2013-03-13 11:26:36 -07:00
isaacs
53f2381455 core: Unwrap without aborting in handle fd getter 2013-03-13 10:16:26 -07:00
Fedor Indutny
68487a73f2 crypto: replace BIO_free with BIO_free_all
From OpenSSL's documentation:

"If BIO_free() is called on a BIO chain it will only free one BIO
resulting in a memory leak."

and

"BIO_free_all() frees up an entire BIO chain, it does not halt if an
error occurs freeing up an individual BIO in the chain"
2013-03-13 00:23:29 +04:00
Fedor Indutny
7845918227 crypto: refactor crypto classes 2013-03-13 00:23:29 +04:00
Fedor Indutny
83d17e509f crypto: merge Cipher and Decipher 2013-03-13 00:23:29 +04:00
Fedor Indutny
a15cc93ae3 crypto: split crypto classes 2013-03-13 00:23:29 +04:00
isaacs
e2b293c360 Now working on 0.10.1 2013-03-11 08:49:33 -07:00
isaacs
163ca27423 2013.03.11, Version 0.10.0 (Stable)
* npm: Upgrade to 1.2.14

* core: Append filename properly in dlopen on windows (isaacs)

* zlib: Manage flush flags appropriately (isaacs)

* domains: Handle errors thrown in nested error handlers (isaacs)

* buffer: Strip high bits when converting to ascii (Ben Noordhuis)

* win/msi: Enable modify and repair (Bert Belder)

* win/msi: Add feature selection for various node parts (Bert Belder)

* win/msi: use consistent registry key paths (Bert Belder)

* child_process: support sending dgram socket (Andreas Madsen)

* fs: Raise EISDIR on Windows when calling fs.read/write on a dir (isaacs)

* unix: fix strict aliasing warnings, macro-ify functions (Ben Noordhuis)

* unix: honor UV_THREADPOOL_SIZE environment var (Ben Noordhuis)

* win/tty: fix typo in color attributes enumeration (Bert Belder)

* win/tty: don't touch insert mode or quick edit mode (Bert Belder)
2013-03-10 17:36:28 -07:00
isaacs
80472bc301 domain: Fix double-exit on nested domains
Minor oversight in fix for #4953.
2013-03-09 07:00:21 -08:00
isaacs
43c1830e0a Now working on 0.11.0 2013-03-08 21:52:36 -08:00
isaacs
4d1e9e5370 Now working on 0.10.0 2013-03-08 21:52:09 -08:00
isaacs
7c9ff8e94a lint 2013-03-08 20:26:26 -08:00
isaacs
6076a25e80 core: Append filename properly in dlopen on windows
Fixes simple/test-module-loading on win32
2013-03-08 18:56:31 -08:00
isaacs
29cd0f2a77 domains: Handle errors thrown in nested error handlers
If a domain error handler throws, it should be caught if it was
in a stack of nested domains.

Fix #4953
2013-03-08 14:46:58 -08:00
Ben Noordhuis
e325ace53c buffer: speed up ascii character scanning
Speed up ASCII character scanning and conversion by 25% to 30% by scanning and
converting whole words instead of individual bytes.
2013-03-08 14:42:15 -08:00
Ben Noordhuis
96a314b68b buffer: strip high bits when converting to ascii
Consider the following example:

  console.log(Buffer('ú').toString('ascii'));

Before this commit, the contents of the buffer was used as-is and hence it
prints 'ú'.

Now, it prints 'C:'. Perhaps not much of an improvement but it conforms to what
the documentation says it does: strip off the high bits.

Fixes #4371.
2013-03-08 14:42:15 -08:00
isaacs
7df4652d7b Now working on 0.9.13
Probably that will be 0.10.0 instead, though.
2013-03-06 13:59:58 -08:00
isaacs
0debf5a829 2013.03.06, Version 0.9.12 (Unstable)
* stream: Allow strings in Readable.push/unshift (isaacs)

* stream: Remove bufferSize option (isaacs)

* stream: Increase highWaterMark on large reads (isaacs)

* stream: _write: takes an encoding argument (isaacs)

* stream: _transform: remove no output() method, provide encoding (isaacs)

* stream: Don't require read(0) to emit 'readable' event (isaacs)

* node: Add --throw-deprecation (isaacs)

* http: fix multiple timeout events (Eugene Girshov)

* http: More useful setTimeout API on server (isaacs)

* net: use close callback, not process.nextTick (Ben Noordhuis)

* net: Provide better error when writing after FIN (isaacs)

* dns: Support NAPTR queries (Pavel Lang)

* dns: fix ReferenceError in resolve() error path (Xidorn Quan)

* child_process: handle ENOENT correctly on Windows (Scott Blomquist)

* cluster: Rename destroy() to kill(signal=SIGTERM) (isaacs)

* build: define nightly tag external to build system (Timothy J Fontaine)

* build: make msi build work when spaces are present in the path (Bert Belder)

* build: fix msi build issue with WiX 3.7/3.8 (Raymond Feng)

* repl: make compatible with domains (Dave Olszewski)

* events: Code cleanup and performance improvements (Trevor Norris)
2013-03-06 13:06:10 -08:00
isaacs
5038f40185 node: Add --throw-deprecation
Extremely handy when tracking down a flood of recursive nextTick warnings.
2013-03-06 11:44:29 -08:00
Ben Noordhuis
958ab661cb handle_wrap: add close callback support 2013-03-06 15:32:40 +01:00
Ben Noordhuis
3d20905b70 handle_wrap: replace unref_ field with flags_ field
Prep work for a follow-up commit that adds support for close callbacks.
2013-03-06 15:25:07 +01:00
Ben Noordhuis
3dbbfd7803 src: remove unused symbols in node_file.cc 2013-03-06 14:45:47 +01:00
Pavel Lang
2ad98725d6 DNS: Support NAPTR queries
They were previously removed in a90bc78534.
2013-03-06 14:31:22 +04:00
isaacs
74784b63d6 cares: Set process._errno, not global.errno
This makes test-internet pass
2013-03-06 14:10:10 +04:00
Nathan Rajlich
dd6432dcf0 process: invoke EventEmitter on process
This properly sets the `_maxListeners` property, which
fixes the max listener warning. Closes #4924.
2013-03-05 14:06:36 -08:00
Ben Noordhuis
2d51036fb9 Merge remote-tracking branch 'origin/v0.8'
Conflicts:
	doc/api/http.markdown
	test/simple/test-crypto.js
2013-03-02 23:13:35 +01:00
Trevor Norris
4f7f8bbdf8 events: _events to object and undefined not null
By making sure the _events is always an object there is one less check
that needs to be performed by emit.

Use undefined instead of null. typeof checks are a lot faster than
isArray.

There are a few places where the this._events check cannot be removed
because it is possible for the user to call those methods after using
utils.extend to create their own EventEmitter, but before it has
actually been instantiated.
2013-03-01 17:36:47 -08:00
Ben Noordhuis
7189b3ed33 crypto: don't assert when calling Cipher#final() twice
Remove the assert() that triggered when Cipher#final() or
Decipher#final() was called twice.

Fixes #4886.
2013-03-02 02:13:18 +01:00
isaacs
4cda016c26 Now working on 0.9.12 2013-03-01 11:19:38 -08:00
isaacs
83392403b7 2013.03.01, Version 0.9.10 (Unstable)
* V8: downgrade 3.14.5

* openssl: update to 1.0.1e

* darwin: Make process.title work properly (Ben Noordhuis)

* fs: Support mode/flag options to read/append/writeFile (isaacs)

* stream: _read() no longer takes a callback (isaacs)

* stream: Add stream.unshift(chunk) (isaacs)

* stream: remove lowWaterMark feature (isaacs)

* net: omit superfluous 'connect' event (Ben Noordhuis)

* build, windows: disable SEH (Ben Noordhuis)

* core: remove errno global (Ben Noordhuis)

* core: Remove the nextTick for running the main file (isaacs)

* core: Mark exit() calls with status codes (isaacs)

* core: Fix debug signal handler race condition lock (isaacs)

* crypto: clear error stack (Ben Noordhuis)

* test: optionally set common.PORT via env variable (Timothy J Fontaine)

* path: Throw TypeError on non-string args to path.resolve/join (isaacs, Arianit Uka)

* crypto: fix uninitialized memory access in openssl (Ben Noordhuis)
2013-03-01 10:59:24 -08:00
Ben Noordhuis
12d0f0bd3a lib, src: remove errno global
Remove the errno global. It's a property on the process object now.

Fixes #3095.
2013-02-28 23:11:47 +01:00
Ben Noordhuis
cb87920ba9 Merge remote-tracking branch 'origin/v0.8'
Conflicts:
	AUTHORS
	ChangeLog
	deps/uv/src/unix/pipe.c
	lib/http.js
	src/node_version.h
2013-02-28 16:58:24 +01:00
Trevor Norris
0c1e7b53d0 process: separate nextTick domain logic
It's cleaner to only load domain ticker logic when the domains are being
used. This makes execution slightly quicker in both cases, and simpler
from the spinner since there is no need to check if the latest callback
requires use of domains.
2013-02-27 16:37:10 -08:00
isaacs
875e4a0c59 core: Remove the nextTick for running the main file
Not necessary, since we can handle the error properly on the first tick
now, even if there are event listeners, etc.

Additionally, this removes the unnecessary "_needTickCallback" from
startup, since Module.loadMain() will kick off a nextTick callback right
after it runs the main module.

Fix #4856
2013-02-27 16:29:36 -08:00
isaacs
95862b2380 core: Mark exit() calls with status codes
Also, exit with 128+n for signal exit n, as is The Unix Way.
2013-02-27 14:47:01 -08:00
Ben Noordhuis
c6e2db2f14 crypto: clear error stack
Clear OpenSSL's error stack on return from Connection::HandleSSLError().
This stops stale errors from popping up later in the lifecycle of the
SSL connection where they would cause spurious failures.

This commit causes a 1-2% performance regression on `make bench-tls`.
We'll address that in follow-up commits if possible but let's ensure
correctness first.

Fixes #4771.
2013-02-27 23:31:40 +01:00
isaacs
30e5366b29 core: Use a uv_signal for debug listener
Starting the debugger directly in the SIGUSR1 signal handler results in
a malloc lock contention ~1% of the time.  It hangs the test, which is
annoying on a daily basis to all of us, but it also is pretty terrible
if you actually want to debug a node process that has gone sideways.

Credit to @bnoordhuis for most of this.  I just added the unref which
keeps it from messing up the event loop for other stuff.
2013-02-26 16:46:26 -08:00
Fedor Indutny
aa98539277 v8: fix postmortem and dtrace helper build
Regardless of previous @bnoordhuis' changes
2013-02-26 08:17:21 +00:00
Fedor Indutny
3d913fec83 Revert "sunos: unbreak build after v8 downgrade"
This reverts commit f80f3c5f62.
2013-02-26 07:57:12 +00:00
Ben Noordhuis
f80f3c5f62 sunos: unbreak build after v8 downgrade
Commit 3d67f89 ("fix generation of v8 constants on freebsd") is an
unfortunate victim of this rollback.

Revert "dtrace: fix generation of v8 constants on freebsd"
Revert "dtrace: More style"
Revert "dtrace: Make D style more D-ish"
Revert "dtrace: x64 ustack helper"
Revert "dtrace: fix style in ustack helper"
Revert "dtrace: SeqAsciiString was renamed to SeqOneByteString in v8"

This reverts commit 3d67f89552.
This reverts commit 321b8eec08.
This reverts commit 38df9d51a2.
This reverts commit f9afb3f010.
This reverts commit 13296e4b13.
This reverts commit 3b715edda9.
2013-02-26 01:30:44 +01:00
Ben Noordhuis
51f6e6a9b3 src, test: downgrade to v8 3.14 api 2013-02-25 23:45:02 +01:00
isaacs
33e8e694e8 Now working on 0.8.22 2013-02-25 13:52:13 -08:00
isaacs
530d8c05d4 2013.02.25, Version 0.8.21 (Stable)
* http: Do not free the wrong parser on socket close (isaacs)

* http: Handle hangup writes more gently (isaacs)

* zlib: fix assert on bad input (Ben Noordhuis)

* test: add TAP output to the test runner (Timothy J Fontaine)

* unix: Handle EINPROGRESS from domain sockets (Ben Noordhuis)
2013-02-25 13:07:25 -08:00
isaacs
3b2e9d2648 stream: remove lowWaterMark feature
It seems like a good idea on the face of it, but lowWaterMarks are
actually not useful, and in practice should always be set to zero.

It would be worthwhile for writers if we actually did some kind of
writev() type of thing, but actually this just delays calling write()
and the overhead of doing a bunch of Buffer copies is not worth the
slight benefit of calling write() fewer times.
2013-02-21 15:23:18 -08:00
Ben Noordhuis
ef94521909 zlib: fix assert on bad input
The following test case occasionally triggered an assert because
write_in_progress_ didn't get cleared on error:

  $ cat test.js
  require('zlib').gunzip('BAM', console.log);
  setTimeout(gc, 10);

  $ while true; do node --expose-gc test.js || break; done
  { [Error: incorrect header check] errno: -3, code: 'Z_DATA_ERROR' }
  Assertion failed: (!write_in_progress_ && "write in progress"),
  function Clear, file ../src/node_zlib.cc, line 71.
  Abort trap: 6

Steps to avoid that:

* Initialize all primitive member fields in the constructor.
* Clear the write_in_progress_ member field in ZCtx::Error().
* Ref the ZCtx object as soon as write_in_progress_ is set to true.
  Before this commit, it could get GC'ed in the time between setting
  the field and the call to ctx->Ref().

Fixes #4783.
2013-02-22 00:08:26 +01:00
Trevor Norris
7301ba3969 process: fix bug where spinner wasn't called
Apperently there is a case where calling the spinner was required after
passing a callback to nextTick(). This fixes that issue.
2013-02-21 10:31:01 -08:00
Ben Noordhuis
9d10bf58a3 stream_wrap: remove superfluous buffer len check
It's a buffer so it's never bigger than Buffer::kMaxLength bytes,
which in turn is always < INT_MAX.
2013-02-20 22:17:36 +01:00
Ben Noordhuis
57ef65916b node: code cleanup, make tick_infobox static
It's not used outside of src/node.cc so make it static.
2013-02-20 14:15:11 +01:00
isaacs
727151afd3 Now working on v0.9.11 2013-02-19 13:58:38 -08:00
isaacs
54d20ffba0 2013.02.19, Version 0.9.10 (Unstable)
* V8: Upgrade to 3.15.11.15

* npm: Upgrade to 1.2.12

* fs: Change default WriteStream config, increase perf (isaacs)

* process: streamlining tick callback logic (Trevor Norris)

* stream_wrap, udp_wrap: add read-only fd property (Ben Noordhuis)

* buffer: accept negative indices in Buffer#slice() (Ben Noordhuis)

* tls: Cycle data when underlying socket drains (isaacs)

* stream: read(0) should not always trigger _read(n,cb) (isaacs)

* stream: Empty strings/buffers do not signal EOF any longer (isaacs)

* crypto: improve cipher/decipher error messages (Ben Noordhuis)

* net: Respect the 'readable' flag on sockets (isaacs)

* net: don't suppress ECONNRESET (Ben Noordhuis)

* typed arrays: copy Buffer in typed array constructor (Ben Noordhuis)

* typed arrays: make DataView throw on non-ArrayBuffer (Ben Noordhuis)

* windows: MSI installer enhancements (Scott Blomquist, Jim Schubert)
2013-02-19 13:23:47 -08:00
Trevor Norris
ec4200068c process: allow ticker to cross communicate better
Using external memory values allows for quick communication between js
and cc land, so we can check if the js land callback needs to be run.
(this is where I meant that manually tracking nextTickQueue.length would
be helpful)

Also did some minor cleanup of removing the old Tick and
StartTickSpinner functions, and a few unneeded comments.

Conflicts:

	src/node.cc
2013-02-15 18:37:53 -08:00
Trevor Norris
86c0745a5e process: streamlining tick callback logic
* Callbacks from spinner now calls its own function, separate from the
  tickCallback logic
* MakeCallback will call a domain specific function if a domain is
  detected
* _tickCallback assumes no domains, until nextTick receives a callback
  with a domain. After that _tickCallback is overridden with the domain
  specific implementation.
* _needTickCallback runs in startup() instead of nextTick (isaacs)
* Fix bug in _fatalException where exit would be called twice (isaacs)
* Process.domain has a default value of null
* Manually track nextTickQueue.length (will be useful later)
* Update tests to reflect internal api changes
2013-02-15 18:13:01 -08:00
isaacs
95ac576bf9 Revert "Move MakeCallback to JS"
This reverts commit 0109a9f90a.

Also included:  Port all the changes to process._makeCallback into the
C++ version.  Immediate nextTick, etc.

This yields a slight boost in several benchmarks.  V8 is optimizing and
deoptimizing process._makeCallback repeatedly.
2013-02-15 18:13:01 -08:00
Shigeki Ohtsu
cd372510bb timer: move setImmediate from timer to uv_check
uv_check is the robust place to invoke setImmediate callbacks after
process.nextTick and before timers(setTimeout/setInterval)
2013-02-15 16:11:05 -08:00
isaacs
01bff7e7a7 Now working on v0.8.21 2013-02-15 11:24:08 -08:00
isaacs
e10c75579b 2013.02.15, Version 0.8.20 (Stable)
* npm: Upgrade to v1.2.11

* http: Do not let Agent hand out destroyed sockets (isaacs)

* http: Raise hangup error on destroyed socket write (isaacs)

* http: protect against response splitting attacks (Bert Belder)
2013-02-15 10:50:11 -08:00
Ben Noordhuis
7bdd05bd66 stream_wrap, udp_wrap: add read-only fd property
Expose the file descriptor as a read-only property on the internal
handle objects. Intended for debugging purposes, not part of the API
proper. The property is always null on Windows.

Fixes #4754.
2013-02-13 16:11:20 +01:00
Ben Noordhuis
2d069c5210 udp_wrap: use proper imports in source file 2013-02-13 15:54:17 +01:00
Ben Noordhuis
b1b7b4e4e8 udp_wrap: don't use namespace imports in header
It's not really harmful but it's inconsistent with the other header
files.
2013-02-13 15:44:37 +01:00
Victor Costan
e235bce2ba Fix crypto.hmac behavior with empty keys.
node 0.9.6 introduced Buffer changes that cause the key argument of
Hmac::HmacInit (used in crypto.createHmac) to be NULL when the key is
empty. This argument is passed to OpenSSL's HMAC_Init, which does not
like NULL keys.

This change works around the issue by passing an empty string to
HMAC_Init when the key is empty, and adds crypto.createHmac tests for
the edge cases of empty keys and values.
2013-02-12 14:11:22 +04:00
Ben Noordhuis
f5f9e8da71 crypto: improve cipher/decipher error messages
Throw the OpenSSL error string instead of the rather less informative
error message "fail".
2013-02-11 23:19:48 +01:00
Ben Noordhuis
ed3d553d82 typed arrays: make call-as-function work for ctors
Turn call-as-function calls into constructor calls. Makes the following
snippet work:

  var buf = ArrayBuffer(32);  // no 'new' but does the right thing
2013-02-11 17:38:32 +01:00
Ben Noordhuis
aff8d9e716 node: don't malloc in FromConstructorTemplate
* allocate space for argv on the stack
* move the declaration to node_internals.h
2013-02-11 17:30:06 +01:00
Ben Noordhuis
5a9d30bb86 typed arrays: copy Buffer in typed array constructor
Convert the Buffer to an ArrayBuffer. The typed_array.buffer property
should be an ArrayBuffer to avoid confusion: a Buffer doesn't have a
byteLength property and more importantly, its slice() method works
subtly different.

That means that before this commit:

  var buf = new Buffer(1);
  var arr = new Int8Array(buf);
  assert.equal(arr.buffer, buf);
  assert(arr.buffer instanceof Buffer);

And now:

  var buf = new Buffer(1);
  var arr = new Int8Array(buf);
  assert.notEqual(arr.buffer, buf);
  assert(arr.buffer instanceof ArrayBuffer);
2013-02-10 21:31:41 +01:00
Ben Noordhuis
fe103357ae typed arrays: make DataView throw on non-ArrayBuffer
Make the DataView constructor throw an exception when the first
argument is not an ArrayBuffer. Follows the spec and the browsers.
2013-02-10 15:22:40 +01:00
Ben Noordhuis
234551a22a buffer: fix Buffer::HasInstance() check
It was returning true for typed arrays. Check that the object was
instantiated with the Buffer constructor.
2013-02-10 15:22:40 +01:00
Ben Noordhuis
144e21ed30 Revert "typed arrays: only share ArrayBuffer backing store"
We're going to fix this differently. The real bug is that
Buffer::HasInstance() returns true for typed arrays.

This reverts commit 01ee551e70.
2013-02-10 15:22:27 +01:00
Ben Noordhuis
fd9d8b5e4a Revert "typed arrays: copy non-ArrayBuffer in DataView ctor"
We're going to follow browser behavior here.

This reverts commit 7b0770bff5.
2013-02-10 15:22:27 +01:00
isaacs
c3c8eee46d Now working on v0.9.10 2013-02-07 10:34:07 -08:00
isaacs
4b9f0d190c 2013.02.07, Version 0.9.9 (Unstable)
* tls: port CryptoStream to streams2 (Fedor Indutny)

* typed arrays: only share ArrayBuffer backing store (Ben Noordhuis)

* stream: make Writable#end() accept a callback function (Nathan Rajlich)

* buffer: optimize 'hex' handling (Ben Noordhuis)

* dns, cares: don't filter NOTIMP, REFUSED, SERVFAIL (Ben Noordhuis)

* readline: treat bare \r as a line ending (isaacs)

* readline: make \r\n emit one 'line' event (Ben Noordhuis)

* cluster: support datagram sockets (Bert Belder)

* stream: Correct Transform class backpressure (isaacs)

* addon: Pass module object to NODE_MODULE init function (isaacs, Rod Vagg)

* buffer: slow buffer copy compatibility fix (Trevor Norris)

* Add bytesWritten to tls.CryptoStream (Andy Burke)
2013-02-07 09:11:11 -08:00
isaacs
5cc3569f6d Merge remote-tracking branch 'ry/v0.8' into master
Conflicts:
	AUTHORS
	ChangeLog
	deps/npm/html/api/bin.html
	deps/npm/html/api/bugs.html
	deps/npm/html/api/commands.html
	deps/npm/html/api/config.html
	deps/npm/html/api/deprecate.html
	deps/npm/html/api/docs.html
	deps/npm/html/api/edit.html
	deps/npm/html/api/explore.html
	deps/npm/html/api/help-search.html
	deps/npm/html/api/init.html
	deps/npm/html/api/install.html
	deps/npm/html/api/link.html
	deps/npm/html/api/load.html
	deps/npm/html/api/ls.html
	deps/npm/html/api/npm.html
	deps/npm/html/api/outdated.html
	deps/npm/html/api/owner.html
	deps/npm/html/api/pack.html
	deps/npm/html/api/prefix.html
	deps/npm/html/api/prune.html
	deps/npm/html/api/publish.html
	deps/npm/html/api/rebuild.html
	deps/npm/html/api/restart.html
	deps/npm/html/api/root.html
	deps/npm/html/api/run-script.html
	deps/npm/html/api/search.html
	deps/npm/html/api/shrinkwrap.html
	deps/npm/html/api/start.html
	deps/npm/html/api/stop.html
	deps/npm/html/api/submodule.html
	deps/npm/html/api/tag.html
	deps/npm/html/api/test.html
	deps/npm/html/api/uninstall.html
	deps/npm/html/api/unpublish.html
	deps/npm/html/api/update.html
	deps/npm/html/api/version.html
	deps/npm/html/api/view.html
	deps/npm/html/api/whoami.html
	deps/npm/html/doc/README.html
	deps/npm/html/doc/adduser.html
	deps/npm/html/doc/bin.html
	deps/npm/html/doc/bugs.html
	deps/npm/html/doc/build.html
	deps/npm/html/doc/bundle.html
	deps/npm/html/doc/cache.html
	deps/npm/html/doc/changelog.html
	deps/npm/html/doc/coding-style.html
	deps/npm/html/doc/completion.html
	deps/npm/html/doc/config.html
	deps/npm/html/doc/dedupe.html
	deps/npm/html/doc/deprecate.html
	deps/npm/html/doc/developers.html
	deps/npm/html/doc/disputes.html
	deps/npm/html/doc/docs.html
	deps/npm/html/doc/edit.html
	deps/npm/html/doc/explore.html
	deps/npm/html/doc/faq.html
	deps/npm/html/doc/folders.html
	deps/npm/html/doc/global.html
	deps/npm/html/doc/help-search.html
	deps/npm/html/doc/help.html
	deps/npm/html/doc/index.html
	deps/npm/html/doc/init.html
	deps/npm/html/doc/install.html
	deps/npm/html/doc/json.html
	deps/npm/html/doc/link.html
	deps/npm/html/doc/ls.html
	deps/npm/html/doc/npm.html
	deps/npm/html/doc/outdated.html
	deps/npm/html/doc/owner.html
	deps/npm/html/doc/pack.html
	deps/npm/html/doc/prefix.html
	deps/npm/html/doc/prune.html
	deps/npm/html/doc/publish.html
	deps/npm/html/doc/rebuild.html
	deps/npm/html/doc/registry.html
	deps/npm/html/doc/removing-npm.html
	deps/npm/html/doc/restart.html
	deps/npm/html/doc/rm.html
	deps/npm/html/doc/root.html
	deps/npm/html/doc/run-script.html
	deps/npm/html/doc/scripts.html
	deps/npm/html/doc/search.html
	deps/npm/html/doc/semver.html
	deps/npm/html/doc/shrinkwrap.html
	deps/npm/html/doc/star.html
	deps/npm/html/doc/start.html
	deps/npm/html/doc/stop.html
	deps/npm/html/doc/submodule.html
	deps/npm/html/doc/tag.html
	deps/npm/html/doc/test.html
	deps/npm/html/doc/uninstall.html
	deps/npm/html/doc/unpublish.html
	deps/npm/html/doc/update.html
	deps/npm/html/doc/version.html
	deps/npm/html/doc/view.html
	deps/npm/html/doc/whoami.html
	deps/npm/man/man1/global.1
	deps/npm/man/man1/ls.1
	deps/npm/man/man1/npm.1
	deps/npm/man/man1/rm.1
	deps/npm/man/man3/npm.3
	deps/npm/node_modules/glob/glob.js
	deps/npm/node_modules/glob/package.json
	deps/npm/node_modules/node-gyp/package.json
	deps/npm/node_modules/npm-registry-client/package.json
	deps/npm/node_modules/npmconf/package.json
	deps/npm/node_modules/read-installed/package.json
	deps/npm/node_modules/rimraf/package.json
	deps/npm/node_modules/rimraf/rimraf.js
	deps/npm/package.json
	deps/uv/src/win/error.c
	doc/api/crypto.markdown
	lib/zlib.js
	src/node_version.h
	src/node_zlib.cc
	test/simple/test-buffer.js
2013-02-06 16:29:30 -08:00
Ben Noordhuis
7b0770bff5 typed arrays: copy non-ArrayBuffer in DataView ctor
This is commit 01ee551, except for the DataView type this time.

Make the behavior of DataView consistent with that of typed arrays:
make a copy of the backing store.
2013-02-06 22:26:50 +01:00
isaacs
ccf2712ee5 Now working on 0.8.20 2013-02-06 09:46:47 -08:00
isaacs
53978bdf42 2013.02.06, Version 0.8.19 (Stable)
* npm: Upgrade to v1.2.10

* zlib: pass object size hint to V8 (Ben Noordhuis)

* zlib: reduce memory consumption, release early (Ben Noordhuis)

* buffer: slow buffer copy compatibility fix (Trevor Norris)

* zlib: don't assert on malformed dictionary (Ben Noordhuis)

* zlib: don't assert on missing dictionary (Ben Noordhuis)

* windows: better ipv6 support (Bert Belder)

* windows: add error mappings related to unsupported protocols (Bert Belder)

* windows: map ERROR_DIRECTORY to UV_ENOENT (Bert Belder)
2013-02-06 08:46:14 -08:00
Ben Noordhuis
01ee551e70 typed arrays: only share ArrayBuffer backing store
Follow browser behavior, only share the backing store when it's a
ArrayBuffer. That is:

  var abuf = new ArrayBuffer(32);
  var a = new Int8Array(abuf);
  var b = new Int8Array(abuf);
  a[0] = 0;
  b[0] = 1;
  assert(a[0] === b[0]);  // a and b share memory

But:

  var a = new Int8Array(32);
  var b = new Int8Array(a);
  a[0] = 0;
  b[0] = 1;
  assert(a[0] !== b[0]);  // a and b don't share memory

The typed arrays spec allows both `a[0] === b[0]` and `a[0] !=== b[0]`
but Chrome and Firefox implement the behavior where memory is not
shared.

Copying the memory is less efficient but let's do it anyway for the
sake of the Principle of Least Surprise.

Fixes #4714.
2013-02-06 14:21:35 +01:00
Ben Noordhuis
6b99fd2323 zlib: pass object size hint to V8
Inform V8 that the zlib context object is tied to a large off-heap buffer.

This makes the GC run more often (in theory) and improves the accuracy of
--trace_external_memory.
2013-02-05 22:26:03 +01:00
Ben Noordhuis
8d14668992 zlib: reduce memory consumption, release early
In zlibBuffer(), don't wait for the garbage collector to reclaim the zlib memory
but release it manually. Reduces memory consumption by a factor of 10 or more
with some workloads.

Test case:

  function f() {
    require('zlib').deflate('xxx', g);
  }
  function g() {
    setTimeout(f, 5);
  }
  f();

Observe RSS memory usage with and without this commit. After 10,000 iterations,
RSS stabilizes at ~35 MB with this commit. Without, RSS is over 300 MB and keeps
growing.

Cause: whenever the JS object heap hits the high-water mark, the V8 GC sweeps
it clean, then tries to grow it in order to avoid more sweeps in the near
future. Rule of thumb: the bigger the JS heap, the lazier the GC can be.

A side effect of a bigger heap is that objects now live longer. This is harmless
in general but it affects zlib context objects because those are tied to large
buffers that live outside the JS heap, on the order of 16K per context object.

Ergo, don't wait for the GC to reclaim the memory - it may take a long time.

Fixes #4172.
2013-02-05 22:25:54 +01:00
Ben Noordhuis
cd42f56178 buffer: optimize Buffer.prototype.write(s, 'hex')
Move the implementation to C++ land. This is similar to commit 3f65916
but this time for the write() function and the Buffer(s, 'hex')
constructor.

Speeds up the benchmark below about 24x (2.6s vs 1:02m).

  var s = 'f';
  for (var i = 0; i < 26; ++i) s += s;  // 64 MB
  Buffer(s, 'hex');
2013-02-02 01:01:42 +01:00
isaacs
916aebabb8 debugger: Make the debugger timeout configurable
If the NODE_DEBUGGER_TIMEOUT environment variable is set, then use
that as the number of ms to wait for the debugger to start.

This is primarily to work around a race condition that almost never
happens in real usage with the debugger, but happens EVERY FRACKING
TIME when the debugger tests run as part of 'make test'.
2013-02-01 15:58:51 -08:00
Ben Noordhuis
3f65916fa9 buffer: optimize Buffer.prototype.toString('hex')
Move the implementation to C++ land. The old JS implementation used
string concatenation, was dog slow and consumed copious amounts of
memory for large buffers. Example:

  var buf = Buffer(0x1000000);  // 16 MB
  buf.toString('hex')           // Used 3+ GB of memory.

The new implementation operates in O(n) time and space.

Fixes #4700.
2013-02-01 23:07:17 +01:00
Ben Noordhuis
6aed61f1ca dns, cares: don't filter NOTIMP, REFUSED, SERVFAIL
Report the aforementioned DNS server failure codes as-is, stop c-ares
from reporting them as ARES_ECONNREFUSED.

Reported by Steve Freegard.
2013-02-01 17:58:15 +01:00
isaacs
016810913d node: Do not use fn.apply() in process._makeCallback 2013-01-30 09:04:30 -08:00
Bert Belder
5e7e51c2fe cluster: support datagram sockets 2013-01-28 22:12:21 +01:00
Ben Noordhuis
2e371b8f92 buffer: fix Buffer::Copy regression from 00b4b7b
If the end argument is omitted or not a number, make it default to
the end of the buffer, not zero.

Ideally, it should not matter what it defaults to because the JS shim
in lib/buffer.js should handle that but there are still several places
in node.js core that secrete SlowBuffers, hence Buffer::Copy() gets
called without going through Buffer.prototype.copy() first.
2013-01-27 21:50:01 +01:00
Fedor Indutny
0972acb548 stream_wrap: reference handle before uv_write2
Revert commit 7f2a78bf4d and fix using
empty symbol handle.
2013-01-27 20:11:41 +04:00
Ben Noordhuis
7f2a78bf4d Revert "stream_wrap: reference handle before uv_write2"
It's segfaulting in release mode and asserting in debug mode:

  #
  # Fatal error in ../../deps/v8/src/api.h, line 297
  # CHECK(allow_empty_handle || that != __null) failed
  #

This reverts commit 99f0b022d5.
2013-01-27 15:21:03 +01:00
Fedor Indutny
99f0b022d5 stream_wrap: reference handle before uv_write2
Before sending handle to another process using uv_write2(), it should be
referenced to prevent it from being GCed before AfterWrite() will be
called.

see #4599
2013-01-26 22:38:00 +04:00
isaacs
15508589a1 addon: Pass module object to NODE_MODULE init function
mainly to allow native addons to export single functions on
rather than being restricted to operating on an existing
object.

Init functions now receive exports as the first argument, like
before, but also the module object as the second argument, if they
support it.

Related to #4634

cc: @rvagg
2013-01-25 14:25:35 -08:00
Ben Noordhuis
00b4b7bb97 buffer: remove minor Buffer::Copy deoptimizations
* Omit ToObject() call. Buffer::Data() and Buffer::Length() know how
  to deal with Values.

* Don't check if the argument is undefined because it realistically
  never is and undefined->integer coercion achieves the same thing.
2013-01-25 22:07:04 +01:00
Trevor Norris
65249ccd9b buffer: slow buffer copy compatibility fix
Fix issue where SlowBuffers couldn't be passed as target to Buffer
copy().

Also included checks to see if Argument parameters are defined before
assigning their values. This offered ~3x's performance gain.

Backport of 16bbecc from master branch. Closes #4633.
2013-01-25 10:42:38 -08:00
Trevor Norris
cbe3941db9 buffer: error and misc cleanup
Changed types of errors thrown to be more indicative of what the error
represents. Also removed a few unnecessary uses of the v8 fully
quantified typename.
2013-01-25 11:59:26 +01:00
Trevor Norris
16bbeccd40 buffer: slow buffer copy compatibility fix
Fix issue where SlowBuffers couldn't be passed as target to Buffer
copy().

Also included checks to see if Argument parameters are defined before
assigning their values. This offered ~3x's performance gain.
2013-01-25 11:58:51 +01:00
isaacs
f64742ea07 Now working on v0.9.9 2013-01-24 10:31:40 -08:00
isaacs
5f2f8400f6 2013.01.24, Version 0.9.8 (Unstable)
* npm: Upgrade to v1.2.3

* V8: Upgrade to 3.15.11.10

* streams: Support objects other than Buffers (Jake Verbaten)

* buffer: remove float write range checks (Trevor Norris)

* http: close connection on 304/204 responses with chunked encoding (Ben Noordhuis)

* build: fix build with dtrace support on FreeBSD (Fedor Indutny)

* console: Support formatting options in trace() (isaacs)

* domain: empty stack on all exceptions (Dave Olszewski)

* unix, windows: make uv_*_bind() error codes consistent (Andrius Bentkus)

* linux: add futimes() fallback (Ben Noordhuis)
2013-01-24 09:15:25 -08:00
Trevor Norris
3d286b68be buffer: remove float write range checks
Removed range checks when writing float values, and removed a few
includes and defines. Also updated api docs to reflect that invalid 32
bit float is an unspecified behavior.
2013-01-23 13:55:04 +01:00
Ben Noordhuis
d7bf7ed993 zlib: don't assert on malformed dictionary
Handle Z_DATA_ERROR errors from inflateSetDictionary() gracefully.
Fixes the following assertion:

  node: ../src/node_zlib.cc:167: static void node::ZCtx::Process
  (uv_work_t*): Assertion `ctx->err_ == 0 && "Failed to set
  dictionary"' failed.
  Aborted (core dumped)

Fixes #4632.
2013-01-22 13:34:43 +01:00
Ben Noordhuis
1c32eb4ae2 zlib: don't assert on missing dictionary
Handle Z_NEED_DICT errors graciously. Fixes the following assertion:

  node: ../src/node_zlib.cc:161: static void node::ZCtx::Process
  (uv_work_t*): Assertion`ctx->dictionary_ != __null && "Stream
  has no dictionary"' failed.
  Aborted (core dumped)

Fixes #4632.
2013-01-22 13:34:43 +01:00
Ben Noordhuis
2dd373894f typed arrays: fix DataView endianness regression
Fix an off-by-one error introduced in 9fe3734 that caused a regression
in the default endianness used for writes in DataView::setGeneric().

Fixes #4626.
2013-01-20 00:29:01 +01:00
Dave Olszewski
14c911de77 domain: empty stack on all exceptions
Due to the nature of asyncronous programming, it's impossible to know
what will run on the next tick.  Because of this, it's not correct to
maintain domain stack state between ticks

Since the _fatalException handler is only invoked after the stack is
unwound, once it exits the tick will end.  The only reasonable thing to
do in that case is to exit *all* domains.
2013-01-18 13:26:40 -08:00
isaacs
3d7818fc42 Merge remote-tracking branch 'ry/v0.8' into master
Conflicts:
	AUTHORS
	ChangeLog
	src/node_version.h
	test/simple/test-buffer.js
2013-01-18 12:58:16 -08:00
isaacs
4598a4c6dd Now working on 0.8.19 2013-01-18 12:51:34 -08:00
isaacs
2c4eef0d97 2013.01.18, Version 0.8.18 (Stable)
* npm: Upgrade to v1.2.2

* dns: make error message match errno (Dan Milon)

* tls: follow RFC6125 more stricly (Fedor Indutny)

* buffer: reject negative SlowBuffer offsets (Ben Noordhuis)

* install: add simplejson fallback (Chris Dent)

* http: fix "Cannot call method 'emit' of null" (Ben Noordhuis)
2013-01-18 12:15:41 -08:00
isaacs
fc3547bc82 Now working on 0.9.8 2013-01-18 11:49:35 -08:00
isaacs
9e7bebeb83 2013.01.18, Version 0.9.7 (Unstable)
* V8: Upgrade to 3.15.11.7

* npm: Upgrade to 1.2.2

* punycode: Upgrade to 1.2.0 (Mathias Bynens)

* repl: make built-in modules available by default (Felix Böhm)

* windows: add support for '_Total' perf counters (Scott Blomquist)

* cluster: make --prof work for workers (Ben Noordhuis)

* child_process: do not keep list of sent sockets (Fedor Indutny)

* tls: Follow RFC6125 more strictly (Fedor Indutny)

* buffer: floating point read/write improvements (Trevor Norris)

* TypedArrays: Improve dataview perf without endian param (Dean McNamee)

* module: assert require() called with a non-empty string (Felix Böhm, James Campos)

* stdio: Set readable/writable flags properly (isaacs)

* stream: Properly handle large reads from push-streams (isaacs)
2013-01-18 11:04:11 -08:00
isaacs
01a4be4554 buffer: Define INFINITY for MSVC compiler 2013-01-18 11:04:10 -08:00
Ben Noordhuis
498200b87c buffer: reject negative SlowBuffer offsets
Reject negative offsets in SlowBuffer::MakeFastBuffer(), it allows
the creation of buffers that point to arbitrary addresses.

Reported by Trevor Norris.
2013-01-17 01:22:11 +01:00
Ben Noordhuis
952e42de72 deps: upgrade libuv to 4ba03dd 2013-01-16 23:38:02 +01:00
Dean McNamee
9fe3734f15 TypedArrays: Improve dataview perf without endian param
V8 seems to be particularly slow converting an undefined value to false
in BooleanValue.

Revert this when we upgrade to V8 3.17, or whenever the fix discussed
in http://code.google.com/p/v8/issues/detail?id=2487 lands in V8.
2013-01-16 10:54:28 -08:00
Trevor Norris
22b84e6216 buffer: floating point read/write improvements
Improvements:
* floating point operations are approx 4x's faster
* Now write quiet NaN's
* all read/write on floating point now done in C, so no more need for
  lib/buffer_ieee754.js
* float values have more accurate min/max value checks
* add additional benchmarks for buffers read/write
* created benchmark/_bench_timer.js which is a simple library that
  can be included into any benchmark and provides an intelligent tracker
  for sync and async tests
* add benchmarks for DataView set methods
* add checks and tests to make sure offset is greater than 0
2013-01-16 10:17:20 -08:00
Scott Blomquist
8e311d28b0 windows: add support for '_Total' perf counters 2013-01-11 22:24:48 +01:00
isaacs
9a4a39fc97 Now working on 0.9.7 2013-01-11 11:25:54 -08:00
isaacs
9313fdc71c 2013.01.11, Version 0.9.6 (Unstable)
* V8: update to 3.15.11.5

* node: remove ev-emul.h (Ben Noordhuis)

* path: make basename and extname ignore trailing slashes (Bert Belder)

* typed arrays: fix sunos signed/unsigned char issue (Ben Noordhuis)

* child_process: Fix {stdio:'inherit'} regression (Ben Noordhuis)

* child_process: Fix pipe() from child stdio streams  (Maciej Małecki)

* child_process: make fork() execPath configurable (Bradley Meck)

* stream: Add readable.push(chunk) method (isaacs)

* dtrace: x64 ustack helper (Fedor Indutny)

* repl: fix floating point number parsing (Nirk Niggler)

* repl: allow overriding builtins (Ben Noordhuis)

* net: add localAddress and localPort to Socket (James Hight)

* fs: make pool size coincide with ReadStream bufferSize (Shigeki Ohtsu)

* typed arrays: implement load and store swizzling (Dean McNamee)

* windows: fix perfctr crash on XP and 2003 (Scott Blomquist)

* dgram: fix double implicit bind error (Ben Noordhuis)
2013-01-11 10:49:21 -08:00
isaacs
97db62b4d9 Merge remote-tracking branch 'ry/v0.8' into master
Conflicts:
	AUTHORS
	ChangeLog
	Makefile
	src/node_version.h
2013-01-11 10:18:07 -08:00
Ben Noordhuis
b509ae67b7 typed arrays: fix sunos signed/unsigned char issue
The int8_t and uint8_t typedefs on sunos/smartos depend on a number of
compiler directives. Avoid ambiguity and specify signed and unsigned
char explicitly.

Fixes the following build error:

  ../src/stream_wrap.cc: In static member function 'static void*
  node::WriteWrap::operator new(size_t)':
  ../src/stream_wrap.cc:70:49: warning: no return statement in function
  returning non-void [-Wreturn-type]
  In file included from ../src/v8_typed_array.cc:26:0:
  ../src/v8_typed_array_bswap.h: In function 'T
  v8_typed_array::SwapBytes(T) [with T = signed char]':
  ../src/v8_typed_array_bswap.h:150:23:   instantiated from 'T
  v8_typed_array::LoadAndSwapBytes(void*) [with T = signed char]'
  ../src/v8_typed_array.cc:694:7:   instantiated from 'static
  v8::Handle<v8::Value> {anonymous}::DataView::getGeneric(const
  v8::Arguments&) [with T = signed char]'
  ../src/v8_typed_array.cc:738:40:   instantiated from here
  ../src/v8_typed_array_bswap.h:125:16: error: size of array is
  negative
2013-01-11 18:35:03 +01:00
Fedor Indutny
d93346d0fc Revert "typed arrays: fix build on sunos"
This reverts commit 35a137cf8d.
2013-01-11 21:01:14 +04:00
Fedor Indutny
35a137cf8d typed arrays: fix build on sunos 2013-01-11 19:52:49 +04:00
isaacs
daf4666963 Now working on 0.8.18 2013-01-09 17:07:33 -08:00
isaacs
c50c33e939 2012.01.09, Version 0.8.17 (Stable)
* npm: Upgrade to v1.2.0
  - peerDependencies (Domenic Denicola)
  - node-gyp v0.8.2 (Nathan Rajlich)
  - Faster installs from github user/project shorthands (Nathan Zadoks)

* typed arrays: fix 32 bit size/index overflow (Ben Noordhuis)

* http: Improve performance of single-packet responses (Ben Noordhuis)

* install: fix openbsd man page location (Ben Noordhuis)

* http: bubble up parser errors to ClientRequest (Brian White)
2013-01-09 16:55:12 -08:00
Ben Noordhuis
ed825f4888 typed arrays: fix 32 bit size/index overflow
Fix an out-of-bound read/write bug due to integer wrapping. Reported by
Dean McNamee.
2013-01-10 00:55:27 +01:00
Dean McNamee
c207d400f1 typed arrays: implement load and store swizzling
Implement load and store swizzling operations. This reduces an unneeded
back and forth between types and additionally keeps the value in the
swappable type until it is swapped. This is important for correctness
when dealing with floating point, to avoid the possibility of loading
the bits of a signaling NaN (because it isn't yet swapped) into the FPU.

This additionally produces better code (comments are mine):

gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)

setValue<double>:
  movd  %xmm0, %rax         ; fp reg -> gen reg
  bswapq  %rax              ; 64-bit byte swap
  movq  %rax, (%r15,%r12)   ; store
2013-01-09 17:44:25 +01:00
Dean McNamee
46a489be73 typed arrays: swizzle with compiler intrinsics
Implement swizzling with compiler intrinsics and be aware of the native
endianness to correctly swap on big endian machines.

This introduces a template function to swap the bytes of a value,
and macros for the low level swap (taking advantage of gcc and msvc
intrinsics). This produces code like the following (comments are mine):

gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)

setValue<double>:
  movd  %xmm0, %rax         ; fp reg -> gen reg
  bswapq  %rax              ; 64-bit byte swap
  movd  %rax, %xmm0         ; gen reg -> fp reg
  movq  %xmm0, (%r15,%r12)  ; store
2013-01-09 17:44:25 +01:00
Ben Noordhuis
7d66a9d060 typed arrays: undo local changes
Partially revert 5664dd2, 6573fc3 and 7788a6b to ease landing changes
from upstream.
2013-01-09 17:43:19 +01:00
Fedor Indutny
7a2ae4c930 object_wrap: add missing HandleScope
by Sven Panne's suggestion, see [0] for details.

[0]: https://code.google.com/p/v8/issues/detail?id=2468
2013-01-09 12:16:04 +04:00
Dean McNamee
3f75454426 typed arrays: don't declare as module
TypedArrays is not a module, it is attached to the global object.
Don't register it with Node's module system.
2013-01-08 05:08:00 +01:00
Dean McNamee
b50d51ef5b typed arrays: replace switch with templates
Convert TypedArray's TypeName implementation to template specialization
instead of a switch() statement.
2013-01-08 05:08:00 +01:00
isaacs
321b8eec08 dtrace: More style
Continuation lines should be indented with 4 spaces, not a tab.
2013-01-07 12:31:44 -08:00
isaacs
38df9d51a2 dtrace: Make D style more D-ish 2013-01-07 12:23:41 -08:00
Fedor Indutny
f9afb3f010 dtrace: x64 ustack helper 2013-01-07 23:04:11 +04:00
Fedor Indutny
13296e4b13 dtrace: fix style in ustack helper 2013-01-07 23:01:54 +04:00
isaacs
3b715edda9 dtrace: SeqAsciiString was renamed to SeqOneByteString in v8 2013-01-07 10:30:15 -08:00
Ben Noordhuis
7788a6bf85 src: pass node_isolate to Undefined() 2013-01-07 17:39:58 +01:00
Ben Noordhuis
c7d7ae1fe2 src: pass node_isolate to Null() 2013-01-07 17:39:57 +01:00
Ben Noordhuis
109f73b2c0 src: pass node_isolate to True() and False() 2013-01-07 17:39:57 +01:00
Ben Noordhuis
01c3d0aa88 src: pass node_isolate to Local<>::New 2013-01-07 17:39:57 +01:00
Ben Noordhuis
6573fc3502 src: pass node_isolate to Integer::New 2013-01-07 17:39:57 +01:00
Ben Noordhuis
412b3cee05 src: pass node_isolate to String::Empty 2013-01-07 17:39:57 +01:00
Ben Noordhuis
5d0816bf3e src: make node_isolate global
V8 3.15 has new API functions that let you specify the Isolate. V8 and
node.js generally spend 0.5-3.5% of the time in pthread_getspecific(),
looking up the current Isolate. Avoid that overhead by making "our"
isolate global so we can pass it around. The change to the new API is
introduced in follow-up commits.
2013-01-07 17:39:57 +01:00
Dean McNamee
8adebb92bc node: move symbol caching to Load() 2013-01-07 17:19:09 +01:00
Ben Noordhuis
5664dd2fc1 src: use static_cast where appropriate
Use static_cast instead of reinterpret_cast when casting from void*
to another type.

This is mostly an aesthetic change but may help catch bugs when the
affected code is modified.
2013-01-05 00:16:23 +01:00
Fedor Indutny
97056c064f object_wrap: add missing HandleScope
by Sven Panne's suggestion, see [0] for details.

[0]: https://code.google.com/p/v8/issues/detail?id=2468
2013-01-04 16:39:24 +04:00
Scott Blomquist
a616774281 windows: improve Visual Studio Express build support
* Moved generated files to a clearer directory.
* Improved detection logic for ctrpp.exe tool.

Closes #4482
2013-01-03 23:38:25 +01:00
Scott Blomquist
5a39df4959 windows: fix perfctr crash on XP and 2003
Some performance counter related functions are not available on Windows
XP and Windows Server 2003, which caused node to call a NULL pointer.

Closes #4462
Closes #4511
2013-01-03 23:31:26 +01:00
Ben Noordhuis
875c1106c6 node: remove ev-emul.h
libev has been deprecated since v0.6. Add-on authors have had two major
release cycles to upgrade. Out it goes.
2013-01-03 19:58:38 +01:00
Fedor Indutny
5e57bcc3ce bindings: update to new v8 apis
GetPointerFromInternalField() is deprecated now, we should use
GetAlignedPointerFromInternalField().
2013-01-02 12:13:46 +04:00
Tim Bradshaw
50e88d0b66 os: change CPU time from Integer to Number
CPU time values must be Numbers, not Integers, as they can be too large
for Integers on 32 bit platforms.
2012-12-31 18:09:36 +01:00
isaacs
30bd774fbd Now working on 0.9.6 2012-12-29 17:25:40 -08:00
isaacs
01994e8119 2012.12.30, Version 0.9.5 (Unstable)
* assert: improve support for new execution contexts (lukebayes)

* domain: use camelCase instead of snake_case (isaacs)

* domain: Do not use uncaughtException handler (isaacs)

* fs: make 'end' work with ReadStream without 'start' (Ben Noordhuis)

* https: optimize createConnection() (Ryunosuke SATO)

* buffer: speed up base64 encoding by 20% (Ben Noordhuis)

* doc: Colorize API stabilitity index headers in docs (Luke Arduini)

* net: socket.readyState corrections (bentaber)

* http: Performance enhancements for http under streams2 (isaacs)

* stream: fix to emit end event on http.ClientResponse (Shigeki Ohtsu)

* stream: fix event handler leak in readstream pipe and unpipe (Andreas Madsen)

* build: Support ./configure --tag switch (Maciej Małecki)

* repl: don't touch `require.cache` (Nathan Rajlich)

* node: Emit 'exit' event when exiting for an uncaught exception (isaacs)
2012-12-29 16:54:24 -08:00
isaacs
6c80ef01c1 node: emit 'exit' when exiting with error
Fix #3555
2012-12-29 16:53:23 -08:00
isaacs
ec8ebaf300 domain: use camelCase instead of snake_case
While it's true that error objects have a history of getting snake_case
properties attached by the host system, it's a point of confusion to
Node users that comes up a lot.  It's still 'experimental', so best to
change this sooner rather than later.
2012-12-29 10:37:31 -08:00
isaacs
4401bb47bf domain: Do not use uncaughtException handler
This adds a process._fatalException method which is called into from
C++ in order to either emit the 'uncaughtException' method, or emit
'error' on the active domain.

The 'uncaughtException' event is an implementation detail that it would
be nice to deprecate one day, so exposing it as part of the domain
machinery is not ideal.

Fix #4375
2012-12-29 10:37:30 -08:00
Ben Noordhuis
910e24b53d fs: remove fs.sendfile()
Said function has been broken (and useless) since v0.6.0. Remove it altogether.

Fixes #3854.
2012-12-28 18:24:35 +01:00
Ben Noordhuis
a329729537 buffer: speed up base64 encoding by 20%
Remove a lot of branches from the inner loop. Speeds up buf.toString('base64')
by about 20%.

Before:

  $ time out/Release/node benchmark/buffer-base64-encode.js
  real    0m6.607s
  user    0m5.508s
  sys     0m1.088s

After:

  $ time out/Release/node benchmark/buffer-base64-encode.js
  real    0m5.520s
  user    0m4.520s
  sys     0m0.992s
2012-12-28 13:20:07 +01:00
isaacs
4be9c695f0 build: Add hyphen to custom build tags
so that ./configure --tag=foo makes a version number like v0.9.5-foo
instead of v0.9.5foo
2012-12-26 20:35:00 -08:00
Maciej Małecki
c2e71dd51d build: allow to specify custom tags
When building custom `node` versions (e.g., floating features/fixes from
different versions) it's often useful to specify a custom tag which
easily identifies build when invoking `node -v`.

Introduce a way to specify this tag in `node_version.h` file or by
running `./configure --tag="<tag>"`. Insert it right after the patch
version (and before `-pre`, if build is not a release).
2012-12-26 20:15:17 -08:00
Maciej Małecki
f84bf5b6b1 build: allow to specify custom tags
When building custom `node` versions (e.g., floating features/fixes from
different versions) it's often useful to specify a custom tag which
easily identifies build when invoking `node -v`.

Introduce a way to specify this tag in `node_version.h` file or by
running `./configure --tag="<tag>"`. Insert it right after the patch
version (and before `-pre`, if build is not a release).

Closes #4452.
2012-12-21 12:44:33 -08:00
isaacs
70eb227e80 Now working on 0.9.5 2012-12-21 12:36:34 -08:00
isaacs
d86d83c75f 2012.12.21, Version 0.9.4 (Unstable)
* streams: Update all streaming interfaces to use new classes (isaacs)

* node: remove idle gc (Ben Noordhuis)

* http: protect against response splitting attacks (Bert Belder)

* fs: Raise error when null bytes detected in paths (isaacs)

* fs: fix 'object is not a function' callback errors (Ben Noordhuis)

* fs: add autoClose=true option to fs.createReadStream (Farid Neshat)

* process: add getgroups(), setgroups(), initgroups() (Ben Noordhuis)

* openssl: optimized asm code on x86 and x64 (Bert Belder)

* crypto: fix leak in GetPeerCertificate (Fedor Indutny)

* add systemtap support (Jan Wynholds)

* windows: add ETW and PerfCounters support (Scott Blomquist)

* windows: fix normalization of UNC paths (Bert Belder)

* crypto: fix ssl error handling (Sergey Kholodilov)

* node: remove eio-emul.h (Ben Noordhuis)

* os: add os.endianness() function (Nathan Rajlich)

* readline: don't emit "line" events with a trailing 'n' char (Nathan Rajlich)

* build: add configure option to generate xcode build files (Timothy J Fontaine)

* build: allow linking against system libuv, cares, http_parser (Stephen Gallagher)

* typed arrays: add slice() support to ArrayBuffer (Anthony Pesch)

* debugger: exit and kill child on SIGTERM or SIGHUP (Fedor Indutny)

* url: url.format escapes delimiters in path and query (J. Lee Coltrane)
2012-12-21 12:15:05 -08:00
Scott Blomquist
841b7f534b Ease building with VS Express by checking in generated files. 2012-12-21 11:05:55 -08:00
isaacs
244924823e stdio: Do not read from stdout/err
This fixes windows stdio pipes in streams2 land.
2012-12-21 11:05:46 -08:00
Ben Noordhuis
d607d856af node: remove idle gc
Remove the idle garbage collector. Its purpose was to run the garbage collector
when the application is idle but it never worked quite right. Many people have
complained over the years that with heaps > 128 MB, a node.js process never
sleeps anymore; instead, it spends nearly 100% of its CPU time trying to
collect garbage.

Back in the old days, idle GC probably was a good idea. But with V8's current
incremental collector, idle gc appears to offer no time or space benefits
whatsoever and indeed seems actively harmful. Remove it.

Fixes #3870.
2012-12-18 16:16:33 +01:00
Ben Noordhuis
8ccfed2edc node: s/-/_/ in add-on symbol name
Replace dashes with underscores. When loading foo-bar.node, look for
foo_bar_module, not foo-bar_module. The latter is not a legal symbol name.
2012-12-18 16:07:31 +01:00
isaacs
6c5356bfe2 Revert "buffer: allocate memory with mmap()"
Also Revert "buffer: use MAP_ANON, fix OS X build"

This reverts commit ddb15603e7.
This reverts commit 2433ec8276.
2012-12-17 10:47:17 -08:00
Dean McNamee
1c265c54a2 typed arrays: fix missing type in SizeOfArrayElementForType()
When Mikael Bourges-Sevenier added support for Uint8ClampedArray in 67fc1da,
the new type was not added to SizeOfArrayElementForType().
2012-12-17 17:37:51 +01:00
Dean McNamee
ba00fb0199 typed arrays: re-export SizeOfArrayElementForType()
Although it is not used externally by node, it is needed by upstream and Plask.

This effectively reverts:

    commit 1444801374
    Author: Aaron Jacobs <jacobsa@google.com>
    Date:   Thu Mar 15 13:26:35 2012 +1100

        typed arrays: unexport SizeOfArrayElementForType()

        It isn't used anywhere else, so made it an implementation detail in
        v8_typed_array.cc.
2012-12-17 17:37:51 +01:00
Ben Noordhuis
ddb15603e7 buffer: use MAP_ANON, fix OS X build 2012-12-17 11:29:03 +01:00
Ben Noordhuis
2433ec8276 buffer: allocate memory with mmap()
Work around an issue with the glibc malloc() implementation where memory blocks
are never returned to the operating system when they are allocated with brk()
and have overlapping lifecycles.

Fixes #4283.
2012-12-16 10:19:09 +01:00
isaacs
bb56dcc450 tty/stdin: Refactor for streams2 2012-12-14 10:52:30 -08:00
isaacs
0e01d6398f zlib: streams2 2012-12-14 10:52:26 -08:00
isaacs
372cb32dc4 module: Support cycles in native module requires 2012-12-13 17:00:23 -08:00
isaacs
953673424a Now working on 0.8.17 2012-12-13 11:50:35 -08:00
isaacs
1c9c6277d5 2012.12.13, Version 0.8.16 (Stable)
* npm: Upgrade to 1.1.69

* fs: fix WriteStream/ReadStream fd leaks (Ben Noordhuis)

* crypto: fix leak in GetPeerCertificate (Fedor Indutny)

* buffer: Don't double-negate numeric buffer arg (Trevor Norris)

* net: More accurate IP address validation and IPv6 dotted notation. (Joshua Erickson)
2012-12-13 11:49:39 -08:00
Ben Noordhuis
6cf68aead6 deps: upgrade libuv to e079a99 2012-12-13 20:23:01 +01:00
Ben Noordhuis
3ece130ea2 process: add getgroups(), setgroups(), initgroups()
DRY the getuid(), getgid(), etc. functions while we're at it.
2012-12-06 17:14:58 +01:00
Ben Noordhuis
c08e947fbd buffer: remove unused #includes 2012-12-06 04:45:11 +01:00
Bert Belder
03b00dcca9 os: throw when os.networkInterfaces() fails 2012-12-03 22:35:01 +01:00
Fedor Indutny
51d5655efa crypto: fix leak in GetPeerCertificate 2012-12-03 20:30:41 +04:00
Fedor Indutny
276245d26f crypto: fix leak in GetPeerCertificate 2012-12-03 20:30:16 +04:00
Joshua Erickson
c9f2531ae0 net: More accurate IP address validation and IPv6 dotted notation.
* Added isIP method to make use of inet_pton to cares_wrap.cc
* Modified net.isIP() to make use of new C++ isIP method.
* Added new tests to test-net-isip.js.

This is a back-port of commit fb6377e from the master branch.
2012-11-28 21:51:27 +01:00
isaacs
e773be6f90 Now working on 0.8.16 2012-11-26 09:18:33 -08:00
isaacs
fdf91afb49 2012.11.26, Version 0.8.15 (Stable)
* npm: Upgrade to 1.1.66 (isaacs)

* linux: use /proc/cpuinfo for CPU frequency (Ben Noordhuis)

* windows: map WSAESHUTDOWN to UV_EPIPE (Ben Noordhuis)

* windows: map ERROR_GEN_FAILURE to UV_EIO (Bert Belder)

* unix: do not set environ unless one is provided (Charlie McConnell)

* domains: don't crash if domain is set to null (Bert Belder)

* windows: fix the x64 debug build (Bert Belder)

* net, tls: fix connect() resource leak (Ben Noordhuis)
2012-11-26 08:39:49 -08:00
Ben Noordhuis
335f20896a crypto: allow negative numbers in setOptions()
OR'ing together two large values, like `SSL_OP_ALL | SSL_OP_NO_TICKET`,
produces a negative number. To wit:

  assert((0x80000000 | 0x4000) === -0x7fffc000); // true
  assert((0x80000000 | 0x4000) ===  0x80004000); // false!

It's easy to work around by doing a logical shift, like this:

  assert((0x80000000 | 0x4000) >>> 0 ===  0x80004000); // true

But that's not very intuitive. Let's be more lenient in what we accept.
2012-11-24 00:10:25 +01:00
Ben Noordhuis
8d2753c141 constants: fix wrapping of large constants
Use Number::New() instead of Integer::New(). The latter wraps large values,
e.g. 0x80000000 becomes -2147483648 instead of 2147483648.
2012-11-22 16:10:36 +01:00
Scott Blomquist
f657ce685d windows: add tracing with performance counters
Patch by Henry Rawas and Scott Blomquist.
2012-11-21 01:21:53 +01:00
Sergey Kholodilov
019ad346e0 crypto: fix ssl error handling
Make HandleSSLError() correctly process a zero status code: sometimes it
indicates an error and sometimes it doesn't.
2012-11-17 00:52:58 +01:00
Ben Noordhuis
71ba7bc2a0 node: remove eio-emul.h
The purpose of this file was to remap the old libeio API to the new one.
We dropped libeio in ee77a6a and this file has been broken ever since.

Ergo, remove it.
2012-11-16 23:44:44 +01:00
Bert Belder
b3bfb6fbb6 domains: don't crash if domain is set to null
Closes #4256
2012-11-09 00:49:24 +01:00
Nathan Rajlich
5e4e87ade5 os: add os.endianness() function 2012-11-08 12:31:45 -08:00
Joshua Erickson
fb6377ebd0 net: More accurate IP address validation and IPv6 dotted notation.
* Added isIP method to make use of inet_pton to cares_wrap.cc
* Modified net.isIP() to make use of new C++ isIP method.
* Added new tests to test-net-isip.js.
2012-11-06 16:49:21 +01:00
Anthony Pesch
fddb5dc2d3 typed arrays: add slice() support to ArrayBuffer 2012-11-06 00:13:26 +01:00
Scott Blomquist
66f64ae072 windows: generate ETW events to track v8 compiled code positions
Patch by Henry Rawas and Scott Blomquist.
2012-11-01 14:06:26 +01:00
Jan Wynholds
06810b29fa tracing: add systemtap support 2012-11-01 01:25:22 +01:00
isaacs
07d3b21f43 zlib: s/clear/close/ and match other close() semantics 2012-10-31 16:56:30 -07:00
Ben Noordhuis
a93424da4a zlib: pass object size hint to V8
Inform V8 that the zlib context object is tied to a large off-heap buffer.

This makes the GC run more often (in theory) and improves the accuracy of
--trace_external_memory.
2012-10-30 15:03:27 +01:00
Ben Noordhuis
570e4be932 zlib: reduce memory consumption, release early
In zlibBuffer(), don't wait for the garbage collector to reclaim the zlib memory
but release it manually. Reduces memory consumption by a factor of 10 or more
with some workloads.

Test case:

  function f() {
    require('zlib').deflate('xxx', g);
  }
  function g() {
    setTimeout(f, 5);
  }
  f();

Observe RSS memory usage with and without this commit. After 10,000 iterations,
RSS stabilizes at ~35 MB with this commit. Without, RSS is over 300 MB and keeps
growing.

Cause: whenever the JS object heap hits the high-water mark, the V8 GC sweeps
it clean, then tries to grow it in order to avoid more sweeps in the near
future. Rule of thumb: the bigger the JS heap, the lazier the GC can be.

A side effect of a bigger heap is that objects now live longer. This is harmless
in general but it affects zlib context objects because those are tied to large
buffers that live outside the JS heap, on the order of 16K per context object.

Ergo, don't wait for the GC to reclaim the memory - it may take a long time.

Fixes #4172.
2012-10-30 15:03:17 +01:00
isaacs
21c741f257 Print warning when maxTickDepth is reached 2012-10-29 10:53:39 -07:00
isaacs
54e88b3d61 Now working on 0.8.15 2012-10-25 14:16:53 -07:00
isaacs
b00527fcf0 2012.10.25, Version 0.8.14 (Stable)
* events: Don't clobber pre-existing _events obj in EE ctor (isaacs)
2012-10-25 13:49:32 -07:00
isaacs
648e38771e Now working on 0.8.14 2012-10-25 12:52:46 -07:00
isaacs
ff4c974873 2012.10.25, Version 0.8.13 (Stable)
* V8: Upgrade to 3.11.10.25

* npm: Upgrade to 1.1.65

* url: parse hostnames that start with - or _ (Ben Noordhuis)

* repl: Fix Windows 8 terminal issue (Bert Belder)

* typed arrays: use signed char for signed int8s (Aaron Jacobs)

* crypto: fix bugs in DiffieHellman (Ben Noordhuis)

* configure: turn on VFPv3 on ARMv7 (Ben Noordhuis)

* Re-enable OpenSSL UI for entering passphrases via tty (Ben Noordhuis)

* repl: ensure each REPL instance gets its own "context" (Nathan Rajlich)
2012-10-25 11:46:13 -07:00
isaacs
78dbb15858 Now working on v0.9.4 2012-10-24 10:10:57 -07:00
isaacs
1ed4c6776e 2012.10.24, Version 0.9.3 (Unstable)
* V8: Upgrade to 3.13.7.4

* crypto: Default to buffers instead of binary strings (isaacs, Fedor Indutny)

* crypto: add getHashes() and getCiphers() (Ben Noordhuis)

* unix: add custom thread pool, remove libeio (Ben Noordhuis)

* util: make `inspect()` accept an "options" argument (Nathan Rajlich)

* https: fix renegotation attack protection (Ben Noordhuis)

* cluster: make 'listening' handler see actual port (Aaditya Bhatia)

* windows: use USERPROFILE to get the user's home dir (Bert Belder)

* path: add platform specific path delimiter (Paul Serby)

* http: add response.headersSent property (Pavel Lang)

* child_process: make .fork()'d child auto-exit (Ben Noordhuis)

* events: add 'removeListener' event (Ben Noordhuis)

* string_decoder: Add 'end' method, do base64 properly (isaacs)

* buffer: include encoding value in exception when invalid (Ricky Ng-Adam)

* http: make http.ServerResponse no longer emit 'end' (isaacs)

* streams: fix pipe is destructed by 'end' from destination (koichik)
2012-10-24 09:21:44 -07:00
isaacs
1122e3af28 crypto: Style. Prefer 'char*' over 'char *' 2012-10-23 10:48:51 -07:00
isaacs
f2fa97f178 crypto: Remove many unnecessary toObjects 2012-10-23 10:48:51 -07:00
isaacs
c87b524c5f crypto: Clean up buffer handling and DH methods 2012-10-23 10:48:51 -07:00
isaacs
bfb9d5bbe6 crypto: Binding only accepts buffers 2012-10-23 10:48:50 -07:00
isaacs
18beea4a3f Merge remote-tracking branch 'ry/v0.8' 2012-10-23 08:22:47 -07:00
Aaron Jacobs
49f0f618a9 typed arrays: use signed char for signed int8s
The C standard allows plain `char` to be unsigned. The build environment
at Google trips this issue.
2012-10-23 16:55:59 +02:00
Ben Noordhuis
844a0058d0 crypto: fix DH use-after-free and memory leak
Fix a use-after-free bug and a memory leak in the error path of
DiffieHellman::ComputeSecret().

* the BIGNUM key was used after being freed with BN_free().
* the output buffer was not freed
2012-10-22 00:20:45 +02:00
Ben Noordhuis
de18e29784 crypto: fix DH 1 byte buffer underflow
Passing a bad key to DiffieHellman::ComputeSecret() made it zero the byte
before the heap allocated buffer due to an erroneous size calculation.
2012-10-22 00:20:32 +02:00
Ben Noordhuis
cb6d084d35 node: update description of --print 2012-10-20 15:03:48 +02:00
Nathan Rajlich
4b238b4c2a Merge remote-tracking branch 'origin/v0.8'
Conflicts:
	AUTHORS
	ChangeLog
	deps/uv/test/runner-win.c
	doc/api/process.markdown
	lib/repl.js
	src/node_crypto.cc
	src/node_version.h
2012-10-13 16:16:56 -07:00
Dean McNamee
47643d2ec5 typed arrays: remove unnecessary special-casing
Uint32Value() on undefined is equal to 0, no need to special case it.
2012-10-14 00:57:09 +02:00
Dean McNamee
93efc7f78d typed arrays: simplify typed array get() and set()
Instead of duplicating V8's logic (including clamping), just simply call into
V8's Get() and Set() methods, which handles all conversions and typing.
2012-10-14 00:54:20 +02:00
Ben Noordhuis
14a6c4efb8 crypto: add crypto.getHashes() 2012-10-13 02:55:14 +02:00
Ben Noordhuis
f53441ab1f crypto: add crypto.getCiphers()
Returns a list of, unsurprisingly, the available ciphers.
2012-10-13 01:49:57 +02:00
isaacs
58db21e6c5 Now working on 0.8.13 2012-10-12 08:57:25 -07:00
isaacs
38c72d4e29 2012.10.12, Version 0.8.12 (Stable)
* npm: Upgrade to 1.1.63

* crypto: Reduce stability index to 2-Unstable (isaacs)

* windows: fix handle leak in uv_fs_utime (Bert Belder)

* windows: fix application crashed popup in debug version (Bert Belder)

* buffer: report proper retained size in profiler (Ben Noordhuis)

* buffer: fix byteLength with UTF-16LE (koichik)

* repl: make "end of input" JSON.parse() errors throw in the REPL (Nathan Rajlich)

* repl: make invalid RegExp modifiers throw in the REPL (Nathan Rajlich)

* http: handle multiple Proxy-Authenticate values (Willi Eggeling)
2012-10-11 14:34:11 -07:00
Ben Noordhuis
6a128e037e buffer: report proper retained size in profiler
Make buffers report the proper retained size in heap snapshots.

Before this commit, Buffer objects would show up in the heap profiler as being
only a few hundred bytes large, even if the actual buffer was many megabytes.
2012-10-11 01:05:18 +02:00
Ben Noordhuis
eec8c2edaf crypto: fix -Wtautological-compare warning 2012-10-09 00:46:51 +02:00
Andrew Paprocki
8c5f269f90 Fix -Wsizeof-array-argument compiler warning. 2012-10-07 23:22:31 +02:00
koichik
fbb0ee6f24 buffer: fix byteLength with UTF-16LE
Fixes #4075.
2012-10-04 18:18:15 +09:00
Ben Noordhuis
109f8e2773 node_http_parser: fix whitespace errors 2012-10-02 14:50:25 +02:00
isaacs
ae40f1c438 Merge remote-tracking branch 'ry/v0.8' into v0.8-merge
Conflicts:
	AUTHORS
	ChangeLog
	deps/openssl/openssl.gyp
	deps/uv/src/unix/linux/linux-core.c
	deps/uv/src/unix/process.c
	deps/uv/src/unix/stream.c
	deps/v8/src/arm/builtins-arm.cc
	deps/v8/src/arm/code-stubs-arm.cc
	deps/v8/src/arm/full-codegen-arm.cc
	lib/tls.js
	src/node_version.h
	test/simple/test-http-client-timeout-agent.js
2012-09-28 09:47:48 -07:00
isaacs
9877b8f414 Now working on 0.8.12 2012-09-27 10:25:12 -07:00
isaacs
e1f39468fa 2012.09.27, Version 0.8.11 (Stable)
* fs: Fix stat() size reporting for large files (Ben Noordhuis)
2012-09-27 09:39:23 -07:00
Ben Noordhuis
ec03c47c19 fs: fix stat() reporting for large files
Use Number::New(), not Integer::New(). Large values won't fit in an Integer.

Apply to the size, ino and blocks fields.
2012-09-26 01:20:56 +02:00
isaacs
37869f1c9a Now working on 0.8.11 2012-09-25 15:36:10 -07:00
isaacs
0bc273da4f 2012.09.25, Version 0.8.10 (Stable)
* npm: Upgrade to 1.1.62

* repl: make invalid RegExps throw in the REPL (Nathan Rajlich)

* v8: loosen artificial mmap constraint (Bryan Cantrill)

* process: fix setuid() and setgid() error reporting (Ben Noordhuis)

* domain: Properly exit() on domain disposal (isaacs)

* fs: fix watchFile() missing deletion events (Ben Noordhuis)

* fs: fix assert in fs.watch() (Ben Noordhuis)

* fs: don't segfault on deeply recursive stat() (Ben Noordhuis)

* http: Remove timeout handler when data arrives (Frédéric Germain)

* http: make the client "res" object gets the same domain as "req" (Nathan Rajlich)

* windows: don't blow up when an invalid FD is used (Bert Belder)

* unix: map EDQUOT to UV_ENOSPC (Charlie McConnell)

* linux: improve /proc/cpuinfo parser (Ben Noordhuis)

* win/tty: reset background brightness when color is set to default (Bert Belder)

* unix: put child process stdio fds in blocking mode (Ben Noordhuis)

* unix: fix EMFILE busy loop (Ben Noordhuis)

* sunos: don't set TCP_KEEPALIVE (Ben Noordhuis)

* tls: Use slab allocator for memory management (Fedor Indutny)

* openssl: Use optimized assembly code for x86 and x64 (Bert Belder)
2012-09-25 13:48:15 -07:00
Ben Noordhuis
17ef062db1 handle_wrap: don't abort if wrap == NULL
After a disconnect, the internal pointer of the parent/child channel is set to
NULL. That's not an error so don't abort().
2012-09-22 03:49:17 +02:00
Fedor Indutny
63ff449d87 crypto: bring module into modern age
Introduce 'buffer' encoding, allow returning and giving buffers as
arguments of 'crypto' routines.

Fix #3278
2012-09-18 10:58:37 +04:00
isaacs
d406a8250f Now working on v0.9.3 2012-09-17 18:34:48 -07:00
isaacs
6e20558890 2012.09.17, Version 0.9.2 (Unstable)
* http_parser: upgrade to ad3b631

* openssl: upgrade 1.0.1c

* darwin: use FSEvents to watch directory changes (Fedor Indutny)

* unix: support missing API on NetBSD (Shigeki Ohtsu)

* unix: fix EMFILE busy loop (Ben Noordhuis)

* windows: un-break writable tty handles (Bert Belder)

* windows: map WSAESHUTDOWN to UV_EPIPE (Bert Belder)

* windows: make spawn with custom environment work again (Bert Belder)

* windows: map ERROR_DIRECTORY to UV_ENOENT (Bert Belder)

* tls, https: validate server certificate by default (Ben Noordhuis)

* tls, https: throw exception on missing key/cert (Ben Noordhuis)

* tls: async session storage (Fedor Indutny)

* installer: don't install header files (Ben Noordhuis)

* buffer: implement Buffer.prototype.toJSON() (Nathan Rajlich)

* buffer: added support for writing NaN and Infinity (koichik)

* http: make http.ServerResponse emit 'end' (Ben Noordhuis)

* build: ./configure --ninja (Ben Noordhuis, Timothy J Fontaine)

* installer: fix --without-npm (Ben Noordhuis)

* cli: make -p equivalent to -pe (Ben Noordhuis)

* url: Go much faster by using Url class (isaacs)
2012-09-17 17:54:59 -07:00
Ben Noordhuis
96ca59fbf3 process: fix setuid() and setgid() error reporting
Zero errno before calling getgrnam_r() or getpwnam_r(). If errno had previously
been clobbered, node would report the wrong error.
2012-09-17 07:20:47 +02:00
Ben Noordhuis
db5c26e3b5 fs: fix assert in fs.watch()
Fix the following error:

  FSEventWrap: Aborting due to unwrap failure at ../../src/fs_event_wrap.cc:169

It's possible and legal for a handle to be closed twice. HandleWrap::Close()
deals with that by ignoring the second close. Now FSEventWrap::Close() does
too.

Fixes #3997.
2012-09-14 02:37:51 +02:00
Ben Noordhuis
07804c7c9a fs: don't segfault on deeply recursive stat()
Check that the calls to Integer::New() and Date::New() succeed and bail out if
they don't.

V8 returns an empty handle on stack overflow. Trying to set the empty handle as
a property on an object results in a NULL pointer dereference in release builds
and an assert in debug builds.

Fixes #4015.
2012-09-14 02:37:51 +02:00
Pavel Lang
7ab4a77d6f buffer: update constructor prototype
Change Buffer::New(char*, size_t) to Buffer::New(const char*, size_t).
2012-09-13 16:31:04 +02:00
Ben Noordhuis
bec863b7de crypto: use uv_thread_self() 2012-09-13 16:20:36 +02:00
isaacs
362189a5d3 Now working on 0.8.10 2012-09-11 11:59:37 -07:00
isaacs
b88c3902b2 2012.09.11, Version 0.8.9 (Stable)
* v8: upgrade to 3.11.10.22

* GYP: upgrade to r1477

* npm: Upgrade to 1.1.61

* npm: Don't create world-writable files (isaacs)

* windows: fix single-accept mode for shared server sockets (Bert Belder)

* windows: fix uninitialized memory access in uv_update_time() (Bert Belder)

* windows: don't throw when a signal handler is attached (Bert Belder)

* unix: fix memory leak in udp (Ben Noordhuis)

* unix: map errno ESPIPE (Ben Noordhuis)

* unix, windows: fix memory corruption in fs-poll.c (Ben Noordhuis)

* sunos: fix os.cpus() on x86_64 (Ben Noordhuis)

* child process: fix processes with IPC channel don't emit 'close' (Bert Belder)

* build: add a "--dest-os" option to force a gyp "flavor" (Nathan Rajlich)

* build: set `process.platform` to "sunos" on SunOS (Nathan Rajlich)

* build: fix `make -j` fails after `make clean` (Bearice Ren)

* build: fix openssl configuration for "arm" builds (Nathan Rajlich)

* tls: support unix domain socket/named pipe in tls.connect (Shigeki Ohtsu)

* https: make https.get() accept a URL (koichik)

* http: respect HTTP/1.0 TE header (Ben Noordhuis)

* crypto, tls: Domainify setSNICallback, pbkdf2, randomBytes (Ben Noordhuis)

* stream.pipe: Don't call destroy() unless it's a function (isaacs)
2012-09-11 11:08:07 -07:00
Ben Noordhuis
c8c638a841 buffer: change prototype of Data() and Length()
Make Buffer:Data() and Buffer::Length() accept a Value instead of an Object.
2012-09-11 18:33:30 +02:00
Ben Noordhuis
eaf1343100 crypto: remove legacy openssl compatibility code
Remove code that works around a padding bug in older versions of openssl, the
bundled version of openssl contains the bug fix.
2012-09-11 15:42:04 +02:00
Fedor Indutny
8e0c830cd0 tls: async session storage 2012-09-05 02:01:54 +04:00
Ben Noordhuis
972cdf82f1 Merge remote-tracking branch 'origin/v0.8'
Conflicts:
	deps/uv/include/uv.h
	src/node_crypto.cc
2012-09-04 15:02:20 +02:00
Ben Noordhuis
83b1dda12f cli: make argument to -p optional 2012-09-04 14:39:31 +02:00
Ben Noordhuis
7dfa587d18 crypto, tls: make setSNICallback() compatible with domains 2012-09-03 23:33:02 +02:00
Ben Noordhuis
7d0543c128 crypto: make pbkdf2() compatible with domains 2012-09-03 23:33:02 +02:00
Ben Noordhuis
d1eff9ab68 crypto: make randomBytes() compatible with domains
Don't execute the callback in the context of the global object.

MakeCallback() tries to apply the active domain to the callback. If the user
polluted the global object with a 'domain' property, as in the code example
below, MakeCallback() will try to apply that.

Example:

    domain = {};                // missing var keyword is intentional
    crypto.randomBytes(8, cb);  // TypeError: undefined is not a function

Fixes #3956.
2012-09-03 23:33:02 +02:00
Bert Belder
ea1cba6246 windows: don't blow when a signal handler is attached
Blowing up when the user attaches a signal handler makes no sense. Also,
in Node 0.10 signals will be supported, so allow people to get used to
it.
2012-09-03 19:05:40 +02:00
Ben Noordhuis
f03c3203a1 cli: make -p equivalent to -pe
Fixes #3938.
2012-09-03 16:42:20 +02:00
Ben Noordhuis
870307de75 crypto: fix build error on OS X
pthread_t is a pointer type on OS X but an unsigned long on most other
platforms. Use a C style cast because reinterpret_cast nor static_cast
work in all cases.
2012-09-02 13:49:15 +02:00
Ben Noordhuis
298f6bff5b crypto: use CRYPTO_THREADID_set_callback()
Don't use CRYPTO_set_id_callback(), it's deprecated.
2012-08-31 00:40:18 +02:00
isaacs
459717efb6 Now working on 0.9.2 2012-08-28 15:32:01 -07:00
isaacs
e6ce259d2c 2012.08.28, Version 0.9.1 (Unstable)
* buffer: Add Buffer.isEncoding(enc) to test for valid encoding values (isaacs)

* Raise UV_ECANCELED on premature close. (Ben Noordhuis)

* Remove c-ares from libuv, move to a top-level node dependency (Bert Belder)

* ref/unref for all HandleWraps, timers, servers, and sockets (Timothy J Fontaine)

* addon: remove node-waf, superseded by node-gyp (Ben Noordhuis)

* child_process: emit error on exec failure (Ben Noordhuis)

* cluster: do not use internal server API (Andreas Madsen)

* constants: add O_DIRECT (Ian Babrou)

* crypto: add sync interface to crypto.pbkdf2() (Ben Noordhuis)

* darwin: emulate fdatasync() (Fedor Indutny)

* dgram: make .bind() always asynchronous (Ben Noordhuis)

* events: Make emitter.listeners() side-effect free (isaacs, Joe Andaverde)

* fs: Throw early on invalid encoding args (isaacs)

* fs: fix naming of truncate/ftruncate functions (isaacs)

* http: bubble up parser errors to ClientRequest (Brian White)

* linux: improve cpuinfo parser on ARM and MIPS (Ben Noordhuis)

* net: add support for IPv6 addresses ending in :: (Josh Erickson)

* net: support Server.listen(Pipe) (Andreas Madsen)

* node: don't scan add-on for "init" symbol (Ben Noordhuis)

* remove process.uvCounters() (Ben Noordhuis)

* repl: console writes to repl rather than process stdio (Nathan Rajlich)

* timers: implement setImmediate (Timothy J Fontaine)

* tls: fix segfault in pummel/test-tls-ci-reneg-attack (Ben Noordhuis)

* tools: Move gyp addon tools to node-gyp (Nathan Rajlich)

* unix: preliminary signal handler support (Ben Noordhuis)

* unix: remove dependency on ev_child (Ben Noordhuis)

* unix: work around darwin bug, don't poll() on pipe (Fedor Indutny)

* util: Formally deprecate util.pump() (Ben Noordhuis)

* windows: make active and closing handle state independent (Bert Belder)

* windows: report spawn errors to the exit callback (Bert Belder)

* windows: signal handling support with uv_signal_t (Bert Belder)
2012-08-28 15:27:49 -07:00
Ian Babrou
3b17f3b80a constants: add O_DIRECT
This will allow to speed up file i/o in some cases by usage of right offsets
and buffer sizes.
2012-08-28 15:04:55 +02:00
Bert Belder
bf16d9280e Merge branch 'v0.8'
Conflicts:
	ChangeLog
	deps/openssl/openssl.gyp
	src/node_version.h
2012-08-28 02:54:22 +02:00
isaacs
985e3a25cb lint 2012-08-27 13:03:30 -07:00
isaacs
0ccdedab79 Now working on 0.8.9 2012-08-22 12:52:05 -07:00
isaacs
a299c97bbc 2012.08.22, Version 0.8.8 (Stable)
* V8: upgrade to 3.11.10.19

* npm: upgrade to 1.1.59

* windows: fix uninitialized memory access in uv_update_time() (Bert Belder)

* unix, windows: fix memory corruption in fs-poll.c (Ben Noordhuis)

* unix: fix integer overflow in uv_hrtime (Tim Holy)

* sunos: fix uv_cpu_info() on x86_64 (Ben Noordhuis)

* tls: update default cipher list (Ben Noordhuis)

* unix: Fix llvm and older gcc duplicate symbol warnings (Bert Belder)

* fs: fix use after free in stat watcher (Ben Noordhuis)

* build: Fix using manually compiled gcc on OS X (Nathan Rajlich)

* windows: make junctions work again (Bert Belder)
2012-08-22 11:03:20 -07:00
Ben Noordhuis
63d13e86a5 child_process: emit error on exec failure
libuv calls the exit cb with exit code == -1 when it fails to spawn the new
process. Anticipate that and emit the error on the ChildProcess object.
2012-08-21 14:29:20 +02:00
Ben Noordhuis
2cdf427dce signal_wrap: fix unused variable compiler warning 2012-08-21 12:50:34 +02:00
Bert Belder
2c5828b65b Remove node_io_watcher 2012-08-21 00:37:59 +02:00
Bert Belder
34fc97880f Delete the old node_signal_watcher code 2012-08-21 00:32:45 +02:00
Bert Belder
600a6468dc process: use uv_signal instead of ev_signal 2012-08-21 00:18:10 +02:00
Bert Belder
d38d7bea6c unix: don't explicitly instantiate v8::Persistent<x> templates
These explicit instantiations were added to make MSVC happy. It turns
out that some older versions of gcc and llvm now complain about duplicate
symbols, so we instantiate these templates only when MSVC is used.
2012-08-20 18:42:05 +02:00
Bert Belder
772b3bf4c8 unix: don't explicitly instantiate v8::Persistent<x> templates
These explicit instantiations were added to make MSVC happy. It turns
out that some older versions of gcc and llvm now complain about duplicate
symbols, so we instantiate these templates only when MSVC is used.
2012-08-20 19:13:05 +03:00
Ben Noordhuis
b1ffbdc975 fs: fix use after free in stat watcher
The uv_fs_poll_t handle was stopped but not closed, leaving libuv's internal
handle queue in a corrupted state.
2012-08-20 17:29:58 +02:00
Ben Noordhuis
a177f55b0c Merge remote-tracking branch 'origin/v0.8'
Conflicts:
	ChangeLog
	src/node_version.h
	test/message/stdin_messages.out
	tools/install.py
2012-08-17 13:05:20 +02:00
Bert Belder
9263213d8e Avoid compiler warning about negating unsigned value 2012-08-17 01:08:06 +02:00
Bert Belder
e8fd808dfb windows: avoid MSVC warnings about templates not having a dll interface 2012-08-17 01:02:03 +02:00
isaacs
073c7b4d08 Now working on 0.8.8 2012-08-15 17:25:25 -07:00
isaacs
f640c5d35c 2012.08.15, Version 0.8.7 (Stable)
* npm: Upgrade to 1.1.49

* website: download page (Golo Roden)

* crypto: fix uninitialized memory access in openssl (Ben Noordhuis)

* buffer, crypto: fix buffer decoding (Ben Noordhuis)

* build: compile with -fno-tree-vrp when gcc >= 4.0 (Ben Noordhuis)

* tls: handle multiple CN fields when verifying cert (Ben Noordhuis)

* doc: remove unused util from child_process (Kyle Robinson Young)

* build: rework -fvisibility=hidden detection (Ben Noordhuis)

* windows: don't duplicate invalid stdio handles (Bert Belder)

* windows: fix typos in process-stdio.c (Bert Belder)
2012-08-15 15:52:57 -07:00
Ben Noordhuis
786e1e8712 buffer, crypto: fix buffer decoding
Before this commit, DecodeWrite() mistakenly tried to convert buffers to
UTF-8 strings which:

  a) produced invalid character sequences when the buffer contained
     octets > 127, and
  b) lead to spurious test failures because DecodeWrite() wrote less bytes
     than DecodeBytes() said it would, with the remainder either containing
     zeros or garbage

Fix that by simply copying the buffer's data to the target buffer when the
encoding is BINARY or by converting the buffer to a binary string when it's
UTF8 or ASCII.

Fixes #3651, #3866.
2012-08-14 23:00:09 +02:00
Timothy J Fontaine
382f22f229 timers: implement setImmediate 2012-08-12 00:07:22 +02:00
Ben Noordhuis
9693d3334c node: remove process.uvCounters() 2012-08-10 01:25:00 +02:00
isaacs
e8bc2edabf Now working on 0.8.7 2012-08-07 12:02:49 -07:00
isaacs
0544a586ca 2012.08.07, Version 0.8.6 (Stable)
* npm: Upgrade to v1.1.48

* Add 'make binary' to build binary tarballs for all Unixes (Nathan Rajlich)

* zlib: Emit 'close' on destroy(). (Dominic Tarr)

* child_process: Fix stdout=null when stdio=['pipe'] (Tyler Neylon)

* installer: prevent ETXTBSY errors (Ben Noordhuis)

* installer: honor --without-npm, default install path (Ben Noordhuis)

* net: make pause work with connecting sockets (Bert Belder)

* installer: fix cross-compile installs (Ben Noordhuis)

* net: fix .listen({fd:0}) (Ben Noordhuis)

* windows: map WSANO_DATA to UV_ENOENT (Bert Belder)
2012-08-07 11:56:58 -07:00
Bert Belder
acea4c4123 dns: use uv_inet_ntop/uv_inet_pton instead of c-ares equivalents 2012-08-07 01:57:58 +02:00
Bert Belder
9e55ba7d6b dns: don't rely on libuv for c-ares integration 2012-08-07 01:57:50 +02:00
Bert Belder
22d03c9108 node.cc: include ares.h 2012-08-07 01:49:13 +02:00
isaacs
168a555780 fs: fix naming of truncate/ftruncate functions
For backwards compatibility, fs.truncate(<number>) will proxy to
fs.ftruncate.

Fix #3805
2012-08-06 08:40:56 -07:00
isaacs
3bf1846bb7 Merge remote-tracking branch 'ry/v0.8'
Conflicts:
	ChangeLog
	deps/uv/src/unix/sunos.c
	deps/uv/test/test-tcp-unexpected-read.c
	src/node_version.h
2012-08-03 16:23:14 -07:00
isaacs
02dae998c3 Now working on 0.8.6 2012-08-02 14:58:15 -07:00
isaacs
9b86a4453f 2012.08.02, Version 0.8.5 (Stable)
* node: tag Encode and friends NODE_EXTERN (Ben Noordhuis)

* fs: fix ReadStream / WriteStream missing callback (Gil Pedersen)

* fs: fix readFileSync("/proc/cpuinfo") regression (Ben Noordhuis)

* installer: don't assume bash is installed (Ben Noordhuis)

* Report errors properly from --eval and stdin (isaacs)

* assert: fix throws() throws an error without message property (koichik)

* cluster: fix libuv assert in net.listen() (Ben Noordhuis)

* build: always link sunos builds with libumem (Trent Mick)

* build: improve armv7 / hard-float detection (Adam Malcontenti-Wilson)

* https: Use host header as effective servername (isaacs)

* sunos: work around OS bug to prevent fs.watch() from spinning (Bryan Cantrill)

* linux: fix 'two watchers, one path' segfault (Ben Noordhuis)

* windows: fix memory leaks in many fs functions (Bert Belder)

* windows: don't allow directories to be opened for writing/appending (Bert Belder)

* windows: make fork() work even when not all stdio handles are valid (Bert Belder)

* windows: make unlink() not remove mount points, and improve performance (Bert Belder)

* build: Sign pkg installer for OS X (isaacs)
2012-08-02 13:56:50 -07:00
Ben Noordhuis
53f3b128f5 node: tag Encode and friends NODE_EXTERN
Makes the symbols visible on Windows. They were already visible on Unices.

Fixes #3811.
2012-08-02 01:35:54 +02:00
isaacs
b3cf3f35fc Report errors properly from --eval and stdin 2012-07-30 08:21:39 -07:00
Ben Noordhuis
d559bed0d5 node: use variadic functions in ev-emul.h
Fixes #3786.
2012-07-28 14:10:13 +02:00
Ben Noordhuis
f69234703f node: don't scan add-on for "init" symbol
From this commit onwards, use of the NODE_MODULE macro is mandatory. This lets
node guard against modules that are ABI incompatible.
2012-07-27 01:19:03 +02:00
Ben Noordhuis
c3d4c3560e node: bump NODE_MODULE_VERSION
Bump NODE_MODULE_VERSION so old modules won't load without recompiling when
the next major release (v0.10) comes out.

This is necessary because the ABI changes between major releases.
2012-07-27 00:55:35 +02:00
Ben Noordhuis
2a30d328fa crypto: add sync interface to crypto.pbkdf2()
Fixes #3766.
2012-07-27 00:02:36 +02:00
Ben Noordhuis
59b584c92d node: remove PrepareTick() and CheckTick()
Superfluous after commit 430d94e. Pointed out by Shigeki Ohtsu.
2012-07-26 22:32:06 +02:00
isaacs
3d34590fba Now working on v0.8.5 2012-07-25 10:28:03 -07:00
isaacs
f98562fcd7 2012.07.25, Version 0.8.4 (Stable)
* V8: Upgrade to 3.11.10.17

* npm: Upgrade to 1.1.45

* net: fix Socket({ fd: 42 }) api (Ben Noordhuis)

* readline: Remove event listeners on close (isaacs)

* windows: correctly prep long path for fs.exists(Sync) (Bert Belder)

* debugger: wake up the event loop when a debugger command is dispatched (Peter Rybin)

* tls: verify server's identity (Fedor Indutny)

* net: ignore socket.setTimeout(Infinity or NaN) (Fedor Indutny)
2012-07-24 17:06:58 -07:00
Bert Belder
febffc107d Merge branch 'v0.8'
Conflicts:
	lib/tls.js
2012-07-23 18:34:03 +02:00
Timothy J Fontaine
19d43f852e export HandleWrap Unref Ref in tcp/udp/timer/pipe 2012-07-23 18:31:29 +02:00
Peter Rybin
688859afc0 debugger: wake up the event loop when a debugger command is dispatched
When the event loop was blocked in epoll / kqueue or similar, debugger
commands wouldn't be processed. This patch fixes that by adding an
uv_async handle which is triggered when a debugger command is
dispatched. The async handle's callback makes sure that V8 is entered.

Closes GH-3626
Closes GH-3718
2012-07-23 13:15:51 +02:00
isaacs
ec299a1329 Now working on 0.9.0 2012-07-20 11:51:08 -07:00
isaacs
f9b237f478 2012.07.20, Version 0.9.0 (Unstable)
* punycode: update to v1.1.1 (Mathias Bynens)

* c-ares: upgrade to 1.9.0 (Saúl Ibarra Corretgé)

* dns: ignore rogue DNS servers reported by windows (Saúl Ibarra Corretgé)

* unix: speed up uv_async_send() (Ben Noordhuis)

* darwin: get cpu model correctly on mac (Xidorn Quan)

* nextTick: Handle tick callbacks before any other I/O (isaacs)

* Enable color customization of `util.inspect` (Pavel Lang)

* tls: Speed and memory improvements (Fedor Indutny)

* readline: Use one history item for reentered line (Vladimir Beloborodov)

* Fix #3521 Make process.env more like a regular Object (isaacs)
2012-07-20 11:08:53 -07:00
Fedor Indutny
eb2ca10462 tls: veryify server's identity 2012-07-20 01:49:31 +04:00
Fedor Indutny
8ba189b8d3 tls: veryify server's identity 2012-07-20 00:53:36 +04:00
isaacs
3c998945aa Merge remote-tracking branch 'ry/v0.8' into master
Conflicts:
	src/node_version.h
2012-07-19 13:06:46 -07:00
isaacs
430d94ef85 nextTick: Preserve depth in error/reentry cases
When there is an error that is thrown in a nextTick function, which is
then handled by a domain or other process.on('uncaughtException')
handler, if the error handler *also* adds a nextTick and triggers
multiple MakeCallback events (ie, by doing some I/O), then it would
skip over the tickDepth check, resulting in an infinite spin.

Solution: Check the tickDepth at the start of the tick processing, and
preserve it when we are cleaning up in the error case or exiting early
in the re-entry case.

In order to make sure that tick callbacks are *eventually* handled, any
callback triggered by the underlying spinner in libuv will be processed
as if starting from a tick depth of 0.
2012-07-19 10:29:15 -07:00
isaacs
02ff9741cc Now working on 0.8.4 2012-07-19 10:19:45 -07:00
isaacs
60bf2d6cb3 2012.07.19, Version 0.8.3 (Stable)
* V8: upgrade to 3.11.10.15

* npm: Upgrade to 1.1.43

* net: fix net.Server.listen({fd:x}) error reporting (Ben Noordhuis)

* net: fix bogus errno reporting (Ben Noordhuis)

* build: Move npm shebang logic into an npm script (isaacs)

* build: fix add-on loading on freebsd (Ben Noordhuis)

* build: disable unsafe optimizations (Ben Noordhuis)

* build: fix spurious mksnapshot crashes for good (Ben Noordhuis)

* build: speed up genv8constants (Dave Pacheco)

* fs: make unwatchFile() remove a specific listener (Ben Noordhuis)

* domain: Remove first arg from intercepted fn (Toshihiro Nakamura)

* domain: Fix memory leak on error (isaacs)

* events: Fix memory leak from removeAllListeners (Nathan Rajlich)

* zlib: Fix memory leak in Unzip class. (isaacs)

* crypto: Fix memory leak in DecipherUpdate() (Ben Noordhuis)
2012-07-19 10:01:56 -07:00
Ben Noordhuis
f6f2d42ee9 node: make ev-emul.h compile with -Wextra -Werror
Explicitly cast double to int64_t, it was making add-ons that compile with
`-Wall -Wextra -Werror` fail to build.

Don't use fully variadic macros, gcc in uber-strict mode rejects them.
2012-07-18 13:56:09 +02:00
isaacs
19ecc17e6b nextTick: explicitly no-op when _exiting 2012-07-16 21:05:26 -07:00
isaacs
4e5fe2d45a nextTick: Handle tick callbacks after each tick 2012-07-16 21:05:10 -07:00
isaacs
0109a9f90a Move MakeCallback to JS 2012-07-16 18:45:14 -07:00
isaacs
db59c84ba0 Merge remote-tracking branch 'ry/v0.8'
Conflicts:
	deps/npm
2012-07-13 12:18:39 -07:00
Ben Noordhuis
3a6314dbe1 net: fix net.Server.listen({fd:x}) error reporting
* don't assert when fd isn't an open file descriptor

* don't die with a ReferenceError when fd isn't a file descriptor
  you can listen() on

Fixes #3699.
2012-07-12 18:18:38 +02:00
isaacs
424cd5a020 Merge remote-tracking branch 'ry/v0.8' into v0.8-merge
Conflicts:
	src/node_version.h
2012-07-11 17:38:11 -07:00
isaacs
71078f91ed Now working on 0.8.3 2012-07-09 10:25:17 -07:00
isaacs
9547ee90db Merge branch 'v0.8.2-release' into v0.8
Conflicts:
	AUTHORS
2012-07-09 10:23:49 -07:00
isaacs
bf539f9bfd zlib: Call inflateEnd for UNZIP. Fixes memory leak.
Fix #2595
2012-07-08 22:22:01 -07:00
Nathan Rajlich
d3d83d7b90 process: throw a TypeError when anything but an Array is passed to hrtime()
Fixes #3664.
2012-07-08 20:53:19 -07:00
Ben Noordhuis
26f1bc8e8c crypto: fix DecipherUpdate() memory leak
Fix a memory leak in the the code path that deals with partial hex strings.
2012-07-08 14:45:55 +02:00
isaacs
cc6084b9ac 2012.07.09, Version 0.8.2 (Stable)
* npm: Upgrade to 1.1.36

* readline: don't use Function#call() (Nathan Rajlich)

* Code cleanup to pass 'use strict' (Jonas Westerlund)

* module: add filename to require() json errors (TJ Holowaychuk)

* readline: fix for unicode prompts (Tim Macfarlane)

* timers: fix handling of large timeouts (Ben Noordhuis)

* repl: fix passing an empty line inserting "undefined" into the buffer (Nathan Rajlich)

* repl: fix crashes when buffering command (Maciej Małecki)

* build: rename strict_aliasing to node_no_strict_aliasing (Ben Noordhuis)

* build: disable -fstrict-aliasing for any gcc < 4.6.0 (Ben Noordhuis)

* build: detect cc version with -dumpversion (Ben Noordhuis)

* build: handle output of localized gcc or clang (Ben Noordhuis)

* unix: fix memory corruption in freebsd.c (Ben Noordhuis)

* unix: fix 'zero handles, one request' busy loop (Ben Noordhuis)

* unix: fix busy loop on unexpected tcp message (Ben Noordhuis)

* unix: fix EINPROGRESS busy loop (Ben Noordhuis)
2012-07-07 15:15:17 -07:00
isaacs
c49888bd84 Now working on 0.8.2 2012-07-07 13:42:25 -07:00
Jonas Westerlund
a9b0bcfafe Assign to property of global, instead of implicit global variable
Fixes crash in strict mode.
2012-07-06 19:28:35 -07:00
Ben Noordhuis
fee02db705 Re-apply commit e307468.
The V8 assert got triggered by a missing HandleScope::Close().
2012-06-29 17:29:32 +02:00
Bert Belder
0581afe531 Revert "Fix #3521 Use an object as the process.env proto"
The reverted commit caused a v8 assertion to trigger in debug mode.
This reverts commit e3074689f5.
2012-06-29 17:03:37 +02:00
isaacs
2134aa3d5c 2012.06.29, Version 0.8.1 (stable)
* V8: upgrade to v3.11.10.12

* npm: upgrade to v1.1.33
  - Support for parallel use of the cache folder
  - Retry on registry timeouts or network failures (Trent Mick)
  - Reduce 'engines' failures to a warning
  - Use new zsh completion if aviailable (Jeremy Cantrell)

* Fix #3577 Un-break require('sys')

* util: speed up formatting of large arrays/objects (Ben Noordhuis)

* windows: make fs.realpath(Sync) work with UNC paths (Bert Belder)

* build: fix --shared-v8 option (Ben Noordhuis)

* doc: `detached` is a boolean (Andreas Madsen)

* build: use proper python interpreter (Ben Noordhuis)

* build: expand ~ in `./configure --prefix=~/a/b/c` (Ben Noordhuis)

* build: handle CC env var with spaces (Gabriel de Perthuis)

* build: fix V8 build when compiling with gcc 4.5 (Ben Noordhuis)

* build: fix --shared-v8 option (Ben Noordhuis)

* windows msi: Fix icon issue which caused huge file size (Bert Belder)

* unix: assume that dlopen() may clobber dlerror() (Ben Noordhuis)

* sunos: fix memory corruption bugs (Ben Noordhuis)

* windows: better (f)utimes and (f)stat (Bert Belder)
2012-06-29 02:11:19 -07:00
isaacs
42ea37afb2 Now working on 0.9.0 2012-06-26 09:13:59 -07:00
isaacs
e3074689f5 Fix #3521 Use an object as the process.env proto
For some reason, though, it looks like EnvGetter is not called for the
key `__proto__`, so I can't make the info->Data() accessible.  However,
putting the Object.prototype keys there, in such a way that they are not
OwnProperties, and are supersceded by environs, makes process.env much
less weird.
2012-06-26 09:08:40 -07:00
Bert Belder
41a4b734d3 windows: remove 256x256 version of the icon
Nobody needs that anyway, it's just eating up space.
2012-06-25 18:40:48 +02:00
isaacs
b07b391304 Now working on 0.8.1 2012-06-25 07:58:03 -07:00
isaacs
8b8a7a7f9b 2012.06.25, Version 0.8.0 (stable)
* V8: upgrade to v3.11.10.10

* npm: Upgrade to 1.1.32

* Deprecate iowatcher (Ben Noordhuis)

* windows: update icon (Bert Belder)

* http: Hush 'MUST NOT have a body' warnings to debug() (isaacs)

* Move blog.nodejs.org content into repository (isaacs)

* Fix #3503: stdin: resume() on pipe(dest) (isaacs)

* crypto: fix error reporting in SetKey() (Fedor Indutny)

* Add --no-deprecation and --trace-deprecation command-line flags
* (isaacs)

* fs: fix fs.watchFile() (Ben Noordhuis)

* fs: Fix fs.readfile() on pipes (isaacs)

* Rename GYP variable node_use_system_openssl to be consistent (Ryan
* Dahl)
2012-06-25 07:37:20 -07:00
isaacs
441e792849 stdin.pipe: Replace forgotten opts member 2012-06-21 19:36:17 -07:00
isaacs
c6f7fd7e47 Merge branch 'stdin-resume-pipe' 2012-06-21 16:18:00 -07:00
isaacs
5ec056633f Fix #3503: stdin: resume() on pipe(dest) 2012-06-21 16:16:30 -07:00
Fedor Indutny
af52bc4fe6 crypto: fix error reporting in SetKey() 2012-06-21 16:06:06 -07:00
isaacs
8988af58f4 Externalize node::no_deprecation 2012-06-21 13:55:40 -07:00
isaacs
48c3d20041 Apply --no-deprecation to C++ warnings as well 2012-06-21 12:29:33 -07:00
isaacs
5b39929d47 Add --no-deprecation and --trace-deprecation flags 2012-06-21 12:05:33 -07:00
Ben Noordhuis
1bf704a571 iowatcher: add deprecation warning 2012-06-21 17:55:05 +02:00
Ben Noordhuis
ef1ffcb717 fs: make fs.watchFile() interval default to 5007 2012-06-21 15:03:21 +02:00
Ben Noordhuis
f0ce98441f fs: make fs.watchFile() work on windows 2012-06-21 03:05:18 +02:00
Ben Noordhuis
09150b0616 node: replace NODE_STAT_STRUCT with uv_statbuf_t 2012-06-21 02:42:28 +02:00
isaacs
e4017402ef Now working on 0.8.0 2012-06-19 17:03:12 -07:00
isaacs
fbc2ad5815 Merge branch 'v0.7.12-release' 2012-06-19 17:01:11 -07:00
Bert Belder
41d5fefc10 windows: update icon 2012-06-19 23:51:38 +02:00
isaacs
a72120190a 2012.06.19, Version 0.7.12 (unstable)
* npm: Upgrade to 1.1.30
  - Improved 'npm init'
  - Fix the 'cb never called' error from 'oudated' and 'update'
  - Add --save-bundle|-B config
  - Fix isaacs/npm#2465: Make npm script and windows shims cygwin-aware
  - Fix isaacs/npm#2452 Use --save(-dev|-optional) in npm rm
  - `logstream` option to replace removed `logfd` (Rod Vagg)
  - Read default descriptions from README.md files

* Shims to support deprecated ev_* and eio_* methods (Ben Noordhuis)

* #3118 net.Socket: Delay pause/resume until after connect (isaacs)

* #3465 Add ./configure --no-ifaddrs flag (isaacs)

* child_process: add .stdin stream to forks (Fedor Indutny)

* build: fix `make install DESTDIR=/path` (Ben Noordhuis)

* tls: fix off-by-one error in renegotiation check (Ben Noordhuis)

* crypto: Fix diffie-hellman key generation UTF-8 errors (Fedor Indutny)

* node: change the constructor name of process from EventEmitter to process (Andreas Madsen)

* net: Prevent property access throws during close (Reid Burke)

* querystring: improved speed and code cleanup (Felix Böhm)

* sunos: fix assertion errors breaking fs.watch() (Fedor Indutny)

* unix: stat: detect sub-second changes (Ben Noordhuis)

* add stat() based file watcher (Ben Noordhuis)
2012-06-19 14:07:49 -07:00
Ben Noordhuis
067be2b3fe node: fix namespacing issue in ev-emul.h
Always use C linkage, prevent accidental name mangling.
2012-06-19 23:04:59 +02:00
Ben Noordhuis
7de6eba061 node: preemptively unbreak windows build
No one has complained about it so far but I'm sure MSVC doesn't like things
like __attribute__((unused)). Include the libev and libeio shims only on
non-Windows platforms.
2012-06-19 13:51:00 +02:00
isaacs
5cfe0b86d5 eio-emul: Cast eio_custom method to void(*)(eio_req*) 2012-06-18 17:48:16 -07:00
Ben Noordhuis
1b22f5376b build: install eio-emul.h 2012-06-19 02:15:29 +02:00
Ben Noordhuis
f405517de1 build: install ev-emul.h 2012-06-19 02:15:29 +02:00
Trent Mick
196207c228 node: remove unused flags and files
Drop vestigial `process.installPrefix`, `node --vars`, NODE_CFLAGS and
NODE_PREFIX.

Also removed unused node_config.h.in (replaced with config.gypi a while back).
2012-06-18 23:56:42 +02:00
Fedor Indutny
ae5b0e1fc1 crypto: add padding to diffie-hellman key
DH_size returns number of bytes in a prime number, DH_compute_key returns number
of bytes in a remainder of exponent, which may have less bytes than a prime
number. Therefore add 0-padding to the allocated buffer.

Fixes #3372
2012-06-18 00:59:31 +04:00
Andreas Madsen
6d70a4ae16 node: change the constructor name of process from EventEmitter to process 2012-06-17 13:14:11 -07:00
Bert Belder
55ef9ef680 Revert "Check if a stream has a valid fd before read_start"
uv_stream_t.fd is a private field which exists only on unix.
This reverts commit 8d5c1201f2.
2012-06-16 20:14:21 +02:00
isaacs
a90bc78534 Revert "DNS: Support NAPTR queries"
This reverts commit 91bf18fcc5.
2012-06-16 11:02:49 -07:00
ssuda
91bf18fcc5 DNS: Support NAPTR queries
Adding support for NAPTR records
fixes #3170
2012-06-16 10:56:49 -07:00
Karl Skomski
8d5c1201f2 Check if a stream has a valid fd before read_start
Closes #3118
2012-06-16 09:00:20 -07:00
isaacs
2b15cf57dd Now working on 0.7.12 2012-06-15 12:47:08 -07:00
isaacs
1f93aa5d5d 2012.06.15, Version 0.7.11 (unstable)
* V8: Upgrade to v3.11.10

* npm: Upgrade to 1.1.26

* doc: Improve cross-linking in API docs markdown (Ben Kelly)

* Fix #3425: removeAllListeners should delete array (Reid Burke)

* cluster: don't silently drop messages when the write queue gets big (Bert Belder)

* Add Buffer.concat method (isaacs)

* windows: make symlinks tolerant to forward slashes (Bert Belder)

* build: Add node.d and node.1 to installer (isaacs)

* cluster: rename worker.unqiueID to worker.id (Andreas Madsen)

* Windows: Enable ETW events on Windows for existing DTrace probes. (Igor Zinkovsky)

* test: bundle node-weak in test/gc so that it doesn't need to be downloaded (Nathan Rajlich)

* Make many tests pass on Windows (Bert Belder)

* Fix #3388 Support listening on file descriptors (isaacs)

* Fix #3407 Add os.tmpDir() (isaacs)

* Unbreak the snapshotted build on Windows (Bert Belder)

* Clean up child_process.kill throws (Bert Belder)

* crypto: make cipher/decipher accept buffer args (Ben Noordhuis)
2012-06-15 12:10:43 -07:00
Igor Zinkovsky
39d2337859 Windows: don't fire GC ETW events without ETW consumers 2012-06-14 15:26:47 +02:00
Bert Belder
09be360a0f Inherited FDs should not accidentally be inherited by child processes
This makes test-child-process-detached pass on Windows.
2012-06-14 01:28:51 +02:00
Igor Zinkovsky
35a1421e96 Windows: Enable ETW events.
This commit enables ETW events to be fired on Windows for existing
DTrace probes.  ETW instrumentation is enabled by default.  It
is possible to build node.exe without ETW instrumentation by
using --without-etw option with configure script.
2012-06-13 15:36:08 -07:00
Bert Belder
0187b657ae Move resource files to src/res.
tools/msvs/res is not an appropriate place.
2012-06-13 17:40:50 +02:00
Bert Belder
10f85fadfe Fix child_process.kill oddities
* When the process is already dead, but the `exit` signal wasn't raised
  yet, the ESRCH error should be ignored.

* When an invalid signal is specified, kill() should throw.

* Like process.kill(), child_process.kill() now preserves a `0` signal
  which can be used to check the liveliness of the child process.

* process.kill() and child_process.kill() will now return true if the
  signal was actually delivered, and false otherwise.

* When an `exec`-ed process is automatically killed because a time or
  buffer limit is exceeded, and the kill() fails, this error should be
  reported through the `exec` callback.

Fixes: #3409
2012-06-12 23:30:56 +02:00
Ben Noordhuis
900196e135 crypto: make cipher/decipher accept buffer args 2012-06-12 21:50:05 +02:00
isaacs
e9aa57e8bd Now working on 0.7.11 2012-06-11 08:58:33 -07:00
isaacs
8d9766a9df 2012.06.11, Version 0.7.10 (unstable)
* Roll V8 back to 3.9.24.31

* build: x64 target should always pass -m64 (Robert Mustacchi)

* add NODE_EXTERN to node::Start (Joel Brandt)

* repl: Warn about running npm commands (isaacs)

* slab_allocator: fix crash in dtor if V8 is dead (Ben Noordhuis)

* slab_allocator: fix leak of Persistent handles (Shigeki Ohtsu)

* windows/msi: add node.js prompt to startmenu (Jeroen Janssen)

* windows/msi: fix adding node to PATH (Jeroen Janssen)

* windows/msi: add start menu links when installing (Jeroen Janssen)

* windows: don't install x64 version into the 'program files (x86)' folder (Matt Gollob)

* domain: Fix #3379 domain.intercept no longer passes error arg to cb (Marc Harter)

* fs: make callbacks run in global context (Ben Noordhuis)

* fs: enable fs.realpath on windows (isaacs)

* child_process: expose UV_PROCESS_DETACHED as options.detached (Charlie McConnell)

* child_process: new stdio API for .spawn() method (Fedor Indutny)

* child_process: spawn().ref() and spawn().unref() (Fedor Indutny)

* Upgrade npm to 1.1.25
- Enable npm link on windows
- Properly remove sh-shim on Windows
- Abstract out registry client and logger
2012-06-11 08:19:55 -07:00
Bert Belder
5432a1d985 process_wrap: set duplex flags when creating a pipe 2012-06-11 08:13:36 -07:00
Charlie McConnell
4b021a3541 child_process: expose UV_PROCESS_DETACHED as options.detached 2012-06-08 22:57:22 -07:00
Fedor Indutny
3116522e7c child_process: spawn().ref() and spawn().unref() 2012-06-07 23:20:56 +04:00
Joel Brandt
b9c5eee7d9 add NODE_EXTERN to node::Start 2012-06-06 05:31:09 +02:00
Ben Noordhuis
27061cc9f4 udp_wrap, stream_wrap: lazy init slab allocator
Create slab allocator when binding is initialized.

Add an AtExit handler to destroy the slab before the VM shuts down, it can't be
disposed when V8 is dead and Valgrind will complain about memory leaks.
2012-06-05 16:48:17 +02:00
Ben Noordhuis
cc0e7efb37 slab_allocator: fix crash in dtor if V8 is dead
Don't try to dispose the persistent handles if the VM is already dead, it
triggers an assertion inside V8.
2012-06-05 16:27:57 +02:00
Shigeki Ohtsu
208d1715a7 slab_allocator: fix leak of Persistent handles 2012-06-05 15:45:08 +02:00
Fedor Indutny
af98fc9d5f child_process: new stdio API for .spawn() method 2012-06-01 20:52:13 +04:00
isaacs
dc8b488bbe Now working on 0.7.10 2012-05-29 10:08:24 -07:00
isaacs
a9e40281e7 Merge branch 'v0.7.9-release' 2012-05-29 10:07:44 -07:00
Fedor Indutny
761e0c460a deps: upgrade libuv to 7556590 2012-05-29 18:26:40 +04:00
isaacs
782277f11a 2012.05.28, Version 0.7.9 (unstable)
* Upgrade V8 to 3.11.1

* Upgrade npm to 1.1.23

* uv: rework reference counting scheme (Ben Noordhuis)

* uv: add interface for joining external event loops (Bert Belder)

* repl, readline: Handle Ctrl+Z and SIGCONT better (Nathan Rajlich)

* fs: 64bit offsets for fs calls (Igor Zinkovsky)

* fs: add sync open flags 'rs' and 'rs+' (Kevin Bowman)

* windows: enable creating directory junctions with fs.symlink (Igor Zinkovsky, Bert Belder)

* windows: fix fs.lstat to properly detect symlinks. (Igor Zinkovsky)

* Fix #3270 Escape url.parse delims (isaacs)

* http: make http.get() accept a URL (Adam Malcontenti-Wilson)

* Cleanup vm module memory leakage (Marcel Laverdet)

* Optimize writing strings with Socket.write (Bert Belder)

* add support for CESU-8 and UTF-16LE encodings (koichik)

* path: add path.sep to get the path separator. (Yi, EungJun)

* net, http: add backlog parameter to .listen() (Erik Dubbelboer)

* debugger: support mirroring Date objects (Fedor Indutny)

* addon: add AtExit() function (Ben Noordhuis)

* net: signal localAddress bind failure in connect (Brian Schroeder)

* util: handle non-string return value in .inspect() (Alex Kocharin)
2012-05-28 20:03:03 -07:00
Igor Zinkovsky
b4ed3c1969 remove NODE_USE_64BIT_UV_FS_API 2012-05-24 11:49:51 -07:00
Igor Zinkovsky
39e25528eb windows: enable creating directory junctions with fs.symlink 2012-05-24 01:15:15 -07:00
Ben Noordhuis
039fac633e deps: upgrade libuv to a478847
The event loop's reference counting scheme in this version of libuv has changed.
Update the libuv bindings to reflect that fact.
2012-05-22 16:14:24 +02:00
Oleg Efimov
45de259b43 Make UNWRAP macro generic. 2012-05-21 23:29:06 +02:00
Andreas Madsen
81a4edcf6a cluster: remove NODE_UNIQUE_ID from env on startup
In case a worker would spawn a new subprocess with process.env, NODE_UNIQUE_ID
would have been a part of the env. Making the new subprocess believe it is a
worker, this would result in some confusion if the subprocess where to listen to
a port, since the server handle request would then be relayed to the worker.

This patch removes the NODE_UNIQUE_ID flag from process.env on startup so any
subprocess spawned by a worker is a normal process with no cluster stuff.
2012-05-21 23:27:44 +02:00
Oleg Efimov
968b49ba0a Check for tabs in source line in DisplayExceptionLine
Fix for joyent/node#3280
2012-05-21 18:30:16 +02:00
isaacs
a3753b496e Revert "Fix #3242 Actually deprecate 'binary' buffer encoding"
This reverts commit 5979f096d1.

Related:
- #3279
- #3278
2012-05-16 16:32:37 -07:00
isaacs
643f00d3f9 Merge branch 'master' into v0.6-merge
Conflicts:
	src/node.cc
2012-05-15 14:21:22 -07:00
Ben Noordhuis
e813e3491e node: make _getActiveHandles() return user objects
Before this commit, process._getActiveHandles() returned a list of internal
handles. Now, it returns the user objects that handles are attached to.

For example, a tcp_wrap handle will now return its parent net.Socket object.

It works for all handle types except timers because timer handles are shared
across multiple user objects.
2012-05-15 21:01:36 +02:00
Ben Noordhuis
5f0406534c process: add _getActiveHandles(), _getActiveRequests()
* process._getActiveHandles() returns a list containing all active handles
  (timers, sockets, etc.) that have not been unref'd.

* process._getActiveRequests() returns a list of active requests (in-flight
  actions like connecting to a remote host, writing data to a socket, etc.).
2012-05-15 21:00:27 +02:00
Ben Noordhuis
636add246c req_wrap: share process_symbol, domain_symbol
Share persistent strings process_symbol and domain_symbol across compilation
units. Avoids redefinition errors when src/node.cc includes src/req_wrap.h.
2012-05-15 20:59:43 +02:00
isaacs
5164ae3838 Merge remote-tracking branch 'ry/v0.6' into v0.6-merge
Conflicts:
	ChangeLog
	deps/uv/include/uv-private/uv-unix.h
	deps/uv/src/unix/core.c
	deps/uv/src/unix/sunos.c
	deps/v8/src/runtime.cc
	doc/api/crypto.markdown
	lib/http.js
	src/node_version.h
	test/gc/test-http-client-timeout.js
	wscript
2012-05-15 11:37:34 -07:00
isaacs
f19f980724 Now working on 0.6.19 2012-05-15 10:21:57 -07:00
isaacs
4bc1d395de 2012.05.15 Version 0.6.18 (stable)
* windows: skip GetFileAttributes call when opening a file (Bert Belder)

* crypto: add PKCS12/PFX support (Sambasiva Suda)

* #3240: child_process: delete NODE_CHANNEL_FD from env in spawn (Ben Noordhuis)

* windows: add test for path.normalize with UNC paths (Bert Belder)

* windows: make path.normalize convert all slashes to backslashes (Bert Belder)

* fs: Automatically close FSWatcher on error (Bert Belder)

* #3258: fs.ReadStream.pause() emits duplicate data event (koichik)

* pipe_wrap: don't assert() on pipe accept errors (Ben Noordhuis)

* Better exception output for module load and process.nextTick (Felix Geisendörfer)

* zlib: fix error reporting (Ben Noordhuis)

* http: Don't destroy on timeout (isaacs)

* #3231: http: Don't try to emit error on a null'ed req object (isaacs)

* #3236: http: Refactor ClientRequest.onSocket (isaacs)
2012-05-14 17:30:00 -07:00
ssuda
fb7348ae06 crypto: add PKCS12/PFX support
Fixes #2845.
2012-05-14 17:12:59 +02:00
Ben Noordhuis
bd907174e8 node: delete NODE_CHANNEL_FD from env
Prevents accidental inheritance by child processes. If the child process is a
node process, it would try to set up a channel with the parent and consequently
never quit because the channel kept the event loop alive.

Fixes #3240.
2012-05-14 07:19:11 +02:00
isaacs
07be9fc3a6 Merge remote-tracking branch 'ry/v0.6' into v0.6-merge
Conflicts:
	Makefile
	lib/zlib.js
	src/node.cc
	src/node.js
2012-05-09 15:12:13 -07:00
Ben Noordhuis
3883f22ad1 pipe_wrap: don't assert() on pipe accept errors
Pass errors to the onconnection callback.
2012-05-09 23:30:48 +02:00
Felix Geisendörfer
814033365b Fix process.nextTick throw call sites
This patch now reports the proper throw call site for exceptions
triggered within process.nextTick. So instead of this:

node.js:201
        throw e; // process.nextTick error, or 'error' event on first tick
              ^

You will now see:

mydir/myscript.js:15
  throw new Error('My Error');
          ^

From my testing this patch causes no performance regressions, but does
greatly simplify processing the nextTickQueue.
2012-05-09 11:54:43 -07:00
isaacs
5979f096d1 Fix #3242 Actually deprecate 'binary' buffer encoding 2012-05-09 10:08:54 -07:00
Ben Noordhuis
7d2e68fdbd stream_wrap: fix compilation errors 2012-05-09 06:06:42 +02:00
Bert Belder
b673d0670f Net.js: fix UCS2 write crash due to inconsistent naming 2012-05-09 04:58:26 +02:00
Ben Noordhuis
ee437c0557 zlib: fix error reporting
This commit is a back-port of the changes on the master branch.

Fixes #3230.
2012-05-09 04:44:04 +02:00
Bert Belder
4624cf1214 stream_wrap.cc: fix typo 2012-05-09 04:34:41 +02:00
Bert Belder
726ebad9bc StreamWrap::WriteBuffer: remove superfluous arguments 2012-05-09 04:00:02 +02:00
Bert Belder
0e57aafbb1 Optimize writing strings with Socket.write 2012-05-09 03:56:19 +02:00
Ben Noordhuis
78e831a31c Don't use _snprintf() on Windows, it's not safe.
_snprintf() doesn't zero-terminate the buffer on overflow. Use the hand-rolled
version that lives in src/node_internals.h.
2012-05-08 16:02:14 +02:00
Marcel Laverdet
c33d3174b8 node: un-revert 9a6012e
The crashes in debug mode after adding Locker are *not* caused by
Locker. Locker is merely exposing issues that already existed. Some of
these issues have since been fixed in 70635753.

This reverts commit 407181538b.
This reapplies commit 9a6012edd9.

Conflicts:
	src/node.cc
2012-05-05 00:56:17 +02:00
isaacs
992e3464b8 Now working on 0.6.18 2012-05-04 13:34:33 -07:00
isaacs
4ced23deaf 2012.05.04 Version 0.6.17 (stable)
* Upgrade npm to 1.1.21

* uv: Add support for EROFS errors (Ben Noordhuis, Maciej Małecki)

* uv: Add support for EIO and ENOSPC errors (Fedor Indutny)

* windows: Add support for EXDEV errors (Bert Belder)

* http: Fix client memory leaks (isaacs, Vincent Voyer)

* fs: fix file descriptor leak in sync functions (Ben Noordhuis)

* fs: fix ReadStream / WriteStream double close bug (Ben Noordhuis)
2012-05-04 13:12:52 -07:00
Ben Noordhuis
e4a8d2617b addon: add AtExit() function
Lets native addons register exit hooks that run after the event loop has quit
but before the VM is killed.

Fixes #3147.
2012-05-03 16:11:42 +02:00
Igor Zinkovsky
6f82b9f482 64bit offsets for fs calls 2012-05-02 22:39:23 -07:00
Ben Noordhuis
880219645e tcp, udp: share sockaddr-to-object function
Share AddressToJS() function between tcp_wrap.cc and udp_wrap.cc.
2012-05-02 18:03:25 +02:00
Nathan Rajlich
b894521bd2 process: ensure that "exit" doesn't get emitted twice on a natural exit
Fixes "test/simple/test-process-exit.js".
2012-05-01 14:09:31 -07:00
isaacs
acf19500ee Now working on 0.6.17 2012-05-01 13:31:26 -07:00
Fedor Indutny
9f9c333cbc vm: accept only object as arg of .createContext()
Converting strings and others to objects is very slow and essentially
wrong.
2012-05-02 01:59:59 +07:00
Ben Noordhuis
b45a10818e udp: slightly optimize address family property 2012-05-01 15:19:30 +02:00
Ben Noordhuis
e747daf604 udp: make variable names consistent 2012-05-01 14:52:00 +02:00
Shigeki Ohtsu
94f1feeb59 udp: make getsockname() return address family name 2012-05-01 14:50:17 +02:00
isaacs
a1d193963d 2012.04.30 Version 0.6.16 (stable)
* Upgrade V8 to 3.6.6.25

* Upgrade npm to 1.1.19

* Windows: add mappings for UV_ENOENT (Bert Belder)

* linux: add IN_MOVE_SELF to inotify event mask (Ben Noordhuis)

* unix: call pipe handle connection cb on accept() error (Ben Noordhuis)

* unix: handle EWOULDBLOCK (Ben Noordhuis)

* map EWOULDBLOCK to UV_EAGAIN (Ben Noordhuis)

* Map ENOMEM to UV_ENOMEM (isaacs)

* Child process: support the `gid` and `uid` options (Bert Belder)

* test: cluster: add worker death event test (Ben Noordhuis)

* typo in node_http_parser (isaacs)

* http_parser: Eat CRLF between requests, even on connection:close. (Ben Noordhuis)

* don't check return value of unsetenv (Ben Noordhuis)
2012-04-30 13:09:50 -07:00
isaacs
35bcb1d6a9 Indentation fix 2012-04-30 13:09:31 -07:00
Nathan Rajlich
248f552ab4 process: ensure that the "exit" event always has "code" given
Upon "normal" exiting of Node (i.e. the event loop completes naturally),
the "code" parameter was not being passed to the "exit" event listeners.

Be consistent. Tests included.
2012-04-30 10:42:13 -07:00
Bert Belder
3bcbd14bb1 process_wrap: don't use uv_spawn2
It was a temporary thing for the 0.6 branch only.
2012-04-29 00:24:51 +02:00
Bert Belder
c8a10e97c8 Merge branch 'v0.6'
Conflicts:
	deps/uv/include/uv-private/uv-unix.h
	deps/uv/include/uv-private/uv-win.h
	deps/uv/src/uv-common.c
	deps/uv/src/win/fs.c
	src/process_wrap.cc
2012-04-29 00:17:23 +02:00
ssuda
db844b152a process: don't use strdup()
file and cwd can be directly used from Utf8Value.

Conflicts:

	src/process_wrap.cc
2012-04-28 23:51:41 +02:00
Bert Belder
3546383cf0 process_wrap: avoid leaking memory when throwing due to invalid arguments 2012-04-28 23:36:47 +02:00
Bert Belder
55e4d54927 Child process: support the gid and uid options 2012-04-27 22:13:00 +02:00
Marcel Laverdet
70635753a3 Cleanup vm module memory leakage
There are some paths here that led to dangling contexts. By being
smarter with handle management we can get rid of all the cleanup code
and fix those issues.
2012-04-27 10:32:40 -07:00
Nathan Rajlich
98b4596a46 process: lint 2012-04-25 20:10:50 -07:00
Ben Noordhuis
5648d95c4a Remove unused local variable. 2012-04-25 04:10:31 -07:00
Nathan Rajlich
6292df659f process: comment for consistency 2012-04-24 11:31:26 -07:00
Nathan Rajlich
ef3a874f41 process: set _print_eval even when --eval is not passed
This is for scripts being fed from stdin:

  $ echo "{ foo: 'bar' }" | node -p
2012-04-24 11:31:02 -07:00
Nathan Rajlich
0b5235e68c process: make --eval and reading scripts from stdin act the same
Reusing the same logic for both places for the behavior is consistent.

For example:

  $ ./node -p -e "'Hello World'"
  Hello World

  $ echo "'Hello World'" | ./node -p
  Hello World
2012-04-24 11:30:14 -07:00
isaacs
c9a231db0e typo in node_http_parser 2012-04-18 13:01:33 -07:00
isaacs
ecca7525cc Merge remote-tracking branch 'ry/v0.6' into master
Conflicts:
	AUTHORS
	ChangeLog
	LICENSE
	Makefile
	deps/http_parser/test.c
	deps/npm/AUTHORS
	deps/npm/html/api/bin.html
	deps/npm/html/api/bugs.html
	deps/npm/html/api/commands.html
	deps/npm/html/api/config.html
	deps/npm/html/api/deprecate.html
	deps/npm/html/api/docs.html
	deps/npm/html/api/edit.html
	deps/npm/html/api/explore.html
	deps/npm/html/api/help-search.html
	deps/npm/html/api/init.html
	deps/npm/html/api/install.html
	deps/npm/html/api/link.html
	deps/npm/html/api/load.html
	deps/npm/html/api/ls.html
	deps/npm/html/api/npm.html
	deps/npm/html/api/outdated.html
	deps/npm/html/api/owner.html
	deps/npm/html/api/pack.html
	deps/npm/html/api/prefix.html
	deps/npm/html/api/prune.html
	deps/npm/html/api/publish.html
	deps/npm/html/api/rebuild.html
	deps/npm/html/api/restart.html
	deps/npm/html/api/root.html
	deps/npm/html/api/run-script.html
	deps/npm/html/api/search.html
	deps/npm/html/api/shrinkwrap.html
	deps/npm/html/api/start.html
	deps/npm/html/api/stop.html
	deps/npm/html/api/submodule.html
	deps/npm/html/api/tag.html
	deps/npm/html/api/test.html
	deps/npm/html/api/uninstall.html
	deps/npm/html/api/unpublish.html
	deps/npm/html/api/update.html
	deps/npm/html/api/version.html
	deps/npm/html/api/view.html
	deps/npm/html/api/whoami.html
	deps/npm/html/doc/README.html
	deps/npm/html/doc/adduser.html
	deps/npm/html/doc/bin.html
	deps/npm/html/doc/bugs.html
	deps/npm/html/doc/build.html
	deps/npm/html/doc/bundle.html
	deps/npm/html/doc/cache.html
	deps/npm/html/doc/changelog.html
	deps/npm/html/doc/coding-style.html
	deps/npm/html/doc/completion.html
	deps/npm/html/doc/config.html
	deps/npm/html/doc/deprecate.html
	deps/npm/html/doc/developers.html
	deps/npm/html/doc/disputes.html
	deps/npm/html/doc/docs.html
	deps/npm/html/doc/edit.html
	deps/npm/html/doc/explore.html
	deps/npm/html/doc/faq.html
	deps/npm/html/doc/folders.html
	deps/npm/html/doc/help-search.html
	deps/npm/html/doc/help.html
	deps/npm/html/doc/index.html
	deps/npm/html/doc/init.html
	deps/npm/html/doc/install.html
	deps/npm/html/doc/json.html
	deps/npm/html/doc/link.html
	deps/npm/html/doc/list.html
	deps/npm/html/doc/npm.html
	deps/npm/html/doc/outdated.html
	deps/npm/html/doc/owner.html
	deps/npm/html/doc/pack.html
	deps/npm/html/doc/prefix.html
	deps/npm/html/doc/prune.html
	deps/npm/html/doc/publish.html
	deps/npm/html/doc/rebuild.html
	deps/npm/html/doc/registry.html
	deps/npm/html/doc/removing-npm.html
	deps/npm/html/doc/restart.html
	deps/npm/html/doc/root.html
	deps/npm/html/doc/run-script.html
	deps/npm/html/doc/scripts.html
	deps/npm/html/doc/search.html
	deps/npm/html/doc/semver.html
	deps/npm/html/doc/shrinkwrap.html
	deps/npm/html/doc/star.html
	deps/npm/html/doc/start.html
	deps/npm/html/doc/stop.html
	deps/npm/html/doc/submodule.html
	deps/npm/html/doc/tag.html
	deps/npm/html/doc/test.html
	deps/npm/html/doc/uninstall.html
	deps/npm/html/doc/unpublish.html
	deps/npm/html/doc/update.html
	deps/npm/html/doc/version.html
	deps/npm/html/doc/view.html
	deps/npm/html/doc/whoami.html
	deps/npm/lib/npm.js
	deps/npm/man/man1/npm.1
	deps/npm/man/man3/npm.3
	deps/npm/node_modules/fstream-npm/fstream-npm.js
	deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/package.json
	deps/npm/node_modules/fstream-npm/package.json
	deps/npm/node_modules/node-gyp/LICENSE
	deps/npm/node_modules/node-gyp/lib/build.js
	deps/npm/node_modules/node-gyp/lib/install.js
	deps/npm/node_modules/node-gyp/node_modules/ansi/package.json
	deps/npm/node_modules/node-gyp/node_modules/glob/package.json
	deps/npm/node_modules/node-gyp/package.json
	deps/npm/package.json
	deps/uv/test/test-fs.c
	deps/v8/src/regexp-macro-assembler-tracer.cc
	deps/v8/src/version.cc
	src/node_version.h
	src/platform_sunos.cc
	test/simple/test-net-write-after-close.js
	wscript
2012-04-18 11:57:54 -07:00
isaacs
0fcb124602 Now working on 0.7.9 2012-04-18 11:17:29 -07:00
isaacs
c2b47097c0 2012.04.18, Version 0.7.8, (unstable)
* Upgrade V8 to 3.9.24.9

* Upgrade OpenSSL to 1.0.0f

* Upgrade npm to 1.1.18

* Show licenses in Binary installers

* Domains (isaacs)

* readline: rename "end" to "close" (Nathan Rajlich)

* tcp: make getsockname() return address family as string (Shigeki Ohtsu)

* http, https: fix .setTimeout() (ssuda)

* os: add cross platform EOL character (Mustansir Golawala)

* typed arrays: unexport SizeOfArrayElementForType() (Aaron Jacobs)

* net: honor 'enable' flag in .setNoDelay() (Ben Noordhuis)

* child_process: emit error when .kill fails (Andreas Madsen)

* gyp: fix 'argument list too long' build error (Ben Noordhuis)

* fs.WriteStream: Handle modifications to fs.open (isaacs)

* repl, readline: Handle newlines better (Nathan Rajlich, Nathan Friedly)

* build: target OSX 10.5 when building on darwin (Nathan Rajlich)

* Fix #3052 Handle errors properly in zlib (isaacs)

* build: add support for DTrace and postmortem (Dave Pacheco)

* core: add reusable Slab allocator (Ben Noordhuis)
2012-04-18 09:37:18 -07:00
isaacs
7b3fb22290 typo in node_http_parser 2012-04-18 09:36:45 -07:00
isaacs
d4ed2e61f7 Add Todo comments about domain-ifying crypto 2012-04-17 13:14:55 -07:00
isaacs
10ce3d129d Domain hooks in ReqWrap<T> and MakeCallback 2012-04-17 13:14:55 -07:00
isaacs
963459d736 Domain feature
This is a squashed commit of the main work done on the domains-wip branch.

The original commit messages are preserved for posterity:

* Implicitly add EventEmitters to active domain
* Implicitly add timers to active domain
* domain: add members, remove ctor cb
* Don't hijack bound callbacks for Domain error events
* Add dispose method
* Add domain.remove(ee) method
* A test of multiple domains in process at once
* Put the active domain on the process object
* Only intercept error arg if explicitly requested
* Typo
* Don't auto-add new domains to the current domain

    While an automatic parent/child relationship is sort of neat,
    and leads to some nice error-bubbling characteristics, it also
    results in keeping a reference to every EE and timer created,
    unless domains are explicitly disposed of.

* Explicitly adding one domain to another is still fine, of course.
* Don't allow circular domain->domain memberships
* Disposing of a domain removes it from its parent
* Domain disposal turns functions into no-ops
* More documentation of domains
* More thorough dispose() semantics
* An example using domains in an HTTP server
* Don't handle errors on a disposed domain
* Need to push, even if the same domain is entered multiple times
* Array.push is too slow for the EE Ctor
* lint domain
* domain: docs
* Also call abort and destroySoon to clean up event emitters
* domain: Wrap destroy methods in a try/catch
* Attach tick callbacks to active domain
* domain: Only implicitly bind timers, not explicitly
* domain: Don't fire timers when disposed.
* domain: Simplify naming so that MakeCallback works on Timers
* Add setInterval and nextTick to domain test
* domain: Make stack private
2012-04-17 13:14:55 -07:00
isaacs
a26bee8fa1 MakeCallback: Consistent symbol usage 2012-04-17 13:14:54 -07:00
isaacs
db45b2ca02 MakeCallback: Use in node_signal_watcher 2012-04-17 12:00:58 -07:00
isaacs
e1dd570585 MakeCallback: Use in node_io_watcher 2012-04-17 12:00:58 -07:00
isaacs
35c0cd219d MakeCallback: Use in node_crypto 2012-04-17 12:00:58 -07:00
isaacs
91701c2db1 MakeCallback: Use in node_file.cc 2012-04-17 12:00:58 -07:00
isaacs
88f94fa28c MakeCallback: abort() if not a function 2012-04-17 12:00:58 -07:00
isaacs
ac1aaddc00 MakeCallback: Return the callback return value 2012-04-17 11:56:33 -07:00
isaacs
7407be896e MakeCallback: Accept Function or Symbol argument 2012-04-17 11:56:32 -07:00
isaacs
80a55e9c83 Report errors thrown from uncaughtException handers 2012-04-17 11:56:32 -07:00
Shigeki Ohtsu
0d13142332 tcp: make getsockname() return address family as string 2012-04-16 18:00:47 +02:00
Ben Noordhuis
3f4261276e node: don't check return value of unsetenv()
It returns void on some platforms, notably FreeBSD.
2012-04-16 14:16:48 +02:00
Aaron Jacobs
1444801374 typed arrays: unexport SizeOfArrayElementForType()
It isn't used anywhere else, so made it an implementation detail in
v8_typed_array.cc.
2012-04-12 23:48:49 +02:00
Ben Noordhuis
16fca262be net: honor 'enable' flag in .setNoDelay()
Fixes #3096.
2012-04-12 19:15:32 +02:00
Bert Belder
3ec84a11f8 Slab allocator: don't attempt to shrink a non-buffer 2012-04-11 22:02:12 +02:00
isaacs
e8067cb685 Now working on v0.6.16 2012-04-09 10:34:54 -07:00
isaacs
f160a45b25 2012.04.09 Version 0.6.15 (stable)
* Update npm to 1.1.16

* Show licenses in binary installers.

* unix: add uv_fs_read64, uv_fs_write64 and uv_fs_ftruncate64 (Ben Noordhuis)

* add 64bit offset fs functions (Igor Zinkovsky)

* windows: don't report ENOTSOCK when attempting to bind an udp handle twice (Bert Belder)

* windows: backport pipe-connect-to-file fixes from master (Bert Belder)

* windows: never call fs event callbacks after closing the watcher (Bert Belder)

* fs.readFile: don't make the callback before the fd is closed (Bert Belder)

* windows: use 64bit offsets for uv_fs apis (Igor Zinkovsky)

* Fix #2061: segmentation fault on OS X due to stat size mismatch (Ben Noordhuis)
2012-04-09 09:03:00 -07:00
Bert Belder
1042a8d887 Please the compiler 2012-04-06 03:14:07 +02:00
Igor Zinkovsky
052aaa4c4d windows: use 64bit offsets for uv_fs apis 2012-04-05 16:03:11 -07:00
isaacs
01d46f3a20 Fix #3052 Handle errors properly in zlib 2012-04-02 13:48:10 -07:00
Dave Pacheco
cc15299c32 build: add support for DTrace and postmortem
* fixes #2110
* includes V8 postmortem metadata in Solaris builds
* adds GYP support for DTrace probes and ustack helper
* ustack helper derives constants dynamically from libv8_base.a
* build with DTrace support by default on SunOS
2012-04-01 00:14:36 +00:00
Ben Noordhuis
7bdeed2039 zlib: fix uninitialized variable compiler warning 2012-03-31 23:50:02 +00:00
Ben Noordhuis
a4a04f932e node: provide snprintf implementation on windows
_snprintf() doesn't zero-terminate the buffer on overflow.
2012-04-01 01:17:25 +02:00
Ben Noordhuis
dee8c51547 node: don't check return value of unsetenv()
It returns void on some platforms, notably FreeBSD.
2012-03-31 23:23:48 +02:00
Ben Noordhuis
bc834c395b Alias _snprintf to snprintf, fix Windows build. 2012-03-31 22:37:51 +02:00
Bert Belder
407181538b Revert "Re-add top-level v8::Locker"
The locker makes node crash in debug mode sometimes.
For example, test/simple/test-repl.js triggers it.

This reverts commit 9a6012edd9.

Conflicts:

	src/node.cc
2012-03-30 21:50:15 +02:00
Ben Noordhuis
7c02b5a58d udp_wrap: simplify AddressToJS() function 2012-03-30 21:24:02 +02:00
Ben Noordhuis
1ab95a536a udp_wrap: use new slab allocator 2012-03-30 21:24:02 +02:00
Ben Noordhuis
1e13a2d242 stream_wrap: use new slab allocator 2012-03-30 21:24:02 +02:00
Ben Noordhuis
08032efed0 core: add reusable slab allocator 2012-03-30 21:24:02 +02:00
Ben Noordhuis
a58659cd4a core: add ROUND_UP() macro 2012-03-30 21:24:01 +02:00
Ben Noordhuis
9d1fde7519 typed arrays: root JS objects in HandleScope with Local<> 2012-03-30 21:24:01 +02:00
Ben Noordhuis
036d907df7 tcp: root JS objects in HandleScope with Local<> 2012-03-30 21:24:01 +02:00
Ben Noordhuis
3005965266 stat_watcher: root JS objects in HandleScope with Local<> 2012-03-30 21:24:01 +02:00
Ben Noordhuis
1a49df5fa9 http: root JS objects in HandleScope with Local<> 2012-03-30 21:24:01 +02:00
Ben Noordhuis
9eacf93928 crypto: root JS objects in HandleScope with Local<> 2012-03-30 21:24:01 +02:00
Ben Noordhuis
f86359cc3f udp: root JS objects in HandleScope with Local<> 2012-03-30 21:24:01 +02:00
Ben Noordhuis
32b2964eed udp: remove slab allocator 2012-03-30 21:24:01 +02:00
isaacs
8d3278b962 Now working on 0.7.8 2012-03-30 11:54:39 -07:00
isaacs
69ae75c66c Merge branch 'v0.7.7-release' 2012-03-30 11:54:08 -07:00
Ben Noordhuis
17524432ff Fix Engrish in error messages. 2012-03-30 16:07:05 +02:00
Ben Noordhuis
db0a1dc7d9 node: remove unused function 2012-03-30 14:52:39 +02:00
Ben Noordhuis
8c97ad4c30 node: fix signedness compiler warnings 2012-03-30 14:52:38 +02:00
Ben Noordhuis
6986d9316c crypto: fix signedness compiler warnings 2012-03-30 14:52:38 +02:00
Ben Noordhuis
b82b4f2993 buffer: fix signedness compiler warnings 2012-03-30 14:52:38 +02:00
Ben Noordhuis
0f0557d78d stream_wrap: fix signedness compiler warnings 2012-03-30 14:52:38 +02:00
isaacs
5cda2542fd 2012.03.30, Version 0.7.7 (unstable)
* Upgrade V8 to 3.9.24.7

* Upgrade npm to 1.1.15

* Handle Emoji characters properly (Erik Corry, Bert Belder)

* readline: migrate ansi/vt100 logic from tty to readline (Nathan Rajlich)

* readline: Fix multiline handling (Alex Kocharin)

* add a -i/--interactive flag to force the REPL (Nathan Rajlich)

* debugger: add breakOnException command (Fedor Indutny)

* cluster: kill workers when master dies (Andreas Madsen)

* cluster: add graceful disconnect support (Andreas Madsen)

* child_process: Separate 'close' event from 'exit' (Charlie McConnell)

* typed arrays: add Uint8ClampedArray (Mikael Bourges-Sevenier)

* buffer: Fix byte alignment issues (Ben Noordhuis, Erik Lundin)

* tls: fix CryptoStream.setKeepAlive() (Shigeki Ohtsu)

* Expose http parse error codes (Felix Geisendörfer)

* events: don't delete the listeners array (Ben Noordhuis, Nathan Rajlich)

* process: add process.config to view node's ./configure settings (Nathan Rajlich)

* process: process.execArgv to see node's arguments (Micheil Smith)

* process: fix process.title setter (Ben Noordhuis)

* timers: handle negative or non-numeric timeout values (Ben Noordhuis)
2012-03-29 20:20:23 -07:00
ssuda
44eb279ef8 zlib: don't use C++ templates
Reduces the executable's size by a few kilobytes.
2012-03-29 14:22:37 +02:00
isaacs
8a15147bc5 Reapply "debug: Wait 50ms before running the main module"
This reapplies commit c781f17742
This reverts commit 00224771e3
2012-03-28 19:41:29 -07:00
Erik Lundin
973bbecf1a typed arrays: prevent unaligned typed array views on top of buffers 2012-03-29 01:36:45 +02:00
Mikael Bourges-Sevenier
67fc1dafd0 typed arrays: add Uint8ClampedArray 2012-03-28 22:57:15 +02:00
Nathan Rajlich
208b230744 repl: add a 'useColors' option to the repl
This should only be minimally used, since the `terminal` value will usually be
what you are expecting. This option is specifically for the case where `terminal`
is false, but you still want colors to be output (or vice-versa).
2012-03-27 18:00:59 -07:00
Fedor Indutny
00224771e3 Revert "debug: Wait 50ms before running the main module"
This reverts commit c781f17742.
2012-03-28 01:40:45 +07:00
Fedor Indutny
5e8c2b0768 debugger: use v8 api to wait for a connection
Use v8::Debug::EnableAgent(_, _, true) to wait for incoming
debugger-client connection before emitting any break (or other) events.

This commit should fix test/simple/test-debugger-repl faults.
2012-03-28 01:37:54 +07:00
Nathan Rajlich
698e795a5f repl: fix 'terminal' mode autodetection on global repls
Fixes test/simple/test-force-repl.js
2012-03-26 19:06:58 -07:00
Nathan Rajlich
aad12d0b26 readline: migrate ansi/vt100 logic from tty to readline
The overall goal here is to make readline more interoperable with other node
Streams like say a net.Socket instance, in "terminal" mode.

See #2922 for all the details.
Closes #2922.
2012-03-26 15:21:25 -07:00
isaacs
a7dce47854 Now working on v0.6.15 2012-03-23 11:17:08 -07:00
isaacs
e513ffef75 2012.03.22 Version 0.6.14 (stable)
* net: don't crash when queued write fails (Igor Zinkovsky)

* sunos: fix EMFILE on process.memoryUsage() (Bryan Cantrill)

* crypto: fix compile-time error with openssl 0.9.7e (Ben Noordhuis)

* unix: ignore ECONNABORTED errors from accept() (Ben Noordhuis)

* Add UV_ENOSPC and mappings to it (Bert Belder)

* http-parser: Fix response body is not read (koichik)

* Upgrade npm to 1.1.12
  - upgrade node-gyp to 0.3.7
  - work around AV-locked directories on Windows
  - Fix isaacs/npm#2293 Don't try to 'uninstall' /
  - Exclude symbolic links from packages.
  - Fix isaacs/npm#2275 Spurious 'unresolvable cycle' error.
  - Exclude/include dot files as if they were normal files
2012-03-23 08:01:22 -07:00
ssuda
249c3c165a Avoiding unnecessary ToString() calls
String::Utf8Value and String::AsciiValue constructors take Handle<Value>
So no need to convert to Handle<String>
2012-03-23 01:02:59 +01:00
Bryan Cantrill
d1255914df sunos: fix EMFILE on process.memoryUsage() 2012-03-22 16:18:11 -07:00
Ben Noordhuis
ea44d3031d crypto: fix compile-time error with openssl <= 0.9.7e 2012-03-22 15:52:12 +01:00
Nathan Rajlich
feaa8a41c7 cmd: add a -i / --interactive flag to force the REPL
This is the only way to spawn a node child process in REPL mode, and will
also be needed to be able to use the REPL in MinTTY.
2012-03-21 00:05:25 -07:00
isaacs
c781f17742 debug: Wait 50ms before running the main module 2012-03-20 19:46:36 -07:00
ssuda
253ec6a63d process: don't use strdup()
file and cwd can be directly used from Utf8Value.
2012-03-20 17:59:21 +01:00
Felix Geisendörfer
18240193ba Expose http parse error codes
Currently http parse errors do not expose the error details available
from http_parser. This patch exposes the error code as `err.code`.
2012-03-19 19:00:16 -07:00
Nathan Rajlich
11d8823791 process: add process.config
This is the JS representation of the `config.gypi` file that was used when
compiling node. With this information, you can tell whether the current node
binary has shared or static dependencies, or any other configuration options
that may have been used.
2012-03-15 17:15:18 -07:00
Ben Noordhuis
1a97998644 process: fix process.title setter
Commit 19fd530 broke the argv initialization logic that's used on linux and
freebsd to update the process name (as displayed in tools like `top`).

Fixes test/simple/test-setproctitle.js.
2012-03-15 23:10:32 +01:00
Micheil Smith
19fd5301bf Expose original argv as process.execArgv for cluster and child_process.fork() 2012-03-15 13:47:43 -07:00
isaacs
b9bd2d3eb9 Now working on v0.6.14 2012-03-15 10:33:33 -07:00
isaacs
9f7f86b534 2012.03.15 Version 0.6.13 (stable)
* Windows: Many libuv test fixes (Bert Belder)

* Windows: avoid uv_guess_handle crash in when fd < 0 (Bert Belder)

* Map EBUSY and ENOTEMPTY errors (Bert Belder)

* Windows: include syscall in fs errors (Bert Belder)

* Fix fs.watch ENOSYS on Linux kernel version mismatch (Ben Noordhuis)

* Update npm to 1.1.9
  - upgrade node-gyp to 0.3.5 (Nathan Rajlich)
  - Fix isaacs/npm#2249 Add cache-max and cache-min configs
  - Properly redirect across https/http registry requests
  - log config usage if undefined key in set function (Kris Windham)
  - Add support for os/cpu fields in package.json (Adam Blackburn)
  - Automatically node-gyp packages containing a binding.gyp
  - Fix failures unpacking in UNC shares
  - Never create un-listable directories
  - Handle cases where an optionalDependency fails to build
2012-03-15 08:45:35 -07:00
Nathan Rajlich
35043ad8ac process: use NODE_STRINGIFY macro to set process.versions.uv 2012-03-14 01:40:29 +01:00
isaacs
bda08bfa04 Now working on 0.7.7 2012-03-13 14:03:51 -07:00
isaacs
73c874698b Merge branch 'v0.7.6-release' 2012-03-13 14:03:07 -07:00
isaacs
f06abda6f5 2012.03.13, Version 0.7.6 (unstable)
* Upgrade v8 to 3.9.17

* Upgrade npm to 1.1.8
  - Add support for os/cpu fields in package.json (Adam Blackburn)
  - Automatically node-gyp packages containing a binding.gyp
  - Fix failures unpacking in UNC shares
  - Never create un-listable directories
  - Handle cases where an optionalDependency fails to build

* events: newListener emit correct fn when using 'once' (Roly Fentanes)

* url: Ignore empty port component (Łukasz Walukiewicz)

* module: replace 'children' array (isaacs)

* tls: parse multiple values of a key in ssl certificate (Sambasiva Suda)

* cluster: support passing of named pipes (Ben Noordhuis)

* Windows: include syscall in fs errors (Bert Belder)

* http: #2888 Emit end event only once (Igor Zinkovsky)

* readline: add multiline support (Rlidwka)

* process: add `process.hrtime()` (Nathan Rajlich)

* net, http, https: add localAddress option (Dmitry Nizovtsev)

* addon improvements (Nathan Rajlich)

* build improvements (Ben Noordhuis, Sadique Ali, T.C. Hollingsworth, Nathan Rajlich)

* add support for "SEARCH" request methods (Nathan Rajlich)

* expose the zlib and http_parser version in process.versions (Nathan Rajlich)
2012-03-13 13:02:38 -07:00
Nathan Rajlich
f9da776b33 process: listen for the "exit" even on the main repl 2012-03-13 19:58:53 +01:00
Nathan Rajlich
9701f1c4b2 process: expose the zlib version in use in process.versions 2012-03-12 23:29:20 +01:00
Ben Noordhuis
531eba18a6 zlib: fix include of zlib.h
Including <zlib.h> may lead to false positives when the user specifies a bad
path in `./configure --shared-zlib --shared-zlib-includes=/path/to/zlib`. If
a zlib.h exists somewhere on the system include path (common on UNIX systems),
the compiler will include that instead, possibly leading to header mismatch
errors that are hard to debug.
2012-03-12 23:22:48 +01:00
Ben Noordhuis
4472f7bbc3 http: use HTTP_METHOD_MAP macro 2012-03-12 02:23:34 +01:00
Nathan Rajlich
36761b2055 process: expose the http_parser version in process.versions 2012-03-10 00:22:42 +01:00
Ben Noordhuis
ff4a9d381d core: use proper #include directives 2012-03-10 00:14:14 +01:00
Ben Noordhuis
8c02f9b7c8 buffer: throw from constructor if length > kMaxLength
Throw, don't abort. `new Buffer(0x3fffffff + 1)` used to bring down the process
with the following error message:

  FATAL ERROR: v8::Object::SetIndexedPropertiesToExternalArrayData() length
  exceeds max acceptable value

Fixes #2280.
2012-03-09 23:57:03 +01:00
Ben Noordhuis
2589d55611 core: add ThrowError(), ThrowTypeError(), ThrowRangeError() 2012-03-09 23:31:03 +01:00