Commit Graph

8899 Commits (222e5239fc5fc699cc5b4c2aa34377a52c699670)

Author SHA1 Message Date
Ben Noordhuis 222e5239fc v8: fix openbsd build
This is [1] applied ahead of time. Summary:

    OpenBSD doesn't have <ucontext.h>. ucontext_t lives in <signal.h>
    and is a typedef for struct sigcontext. There is no uc_mcontext.

[1] https://codereview.chromium.org/21705003/
2013-08-05 02:53:43 +02:00
Fedor Indutny ea7b817266 tls: fix handling of `SNICallback` server option
It shouldn't ignore it!

There're two possibile cases, which should be handled properly:

1. Having a default `SNICallback` which is using contexts, added with
  `server.addContext(...)` routine
2. Having a custom `SNICallback`.

In first case we may want to opt-out setting `.onsniselect` method (and
thus save some CPU time), if there're no contexts added. But, if custom
`SNICallback` is used, `.onsniselect` should always be set, because
server contexts don't affect it.
2013-08-04 14:11:28 +04:00
Ben Noordhuis 5383e75885 src: use static_cast for void-to-T casts
Code cleanup, replace a few uses of reinterpret_cast<T*>(void_ptr) with
static_cast<T*>(void_ptr).
2013-08-03 22:50:16 +02:00
Ben Noordhuis d4cc30f18c src: use PersistentToLocal() in a few more places
Update a few more `Local<T>::New(isolate, persistent)` call sites to
`PersistentToLocal(isolate, persistent)` - the latter has a fast path
for non-weak persistent references.
2013-08-03 22:23:28 +02:00
Fedor Indutny e5791f74f0 crypto: fix another over-run in bio
When doing `FreeEmpty`, `NodeBIO` skips pre-allocated `head_` buffer.
However this might lead to double-freeing buffers since in `~NodeBIO()`
we're starting deallocation from `head_` buffer.
2013-08-03 14:04:55 +04:00
Ben Noordhuis 350fc8064e src: remove non-isolate PersistentToLocal(), v2
Commit 78d9094 updated src/*.cc to use the version of PersistentToLocal
that takes a v8::Isolate* as its first argument. This commit removes
the non-isolate version.
2013-08-03 01:30:42 +02:00
Trevor Norris c80f8fa8f1 process: set key properties as ReadOnly 2013-08-02 14:17:29 -07:00
Ben Noordhuis 78d90945d6 src: remove non-isolate PersistentToLocal()
There is no need for it and it's a tiny bit slower than the version of
PersistentToLocal() that takes a v8::Isolate* as its first argument.
2013-08-02 23:16:00 +02:00
Trevor Norris 2dafa193ee smalloc: remove double checks
Now that values are checks in JS, no need for them to be checked in C++.
2013-08-02 13:00:54 -07:00
Trevor Norris da07709c74 smalloc: fix assertion fails/segfault
* Numeric values passed to alloc were converted to int32, not uint32
  before the range check, which allows wrap around on ToUint32. This
  would cause massive malloc calls and v8 fatal errors.
* dispose would not check if value was an Object, causing segfault if a
  Primitive was passed.
* kMaxLength was not enumerable.
2013-08-02 12:52:43 -07:00
Trevor Norris 3158ffb6ef util: add isPrimitive check 2013-08-02 12:52:34 -07:00
Ben Noordhuis e772a7deaf build: fix --without-ssl build
Build breakage accidentally introduced in 8e29ce9 during code cleanup.

HAVE_OPENSSL is always defined (as either 0 or 1) so use #if rather
than #ifdef.

Fixes #5979.
2013-08-02 13:54:39 +02:00
isaacs 22c68fdc1d src: Replace macros with util functions 2013-08-01 15:08:01 -07:00
Trevor Norris 9a29aa8c55 benchmark: update misc to new v8 API 2013-08-01 15:02:38 -07:00
Trevor Norris 76ada45342 test: add mac to test-os
Fix test from 30701d6.
2013-08-01 13:53:19 -07:00
Fedor Indutny dda22a520b tls_wrap: parse tls session ticket extension
And, if present and non-empty, don't invoke `resumeSession` callback.

fix #5872
2013-08-01 16:06:45 +04:00
Brian White 30701d6e74 os: add mac address to networkInterfaces() output 2013-08-01 12:47:05 +02:00
Ben Noordhuis a622bde9e6 cpplint: exclude src/node_win32_perfctr_provider.cc
It's forced to violate the build/include_order rule because it includes
a header file generated with ctrpp.exe that doesn't include perflib.h
itself.
2013-08-01 12:33:35 +02:00
Ben Noordhuis 1ef1be376c src: don't include <string.h> twice in src/node.cc 2013-08-01 12:26:24 +02:00
Bert Belder 6430c3f55d build: disable some msvc compiler warnings
These are not real problems, and they are so plenty that actual problems
are hidden from view.
2013-08-01 11:53:41 +02:00
Bert Belder 168ca527be build: un-break the windows build 2013-08-01 11:39:25 +02:00
Ben Noordhuis 02cab97490 src: more lint after cpplint tightening
Commit 847c6d9 adds a 'project headers before system headers' check
to cpplint. Update the files in src/ to make the linter pass again.
2013-07-31 23:16:26 +02:00
Ben Noordhuis 847c6d980c tools: cpplint: fix up build/include_order rule
Change the build/include_order rule to match our preference:
project headers before system headers.

The rationale is that system headers before project headers makes it
easy to slip in bugs where a project header that requires a definition
from a system header, forgets to include the system header but still
compiles because the source files that include the project header
coincidentally include the system header too.

A good example is the size_t type. A project header file that needs the
definition of size_t should include stddef.h but forgetting to do so
will probably go unnoticed for a long time because almost every other
system header includes stddef.h (either directly or indirectly) and
almost every source file includes one or more system headers.

Ergo, project headers before system headers. It's a good thing.
2013-07-31 22:34:35 +02:00
Antony Bailey 58159e308b doc: remove travis status image
The project has moved to Jenkins. The status image is no longer
needed and perpetually shows a failed build. Remove it.
2013-07-31 21:50:09 +02:00
Fedor Indutny 6caf012d59 etw_provider: unbreak windows build 2013-07-31 22:35:46 +04:00
Fedor Indutny ccf8f3eebc make: add `cpplint` to `test` target
Also, exclude some C-headers, machine generated headers and tweaked
sources from cpplint file list.
2013-07-31 22:12:06 +04:00
Fedor Indutny 8e29ce9f13 src: lint c++ code 2013-07-31 22:12:06 +04:00
Fedor Indutny 3c6b5d5df1 cpplint: make lint rules closer to node's source
* Support C-style header guards (/* comments */)
* Support `class NODE_EXTERN something`
* Support `}  // extern "C"` closures
* Ignore header order
* Ignore `long/short` usage (because of OpenSSL's API)
2013-07-31 22:12:06 +04:00
Trevor Norris 6a5a7b089e node: add inTick and lastThrew to infoBox
To prevent all unnecessary calls to JS from MakeCallback, the remaining
two immediate return variables inTick and lastThrew have been added to
infoBox. Now MakeCallback should never need to call into JS unless it
absolutely has to.

Also removed Tock. Performance tests showed it was at least as fast or
faster than using a normal object, and this is more readable.
2013-07-31 09:25:19 -07:00
Ben Noordhuis 2cd7adc7f4 util: don't throw on circular %j input to format()
Don't throw an exception when the argument to %j is an object that
contains circular references, it's not helpful. Catch the exception
and return the string '[Circular]'.
2013-07-29 21:59:15 +02:00
Trevor Norris 7ca77eaf38 fs: write strings directly to disk
Prior, strings would first be converted to a Buffer before being written
to disk. Now the intermediary step has been removed.

Other changes of note:

* Class member "must_free" was added to req_wrap so to track if the
  memory needs to be manually cleaned up after use.
* External String Resource support, so the memory will be used directly
  instead of copying out the data.
* Docs have been updated to reflect that if position is not a number
  then it will assume null. Previously it specified the argument must be
  null, but that was not how the code worked. An attempt was made to
  only support == null, but there were too many tests that assumed !=
  number would be enough.
* Docs update show some of the write/writeSync arguments are optional.
2013-07-30 14:42:30 -07:00
Trevor Norris 63fc6a63c8 string_bytes: export GetExternalParts
The method is useful elsewhere when needing to check if external and
grab data.
2013-07-30 14:41:01 -07:00
Ben Noordhuis 3ff2cbc892 deps: upgrade libuv to joyent/libuv@4bdb7d8
Non-release upgrade so pending patches can land.
2013-07-30 23:33:45 +02:00
Ben Noordhuis 4cc57b4aca crypto: simplify DH modp group name matcher
* Use ARRAY_SIZE() rather than scanning until we hit a NULL entry.
* Fix `-fsigned-char -Wnarrowing` compiler warnings. Harmless but
  numerous and annoying.
* Static-ify the modp_group and mod_groups arrays.
* Const-ify the modp_groups array.
2013-07-29 20:49:28 +02:00
Ben Noordhuis 8111ca2f9f src: const-ify variables in src/node_crypto*
No functional changes, just some code tightening. Clean up some style
inconsistencies while we are here.
2013-07-30 22:03:49 +02:00
Ben Noordhuis 71b3138925 src: remove unused import in src/node_os.cc 2013-07-30 21:32:45 +02:00
Ben Noordhuis 511af4dd5f string_bytes: don't use named imports in header
It imports the definition into every source file that includes
string_bytes.h, as evidenced by the build suddenly breaking left
and right because of missing Handle/Local/String/Value imports.
2013-07-30 21:31:04 +02:00
Ben Noordhuis 2fc47ab10b v8: upgrade v8 to 3.20.11 2013-07-30 17:14:55 +02:00
Ben Noordhuis b8c04b921b Merge remote-tracking branch 'origin/v0.10'
Conflicts:
	AUTHORS
	ChangeLog
	deps/uv/ChangeLog
	deps/uv/src/version.c
	deps/uv/src/win/fs.c
	src/node.cc
	src/node_crypto.cc
	src/node_os.cc
	src/node_version.h
2013-07-30 15:19:48 +02:00
Ben Noordhuis 6327d67be3 crypto: fix assert() on malformed hex input
Use the StringBytes::IsValidString() function introduced in commit
dce26cc to ensure that the input string meets the expectations of the
other StringBytes functions before processing it further.

Fixes the following assertion:

    Assertion failed: (str->Length() % 2 == 0 && "invalid hex string
    length"), function StorageSize, file ../../src/string_bytes.cc,
    line 301.

Fixes #5725.
2013-07-30 14:34:19 +02:00
Ben Noordhuis dce26ccea1 string_bytes: add StringBytes::IsValidString()
Performs a quick, non-exhaustive check on the input string to see if
it's compatible with the specified string encoding.

Curently it only checks that hex strings have a length that is a
multiple of two.
2013-07-30 14:32:47 +02:00
Ben Noordhuis dc9acd4fae assert: replace !!!value with just !value
Not harmful, just code cleanup.

Fixes #5885.
2013-07-30 13:29:20 +02:00
Ben Noordhuis 6bd922fce8 dgram: report send errors to cb, don't pass bytes
Passing the number of sent bytes to the callback is superfluous;
datagram sockets operate in atomic mode: either the sendmsg() system
call succeeds or it fails but it never does partial writes.

Instead, report send errors to the callback. UDP error reporting is
fairly haphazard on most platforms. You should not expect reliable
delivery of anything besides EMSGSIZE and (possibly) ENETDOWN and
ENETUNREACH.

Fixes #2608.
2013-07-29 06:48:46 +02:00
Ben Noordhuis 34b0a36120 src: don't use NewExternal() with unaligned strings
V8 3.20.9 enforces that external pointers are aligned on a two-byte
boundary.

We cannot portably guarantee that for the source code strings that
tools/js2c.py generates so simply stop using String::NewExternal()
altogether (and by extension String::ExternalAsciiStringResource).

Fixes the following run-time assert:

  FATAL ERROR: v8::String::NewExternal() Pointer is not aligned
2013-07-29 05:11:00 +02:00
Ben Noordhuis 1bd711c8a0 v8: upgrade to v8 3.20.9 2013-07-29 21:21:03 +02:00
Andrew Paprocki 17fbd6cd66 doc: vm: fix incorrect API documentation
On timeout, an Error object is thrown, not null.
2013-07-29 17:34:13 +02:00
Ben Noordhuis c13bfdc091 child_process: add 'shell' option to .exec()
No test, we can't rely on an alternate shell being available.

Fixes #5935.
2013-07-29 16:41:56 +02:00
Fedor Indutny 38176d3a1a test: loosen timeout in https-no-reader
fix #5925
2013-07-29 13:33:01 +04:00
Ben Noordhuis 8f571b52a7 src: remove unused tick_spinner 2013-07-28 19:07:59 +02:00
Ben Noordhuis e5233939be test: cluster: add 'bind to privileged port' tests 2013-07-28 14:52:01 +02:00