Commit Graph

9269 Commits (81307440440127c7c99183734098f97fac5e214d)

Author SHA1 Message Date
ChrisWren 2385fbbc3a doc: fixed syntax error in stream.Transform 2013-08-19 16:10:05 -07:00
James Halliday 5555318bf3 http: removed headers stay removed
This allows automatically-inserted headers to be removed permanently by
calling OutgoingMessage.removeHeader() on them, as if they were normal
headers.
2013-08-19 16:05:44 -07:00
Edward Hutchins 31a27ca72d Added documentation for process.execArgv 2013-08-19 15:53:09 -07:00
Eivind Uggedal 732f8b9641 doc: add missing word in Transform stream intro 2013-08-19 15:45:35 -07:00
isaacs fe0f12b100 Merge remote-tracking branch 'ry/v0.10' 2013-08-19 14:15:03 -07:00
Trevor Norris f97a1267e2 buffer: lint
This and b80d11d are my fault. An unrelated test was failing, which
prevents {js,cpp}lint from running automatically.
2013-08-19 11:15:16 -07:00
Fedor Indutny b80d11d46b buffer: lint 2013-08-19 20:41:24 +04:00
Fedor Indutny 306f863438 crypto: don't touch ssl_ in Connection
`ssl_` is a property of SSLWrap class, don't touch it, and definitely
don't zero it in constructor.
2013-08-19 20:34:34 +04:00
isaacs 545807918e stream: Throw on 'error' if listeners removed
In this situation:

    writable.on('error', handler);
    readable.pipe(writable);
    writable.removeListener('error', handler);
    writable.emit('error', new Error('boom'));

there is actually no error handler, but it doesn't throw, because of the
fix for stream.once('error', handler), in 23d92ec.

Note that simply reverting that change is not valid either, because
otherwise this will emit twice, being handled the first time, and then
throwing the second:

    writable.once('error', handler);
    readable.pipe(writable);
    writable.emit('error', new Error('boom'));

Fix this with a horrible hack to make the stream pipe onerror handler
added before any other userland handlers, so that our handler is not
affected by adding or removing any userland handlers.

Closes #6007.
2013-08-19 09:26:49 -07:00
Fedor Indutny b9a0eb0688 tls, crypto: deduplicate code
Commit 03e008d introduced src/tls_wrap.cc and src/tls_wrap.h but
said files copied on the order of 1 kLoC from src/node_crypto.cc
and src/node_crypto.h.  This commit undoes some of the duplication.

Fixes #6024.
2013-08-19 17:52:44 +02:00
Ben Noordhuis 3e25ed905c src: move includes inside include guard
Having the includes in src/node_buffer.h outside of the include guard
is not really harmful but it's inconsistent with other header files.
2013-08-19 16:42:12 +02:00
isaacs 3b923a7ace Merge remote-tracking branch 'ry/v0.10'
Conflicts:
	AUTHORS
	ChangeLog
	lib/dgram.js
	lib/http.js
	src/node_crypto.cc
	src/node_version.h
2013-08-17 13:57:41 -07:00
Ben Noordhuis 0c2960ef4a dgram: fix assertion on bad send() arguments
Add range checks for the offset, length and port arguments to
dgram.Socket#send().  Fixes the following assertion:

    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.

And:

    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 was accepted until now but
silently ignored.  (In other words, it would send the datagram to a
random port.)

This commit exposed a bug in the simple/test-dgram-close test which
has also been fixed.

This is a back-port of commit 41ec6d0 from the master branch.

Fixes #6025.
2013-08-17 17:11:02 +02:00
Daniel Chatfield 5453619eb2 readline: pause stdin before turning off terminal raw mode
On windows, libuv will immediately make a `ReadConsole` call (in the
thread pool) when a 'flowing' `uv_tty_t` handle is switched to
line-buffered mode. That causes an immediate issue for some users,
since libuv can't cancel the `ReadConsole` operation on Windows 8 /
Server 2012 and up if the program switches back to raw mode later.

But even if this will be fixed in libuv at some point, it's better to
avoid the overhead of starting work in the thread pool and immediately
cancelling it afther that.

See also f34f1e3, where the same change is made for the opposite
flow, e.g. move `resume()` after `_setRawMode(true)`.

Fixes #5927

This is a backport of dfb0461 (see #5930) to the v0.10 branch.
2013-08-17 15:35:09 +02:00
Daniel Chatfield dfb0461c4c readline: pause stdin before turning off terminal raw mode
On windows, libuv will immediately make a `ReadConsole` call (in the
thread pool) when a 'flowing' `uv_tty_t` handle is switched to
line-buffered mode. That causes an immediate issue for some users,
since libuv can't cancel the `ReadConsole` operation on Windows 8 /
Server 2012 and up if the program switches back to raw mode later.

But even if this will be fixed in libuv at some point, it's better to
avoid the overhead of starting work in the thread pool and immediately
cancelling it afther that.

See also f34f1e3, where the same change is made for the opposite
flow, e.g. move `resume()` after `_setRawMode(true)`.

Fixes #5927
Closes #5930
2013-08-17 15:22:50 +02:00
isaacs a66d2400a0 blog: v0.10.16 2013-08-16 12:47:54 -07:00
isaacs 0e043528a1 Now working on v0.10.17 2013-08-16 12:47:29 -07:00
isaacs e679739b63 Merge branch 'v0.10.16-release' into v0.10 2013-08-16 12:46:56 -07:00
Trevor Norris 2dd4a745b0 buffer: don't call ByteLength for simple encodings
For several encodings the byte length is simple arithmetic. Don't call
into C++ in those cases.
2013-08-16 12:42:33 -07:00
isaacs 50b4c905a4 2013.08.16, Version 0.10.16 (Stable)
* v8: back-port fix for CVE-2013-2882

* npm: Upgrade to 1.3.8

* crypto: fix assert() on malformed hex input (Ben Noordhuis)

* crypto: fix memory leak in randomBytes() error path (Ben Noordhuis)

* events: fix memory leak, don't leak event names (Ben Noordhuis)

* http: Handle hex/base64 encodings properly (isaacs)

* http: improve chunked res.write(buf) performance (Ben Noordhuis)

* stream: Fix double pipe error emit (Eran Hammer)
2013-08-16 08:32:38 -07:00
isaacs 5abdef790c npm: Upgrade to 1.3.8 2013-08-16 08:19:31 -07:00
Ben Noordhuis f55aca6515 crypto: fix memory leak in randomBytes() error path
This is the conceptual back-port of commit ec54873 from the master
branch.
2013-08-16 16:50:01 +02:00
Ben Noordhuis ec548734ca crypto: fix memory leak in randomBytes() error path 2013-08-16 16:47:30 +02:00
Ben Noordhuis 9475ee41ad crypto: don't mix new[] and free()
RandomBytes() allocated memory with new[] which was then handed off to
Buffer::Use() which eventually releases it again with free().

Mixing the two is technically a violation of the spec and besides, it's
generally frowned upon.
2013-08-16 16:47:08 +02:00
isaacs f73ee94d4f test: Remove hard-coded port 2013-08-15 17:39:28 -07:00
Brian White d70e6491ae cluster: variable is not global 2013-08-15 17:19:18 -07:00
Brian White e62d5964de buffer: remove unused parameters 2013-08-15 17:19:18 -07:00
Brian White 6d842897c5 lib: remove unused variables and functions 2013-08-15 17:19:17 -07:00
isaacs 1f9f863494 http: Prefer 'binary' over 'ascii'
It's faster, because it doesn't have to check that each char is in the
ASCII plane.
2013-08-15 15:05:41 -07:00
isaacs df23ce138f http: Simplify IncomingMessage._dump method 2013-08-15 15:05:41 -07:00
isaacs 7c9b607048 http: Consistent 'finish' event semantics
In other Writable streams, the 'finish' event means that all of the data
was written, and flushed to the underlying system.

The 'prefinish' event means that end() was called, and all of the data
was processed, but not necessarily completely flushed.

This change brings the http OutgoingMessage classes more in sync with
the other Writable classes throughout Node.

Unfortunately, this change highlights an issue with http
IncomingMessages, where the _dump() method will not actually pull the
data off the wire.  This is a minor issue that is typically only
relevant in test cases, and will be addressed in the next commit.
2013-08-15 15:05:41 -07:00
isaacs e3157972e1 http: make OutgoingMessage._flush inline-able 2013-08-15 15:05:41 -07:00
isaacs da93d6adfb http: Add write()/end() callbacks 2013-08-15 15:05:41 -07:00
isaacs ce3d18412c http: Write hex/base64 chunks properly
This removes a dubious performance "optimization" where strings body
chunks were concatenated to one another (and to the headers) without any
regard for their encoding.
2013-08-15 15:05:40 -07:00
isaacs 255650f4d9 http: Handle hex/base64 encodings properly
This is a backport of 6d3d60aced39d59eaa5e705b7d822c227d0d3dae for
v0.10.
2013-08-15 15:01:28 -07:00
isaacs 7304a620ec doc: http rawHeaders/rawTrailers 2013-08-15 14:12:12 -07:00
isaacs e6c81bd679 http: provide access to raw headers/trailers
The format is [key,value,key,value,...] because that seems to have the
lowest overhead.

Close #4844
2013-08-15 13:57:23 -07:00
isaacs 1eedbdc361 doc: http keepalive, agent options
Close #5839
2013-08-15 13:54:28 -07:00
isaacs 65f6f06a61 http: add agent.maxFreeSockets option 2013-08-15 13:54:28 -07:00
Ben Noordhuis a1ea8a27e6 test: update tests after internal api change
Commit 0aa1335 changes the way timeout events are dispatched. Update
two tests that still used the old way.
2013-08-15 22:20:15 +02:00
Trevor Norris ab5dabf876 node: remove duplicate infoBox checks
These checks are now done in C++ and don't need to also be checked in
JS. Also remove a couple unused variables.
2013-08-15 12:52:21 -07:00
Ben Noordhuis 0aa13357d6 timers: dispatch ontimeout callback by array index
Achieve a minor speed-up by looking up the timeout callback on the timer
object by using an array index rather than a named property.

Gives a performance boost of about 1% on the misc/timers benchmarks.
2013-08-15 19:33:34 +02:00
Ben Noordhuis 7a3f7780dc src: add MakeCallback() that takes an array index
Internal helper function for dispatching by array index rather than
named property.
2013-08-15 19:33:06 +02:00
Ben Noordhuis 9c59978f49 smalloc: don't do Has(key), then Get(key)
Don't check for the key first before retrieving it. Just fetch it and
check that it has the type we expect.
2013-08-15 16:47:54 +02:00
Ben Noordhuis 98c54246c2 tools: cpplint: fix NOLINT(build/include_order)
And build/include, build/include_alpha and readability/streams
probably too, though those are currently unused and therefore untested.
2013-08-15 14:21:41 +02:00
Ben Noordhuis dce02a1055 zlib: replace C cast with static_cast
Seems to have escaped the Eye of Sauron^WFedor in commit 8e29ce9.
2013-08-14 23:50:08 +02:00
Fedor Indutny c50750e1fd tls: handle errors on socket before releasing it
Fix sudden uncatchable ECONNRESETs, when using https server.
2013-08-14 21:10:32 +04:00
Ben Noordhuis 2669966e76 http: speed up callbacks, use array indices
Use array indices rather than named properties to store callbacks on
the HTTPParser object.  Speeds up the http benchmarks by a few percent.
2013-08-14 18:08:04 +02:00
Ben Noordhuis d684f50acb src: remove redundant symbol init in node_file.cc
Don't lazy-init the oncomplete symbol string in the After() function,
it has already been created at module init time.
2013-08-14 18:08:04 +02:00
Ben Noordhuis d2b80b8a60 src: clean up FSReqWrap
Move the 'free FSReqWrap data?' logic into the class itself.
2013-08-13 12:14:33 +02:00