Commit Graph

9269 Commits (81307440440127c7c99183734098f97fac5e214d)

Author SHA1 Message Date
Ben Noordhuis ffc5d83568 src: move ReqWrap::data_ to FSReqWrap
FSReqWrap is the only ReqWrap child class that uses the data_ field so
move it out of ReqWrap and into FSReqWrap.
2013-08-13 11:56:45 +02:00
Matthias Bartelmeß 4ac6912a77 crypto: add TLS 1.1 and 1.2 to secureProtocol list 2013-08-13 11:46:07 +02:00
Ben Noordhuis d4ad5d1151 crypto: use consistent conn object unwrapping
We use `Foo:Unwrap(args.This())` everywhere else, let's use the same
idiom for Connection::Unwrap().
2013-08-12 23:51:01 +02:00
Ben Noordhuis 4901353b98 crypto: use consistent variable names
Code cleanup: don't call a Connection object `p` in some places, `c` in
other places and `ss` in yet other places. Let's just call it `conn`.

This also fixes about a million style errors in one fell swoop.
2013-08-12 23:51:01 +02:00
Trevor Norris d66d840e3b util: fix isPrimitive check
Previous check failed for the edge case Object.create(null). This uses
the current v8 code for the check.
2013-08-12 13:48:56 -07:00
Ben Noordhuis 624938d052 crypto: remove two unused static variables 2013-08-12 22:42:23 +02:00
Trevor Norris 35f789b027 src: fix build break from generic macro name
WRAP is too generic a macro name and causes the build to fail from
conflicts. They have been prepended with NODE_.
2013-08-12 12:54:49 -07:00
Ben Noordhuis 5725864dfd src: don't obj->Set(Integer::New(...), val)
Don't create an Integer when setting a numeric index on an object or an
array, use the version of v8::Object::Set() that takes an uint32_t.

Change the types of the variables from int to uint32_t and clean up
some code consistency issues while we're here.
2013-08-12 20:59:35 +02:00
Trevor Norris 756ae2c536 src: centralize class wrap/unwrap
While almost all cases were handled by simple WRAP/UNWRAP macros, this
extends those to cover all known occurrences.
2013-08-12 11:49:53 -07:00
Ben Noordhuis e0a8e1bf77 cares_wrap: remove unused function getHostByName()
Hasn't been used in ages. Also remove its (already disabled) test.
2013-08-12 20:05:16 +02:00
Ben Noordhuis 6cd7fd7d24 cares_wrap: don't set oncomplete property from c++
Don't set the oncomplete property in src/cares_wrap.cc, we can do it
just as easily in lib/dns.js.

Switch two closures to the 'function with _this_ object' model. Makes
it impossible for an overzealous closure to capture too much context
and accidentally hold on to too much memory.
2013-08-12 19:08:03 +02:00
Ben Noordhuis 4ffa943c3f test: fix up internet/test-dns after api change
* The test calls an internal API that changed in commit ca9eb71.

* Trying to reverse-lookup a bogus hostname now returns EINVAL rather
  than the (bogus!) status code ENOTIMP.
2013-08-12 17:33:59 +02:00
Ben Noordhuis 2b5b37a3ab stream_wrap: use v8::Integer::NewFromUnsigned()
Use v8::Integer::NewFromUnsigned() when updating the writeQueueSize
field.

Before this commit, it used v8::Integer::New() but that takes an
int32_t. It's unlikely for a write queue to grow beyond 2**31-1 bytes
but let's use the unsigned integer constructor anyway, just in case.
2013-08-11 00:11:28 +02:00
Ben Noordhuis a20d565d9c 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/

Note: the patch has been accepted upstream but hasn't made its way into
a stable release yet.
2013-08-10 16:28:18 +02:00
Ben Noordhuis f69be329f0 v8: upgrade v8 to 3.20.14.1 2013-08-10 16:27:43 +02:00
Ben Noordhuis 39aa894035 build: disable SSLv2 by default
No one in this day and age should be using SSLv2 so disable it by
default. You can re-enable it with `./configure --with-sslv2` but
there really should be no reason for that.
2013-08-10 15:46:06 +02:00
Ben Noordhuis c937f5b587 build: fix up style issues in configure script
* Use single quotes consistently.
* Remove a few stray semicolons.
* Fix up some overly long lines.
* Line up a few expressions.
2013-08-10 15:26:11 +02:00
Ben Noordhuis 52e47b24b3 configure: order configure switches alphabetically
Alphabetical order should make it easier to find the switches you need
because we've got quite a lot of them now.

Keep --prefix at the top because that's arguably the one people will be
looking for most.
2013-08-10 13:41:20 +02:00
Ben Noordhuis d046e9d033 build: make ninja build respect V=
Compiling with `make V=1` (which is the default) now runs ninja in
 verbose mode. To disable, run `make V=`.
2013-08-10 13:18:07 +02:00
Ben Noordhuis c75251ced2 build: don't auto-destroy existing configuration
Don't run configure when the configure script has been touched. Doing so
would be okay if the Makefile passed the original arguments to configure
but it doesn't - it runs configure without any arguments, effectively
destroying the current configuration.

Remove this misfeature and instead print an error message telling the
user to (re-)run configure.
2013-08-10 13:13:46 +02:00
Trevor Norris 3f5d5847e2 domain: share object and state with native land
Change process.domain to use a getter/setter and access that property
via an array index. These are much faster to get from c++, and it can be
passed to _setupDomainUse and stored as a Persistent<Array>.

InDomain() and GetDomain() as trivial ways to access the domain
information in the native layer. Important because we'll be able to
quickly access if a domain is active. Instead of just whether the domain
module has been loaded.
2013-08-09 16:54:45 -07:00
Trevor Norris 2ef1782bbc node: remove domain nextTick
It's ridiculously cheap to check if process.domain is set. Don't bother
cluttering the code.
2013-08-09 16:13:56 -07:00
Ben Noordhuis f9b7714b4b src: don't call v8::Object::SetHiddenValue()
Don't use v8::Object::SetHiddenValue() to keep a reference alive to the
buffer, we can just as easily do that from JS land and it's a lot faster
to boot.

Because the buffer is now a visible property of the write request
object, it's essential that we do *not* log it - we'd be effectively
serializing the whole buffer to a pretty-printed string.
2013-08-09 08:16:58 +02:00
Ben Noordhuis f548433195 test: use common.PORT in simple/test-net-GH-5504 2013-08-09 07:33:31 +02:00
Ben Noordhuis 78f709d0d4 src: fix windows build breakage from f674b09
The TWO_BYTE_BUFFER macro never made it into the final version of
the patch that got landed in commit f674b09.
2013-08-09 18:56:46 +02:00
Ben Noordhuis 1449739de0 dgram: don't call into js when send cb is omitted
Speed up dgram.Socket#send()-heavy code a little by omitting the call
into JS land when the user doesn't pass us a completion callback.
2013-08-09 18:56:45 +02:00
Ben Noordhuis 41ec6d0580 dgram: fix regression in string argument handling
v0.10 allows strings for the offset, length and port arguments to
dgram.send() and dgram.sendto() but master before this commit would
abort with the following assert:

    node: ../../src/udp_wrap.cc:227: static void
    node::UDPWrap::DoSend(const v8::FunctionCallbackInfo<v8::Value>&,
    int): Assertion `args[2]->IsUint32()' failed.

Go beyond what v0.10 does and also add range checks: offset and length
should be >= 0, port should be between 1 and 65535.

That particular change needs to be back-ported to v0.10 because passing
a negative offset or length number aborts with the following assertions:

    node: ../../src/udp_wrap.cc:264: static v8::Handle<v8::Value>
    node::UDPWrap::DoSend(const v8::Arguments&, int): Assertion
    `offset < Buffer::Length(buffer_obj)' failed.

Or:

    node: ../../src/udp_wrap.cc:265: static v8::Handle<v8::Value>
    node::UDPWrap::DoSend(const v8::Arguments&, int): Assertion
    `length <= Buffer::Length(buffer_obj) - offset' failed.

Interestingly enough, a negative port number is accepted in v0.10 but
is silently ignored.

This commit exposed a bug in the simple/test-dgram-close test which
has also been fixed.
2013-08-09 03:05:46 +02:00
Ben Noordhuis f674b09f40 src: use v8::String::NewFrom*() functions
* Change calls to String::New() and String::NewSymbol() to their
  respective one-byte, two-byte and UTF-8 counterparts.

* Add a FIXED_ONE_BYTE_STRING macro that takes a string literal and
  turns it into a v8::Local<v8::String>.

* Add helper functions that make v8::String::NewFromOneByte() easier to
  work with. Said function expects a `const uint8_t*` but almost every
  call site deals with `const char*` or `const unsigned char*`. Helps
  us avoid doing reinterpret_casts all over the place.

* Code that handles file system paths keeps using UTF-8 for backwards
  compatibility reasons. At least now the use of UTF-8 is explicit.

* Remove v8::String::NewSymbol() entirely. Almost all call sites were
  effectively minor de-optimizations. If you create a string only once,
  there is no point in making it a symbol. If you are create the same
  string repeatedly, it should probably be cached in a persistent
  handle.
2013-08-09 11:44:50 +02:00
isaacs c0e70354db stream: Short-circuit buffer pushes when flowing
When a stream is flowing, and not in the middle of a sync read, and
the read buffer currently has a length of 0, we can just emit a 'data'
event rather than push it onto the array, emit 'readable', and then
automatically call read().

As it happens, this is quite a frequent occurrence!  Making this change
brings the HTTP benchmarks back into a good place after the removal of
the .ondata/.onend socket kludge methods.
2013-08-08 13:01:09 -07:00
isaacs 967b5dbb45 http: Use streams3 directly, not .ondata/end 2013-08-08 13:01:09 -07:00
Trevor Norris cec81593d7 smalloc: allow different external array types
smalloc.alloc now accepts an optional third argument which allows
specifying the type of array that should be allocated. All available
types are now located on smalloc.Types.
2013-08-07 12:53:24 -07:00
Trevor Norris cd00064566 smalloc: cleanup checks/conversions
* Moved the ToObject check out of smalloc::Alloc and into JS. Direct
  usage of that method is for internal use only and so can bypass the
  possible coercion.
* Same has been done with smalloc::SliceOnto.
* smalloc::CopyOnto will now throw if passed argument is not an object.
* Remove extra TargetFreeCallback function. There was a use for it when
  it was working with a Local<T>, but that code has been removed making
  the function superfluous.
2013-08-07 12:52:56 -07:00
Ben Noordhuis b9150344ac stream_wrap: fix long line introduced in da5ad92
Said commit was a back-port from a feature branch where it did lint.
Mea culpa.
2013-08-07 21:33:21 +02:00
isaacs 12cd13312b http: Support legacy agent.addRequest API
There are some agent subclasses using this today.

Despite the addRequest function being undocumented internal API, it's
easy enough to just support the old signature for backwards
compatibility.
2013-08-07 10:29:15 -07:00
Ben Noordhuis d24decb87b src: remove no-op HandleWrap::Initialize()
It's never been used and we probably never will. Remove it.
2013-08-07 18:03:14 +02:00
Ben Noordhuis 54a9ec4ef0 stream_wrap: add handle type checkers
Add is_named_pipe(), is_named_pipe_ipc() and is_tcp() and update the
code base to use those rather than `stream->type == UV_FOO` and
`reinterpret_cast<uv_pipe_t*>(handle)->ipc` style checks.
2013-08-07 17:27:35 +02:00
Ben Noordhuis da5ad92ab2 stream_wrap: use getters, not direct field access
Hide member fields behind getters. Make the fields themselves const
in the sense that the pointer is non-assignable - the pointed to object
remains mutable.

Makes reasoning about lifecycle and mutability a little easier.
2013-08-07 17:16:47 +02:00
Ben Noordhuis 4692b725de src: constify WITH_GENERIC_STREAM macro
Make the pointer-to-wrap const (i.e. mutable but not assignable) to
prevent accidental reassignment in the macro body.
2013-08-07 14:53:50 +02:00
Ben Noordhuis c079f6e210 src: add IsEmpty() check to HasInstance()
The check has virtually zero overhead and it simplifies the call sites
because they were calling IsEmpty() anwyay.
2013-08-07 14:46:55 +02:00
Timothy J Fontaine b1acb2ebd6 blog: Post for v0.11.5 2013-08-06 17:14:53 -07:00
Timothy J Fontaine 536037369e Now working on 0.11.6 2013-08-06 17:13:47 -07:00
Timothy J Fontaine 7aa4242844 Merge branch 'v0.11.5-release' 2013-08-06 17:13:17 -07:00
Trevor Norris e3c5019ac7 domains: properly check if domains are being used
process.domain is almost never just undefined, so it was setting the
object property unnecessarily.
2013-08-06 15:42:47 -07:00
Timothy J Fontaine 6f92da2dd1 2013.08.06, Version 0.11.5 (Unstable)
* v8: upgrade to 3.20.11

* uv: upgrade to v0.11.7

* buffer: return offset for end of last write (Trevor Norris)

* build: embed the mdb_v8.so into the binary (Timothy J Fontaine)

* build: fix --without-ssl build (Ben Noordhuis)

* child_process: add 'shell' option to .exec() (Ben Noordhuis)

* dgram: report send errors to cb, don't pass bytes (Ben Noordhuis)

* fs: write strings directly to disk (Trevor Norris)

* https: fix default port (Koichi Kobayashi)

* openssl: use asm for sha, md5, rmd (Fedor Indutny)

* os: add mac address to networkInterfaces() output (Brian White)

* smalloc: introduce smalloc module (Trevor Norris)

* stream: Simplify flowing, passive data listening (streams3) (isaacs)

* tls: asynchronous SNICallback (Fedor Indutny)

* tls: share tls tickets key between cluster workers (Fedor Indutny)

* util: don't throw on circular %j input to format() (Ben Noordhuis)
2013-08-06 14:41:21 -07:00
Timothy J Fontaine fa8efa98de uv: Upgrade to v0.11.7 2013-08-06 14:35:33 -07:00
Fedor Indutny 166c405b33 tls: fix lazy initialization of clienthello parser
`server.SNICallback` was initialized with `SNICallback.bind(this)`, and
therefore check `this.SNICallback === SNICallback` was always false, and
`_tls_wrap.js` always thought that it was a custom callback instead of
default one. Which in turn was causing clienthello parser to be enabled
regardless of presence of SNI contexts.
2013-08-07 00:57:32 +04:00
Timothy J Fontaine b26d346b57 Merge remote-tracking branch 'upstream/v0.10'
Conflicts:
	deps/v8/test/cctest/test-api.cc
	lib/events.js
	lib/http.js
2013-08-06 11:59:17 -07:00
Ben Noordhuis b8a7eedea3 process_wrap: omit superfluous Number creation
Don't create a superfluous Number object, just use the version of
v8::Object::Get() that takes an unsigned int. Convert the index to
unsigned int while we're here.
2013-08-06 17:51:22 +02:00
Eran Hammer 23d92ec88e stream: Fix double pipe error emit
If an error listener is added to a stream using once() before it is
piped, it is invoked and removed during pipe() but before pipe() sees it
which causes it to be emitted again.

Fixes #4155 #4978
2013-08-06 08:15:13 -07:00
Ben Noordhuis 45d056ee69 src: fix WITH_GENERIC_STREAM() type check bug
The handle object was checked against the wrong constructor template.
Put another way, it was unwrapped as the wrong StreamWrap type.
2013-08-06 15:47:44 +02:00