Commit Graph

9269 Commits (81307440440127c7c99183734098f97fac5e214d)

Author SHA1 Message Date
Ben Noordhuis 576496632c crypto: fix signed/unsigned comparison warning
The type of the expression `(uint16_t) server_names_len + 2` gets
implicitly widened to int. Change the type of server_names_len to
uint32_t to avoid the following warnings:

    ../../src/node_crypto_clienthello.cc:144: warning: comparison
    between signed and unsigned integer expressions
    ../../src/node_crypto_clienthello.cc:146: warning: comparison
    between signed and unsigned integer expressions
2013-08-06 15:39:43 +02:00
Fedor Indutny 048e0e77e0 tls: asynchronous SNICallback
Make ClientHelloParser handle SNI extension, and extend `_tls_wrap.js`
to support loading SNI Context from both hello, and resumed session.

fix #5967
2013-08-06 16:13:01 +04:00
Fedor Indutny 8e28193cc2 tls_wrap: DRY ClientHelloParser
Share ClientHelloParser code between `tls_wrap.cc` and `node_crypto.cc`.

fix #5959
2013-08-06 16:13:01 +04:00
isaacs 6942a95ae1 repl: Add 'smalloc' to list of known modules 2013-08-05 17:03:08 -07:00
Evan Solomon 13ed817fec doc: add a missing word in streams doc
Ignore encoding *if* chunk is a buffer
2013-08-05 17:03:08 -07:00
Timothy J Fontaine 032373df7f build: fix ia32 sunos, elfwrap only needs -64 2013-08-05 14:33:55 -07:00
Timothy J Fontaine e851fef60f build: embed the mdb_v8.so into the binary
This builds and includes the mdb_v8.so in the binary of node so mdb
can be sure to always use the latest version
2013-08-05 14:19:29 -07:00
isaacs 366baedfd8 doc: Update LICENSE for npm's Artistic 2.0 2013-08-05 13:56:05 -07:00
isaacs f4b1e00071 test: Move test-http-default-port from disabled to simple 2013-08-05 12:55:31 -07:00
Koichi Kobayashi 72ad2c94df https: fix default port
https.get('https://github.com/') should use port 443, not 80.
2013-08-05 12:53:12 -07:00
isaacs 32fdae2ca3 http: Fix overlooked agent.globalAgent export
Noticed by @bnoordhuis in https://github.com/joyent/node/pull/5991#discussion_r5575946
2013-08-05 12:33:19 -07:00
mstarzinger@chromium.org 6b92a71321 v8: back-port fix for CVE-2013-2882
Quoting the CVE:

    Google V8, as used in Google Chrome before 28.0.1500.95, allows
    remote attackers to cause a denial of service or possibly have
    unspecified other impact via vectors that leverage "type confusion."

Likely has zero impact on node.js because it only runs local, trusted
code but let's apply it anyway.

This is a back-port of upstream commit r15665. Original commit log:

    Use internal array as API function cache.

    R=yangguo@chromium.org
    BUG=chromium:260106
    TEST=cctest/test-api/Regress260106

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

Fixes #5973.
2013-08-05 18:17:24 +02:00
Forrest L Norvell 231092d236 doc: document domain.enter() and domain.exit()
Adds the documentation requested in #5017.
2013-08-05 13:11:38 +02:00
Sam Roberts 6a7be99703 doc: fs.open, fix flag/mode confusion, etc.
Flags and modes aren't the same, symlinks are followed in all of the
path but the last component, docs should say something about what the
mode argument is for and when its used, fs.openSync should point to the
function that contains the docs for its args, as fs.writeSync does.
2013-08-05 12:26:09 +02:00
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
isaacs bea9dfa14c npm: Upgrade to 1.3.7 2013-08-02 14:55:22 -07: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
Ben Noordhuis 9e1eb361e8 test: future-proof simple/test-event-emitter-memory-leak
Run the garbage collector before running the actual test. It doesn't
matter now but if in the future something in node.js core creates a lot
of reclaimable garbage, that will break the test's expectation.
2013-08-01 16:14:14 +02:00
Ben Noordhuis 98db7babcc test: fix pummel/test-net-connect-memleak
* Run the garbage collector before creating the big array. It doesn't
  matter now but if in the future something in node.js core creates
  a lot of reclaimable garbage, that will break the test's expectation.

* The first RSS check was being done too late. The garbage collector
  might have run before the check, throwing off the 'reclaimed memory'
  calculation.

* Due to changes in how V8 represents the big array internally, the
  actual memory usage is just below 256 MB on x64. Update the test's
  expectation.
2013-08-01 16:07:46 +02:00
Ben Noordhuis fc6f8a6943 events: fix memory leak, don't leak event names
Before this commit, events were set to undefined rather than deleted
from the EventEmitter's backing dictionary for performance reasons:
`delete obj.key` causes a transition of the dictionary's hidden class
and that can be costly.

Unfortunately, that introduces a memory leak when many events are added
and then removed again. The strings containing the event names are never
reclaimed by the garbage collector because they remain part of the
dictionary.

That's why this commit makes EventEmitter delete events again. This
effectively reverts commit 0397223.

Fixes #5970.
2013-08-01 14:52:06 +02: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 3398cce193 http: improve chunked res.write(buf) performance
Avoid a costly buffer-to-string operation. Instead, allocate a new
buffer, copy the chunk header and data into it and send that.

The speed difference is negligible on small payloads but it really
shines with larger (10+ kB) chunks. benchmark/http/end-vs-write-end
with 64 kB chunks gives 45-50% higher throughput. With 1 MB chunks,
the difference is a staggering 590%.

Of course, YMMV will vary with real workloads and networks but this
commit should have a positive impact on CPU and memory consumption.

Big kudos to Wyatt Preul (@wpreul) for reporting the issue and providing
the initial patch.

Fixes #5941 and #5944.
2013-07-31 13:23:06 +02:00
Wyatt Preul 6359e017ac docs: Warning about consuming response 2013-07-30 15:06:20 -07: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