Commit Graph

8645 Commits (1bf6d78980fe77679c92d22b40b5d968e71d3299)

Author SHA1 Message Date
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
Sam Roberts 226a20da5d doc: call console module 'console' not 'stdio'
The console module has always been called 'stdio' in the
table-of-contents, but nowhere else, since its name is
'console'. This makes it difficult to find.
2013-06-17 23:10:31 +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
Krzysztof Chrapka ffcd8b94c2 readline: strip ctrl chars for prompt width calc
Use regular expression to strip vt ansi escape codes from display when
calulating prompt display width and cursor position

Fixes #3860 and #5628.
2013-06-17 16:19:12 +02:00
Fedor Indutny 212e9cd8c9 tls: session API returns 2013-06-17 14:00:26 +02:00
isaacs 0a4260c8c0 doc: Correct TLS deprecation notices 2013-06-16 18:56:00 -07: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 dc50f27d52 tls: share socket._hadError with http_client 2013-06-16 09:30:15 +02:00
Fedor Indutny af80e7bc6e tls: introduce TLSSocket based on tls_wrap binding
Split `tls.js` into `_tls_legacy.js`, containing legacy
`createSecurePair` API, and `_tls_wrap.js` containing new code based on
`tls_wrap` binding.

Remove tests that are no longer useful/valid.
2013-06-16 09:30:15 +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
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 3b0a759b6b test: fix up weakref.cc after v8 api change 2013-06-12 00:24:41 +02: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
Ben Noordhuis 2dbc5ea1b4 v8: reapply floating patches 2013-06-11 23:46:13 +02:00
Ben Noordhuis 6dd78074a3 v8: upgrade to v3.19.13 2013-06-11 23:46:00 +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 0882a75063 Merge remote-tracking branch 'ry/v0.10'
Conflicts:
	ChangeLog
	deps/uv/AUTHORS
	deps/uv/ChangeLog
	deps/uv/src/unix/linux-core.c
	deps/uv/src/version.c
	deps/uv/src/win/timer.c
	lib/url.js
	src/node_version.h
	test/simple/test-url.js
2013-06-05 13:38:38 -07:00
isaacs e0519ace31 net: Destroy when not readable and not writable
This is only relevant for CentOS 6.3 using kernel version 2.6.32.

On other linuxes and darwin, the `read` call gets an ECONNRESET in that
case.  On sunos, the `write` call fails with EPIPE.

However, old CentOS will occasionally send an EOF instead of a
ECONNRESET or EPIPE when the client has been destroyed abruptly.

Make sure we don't keep trying to write or read more in that case.

Fixes #5504

However, there is still the question of what libuv should do when it
gets an EOF.  Apparently in this case, it will continue trying to read,
which is almost certainly the wrong thing to do.

That should be fixed in libuv, even though this works around the issue.
2013-06-05 08:06:35 -07:00
isaacs 6ada73383c Now working on v0.10.11 2013-06-04 14:38:41 -07:00
isaacs 59c8f59171 blog: Release v0.10.10 2013-06-04 14:38:29 -07:00
isaacs fe0434ce1e Merge branch 'v0.10.10-release' into v0.10 2013-06-04 14:38:10 -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
isaacs 96c30df10c uv: Upgrade to 0.10.10 2013-06-04 12:11:03 -07:00
Ben Noordhuis 414a909d01 url: remove unused global variable 2013-06-04 11:43:42 -07:00
isaacs f28f67cf75 npm: Upgrade to 1.2.25 2013-06-04 11:42:32 -07:00
isaacs 51226b84cf doc: ChangeLog update for v0.8.24 2013-06-04 11:22:14 -07:00
isaacs e116ee7ba1 blog: 0.8 is maintenace, not stable 2013-06-04 11:19:10 -07:00
isaacs 0a763e35da blog: Release v0.8.24 2013-06-04 11:12:54 -07:00
isaacs 99fe35c67a blog: Release v0.10.9 2013-06-04 11:12:44 -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
isaacs 5dd91b0147 url: Set href to null by default 2013-06-03 16:02:51 -07:00
isaacs 5dc51d4e21 url: Properly parse certain oddly formed urls
In cases where there are multiple @-chars in a url, Node currently
parses the hostname and auth sections differently than web browsers.

This part of the bug is serious, and should be landed in v0.10, and
also ported to v0.8, and releases made as soon as possible.

The less serious issue is that there are many other sorts of malformed
urls which Node either accepts when it should reject, or interprets
differently than web browsers.  For example, `http://a.com*foo` is
interpreted by Node like `http://a.com/*foo` when web browsers treat
this as `http://a.com%3Bfoo/`.

In general, *only* the `hostEndingChars` should be the characters that
delimit the host portion of the URL.  Most of the current `nonHostChars`
that appear in the hostname should be escaped, but some of them (such as
`;` and `%` when it does not introduce a hex pair) should raise an
error.

We need to have a broader discussion about whether it's best to throw in
these cases, and potentially break extant programs, or return an object
that has every field set to `null` so that any attempt to read the
hostname/auth/etc. will appear to be empty.
2013-06-03 15:56:16 -07:00
isaacs df6ffc018e stream: unshift('') is a noop
In some cases, the http CONNECT/Upgrade API is unshifting an empty
bodyHead buffer onto the socket.

Normally, stream.unshift(chunk) does not set state.reading=false.
However, this check was not being done for the case when the chunk was
empty (either `''` or `Buffer(0)`), and as a result, it was causing the
socket to think that a read had completed, and to stop providing data.

This bug is not limited to http or web sockets, but rather would affect
any parser that unshifts data back onto the source stream without being
very careful to never unshift an empty chunk.  Since the intent of
unshift is to *not* change the state.reading property, this is a bug.

Fixes #5557
Fixes LearnBoost/socket.io#1242
2013-06-03 10:50:04 -07:00
isaacs 2900f0778a Merge remote-tracking branch 'ry/v0.10'
Conflicts:
	ChangeLog
	src/node_version.h
2013-05-31 11:52:57 -07: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