0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
Commit Graph

8124 Commits

Author SHA1 Message Date
isaacs
327b6e3e1d stream: Don't emit 'end' unless read() called
This solves the problem of calling `readable.pipe(writable)` after the
readable stream has already emitted 'end', as often is the case when
writing simple HTTP proxies.

The spirit of streams2 is that things will work properly, even if you
don't set them up right away on the first tick.

This approach breaks down, however, because pipe()ing from an ended
readable will just do nothing.  No more data will ever arrive, and the
writable will hang open forever never being ended.

However, that does not solve the case of adding a `on('end')` listener
after the stream has received the EOF chunk, if it was the first chunk
received (and thus, length was 0, and 'end' got emitted).  So, with
this, we defer the 'end' event emission until the read() function is
called.

Also, in pipe(), if the source has emitted 'end' already, we call the
cleanup/onend function on nextTick.  Piping from an already-ended stream
is thus the same as piping from a stream that is in the process of
ending.

Updates many tests that were relying on 'end' coming immediately, even
though they never read() from the req.

Fix #4942
2013-03-10 11:08:22 -07:00
isaacs
cd2b9f542c stream: Avoid nextTick warning filling read buffer
In the function that pre-emptively fills the Readable queue, it relies
on a recursion through:

stream.push(chunk) ->
maybeReadMore(stream, state) ->
  if (not reading more and < hwm) stream.read(0) ->
stream._read() ->
stream.push(chunk) -> repeat.

Since this was only calling read() a single time, and then relying on a
future nextTick to collect more data, it ends up causing a nextTick
recursion error (and potentially a RangeError, even) if you have a very
high highWaterMark, and are getting very small chunks pushed
synchronously in _read (as happens with TLS, or many simple test
streams).

This change implements a new approach, so that read(0) is called
repeatedly as long as it is effective (that is, the length keeps
increasing), and thus quickly fills up the buffer for streams such as
these, without any stacks overflowing.
2013-03-10 11:04:48 -07:00
Julian Gruber
738347b904 events: Handle missing error obj when domains in use
so `ee.emit('error')` doesn't throw when domains are active

create an empty error only when handled by a domain

test for when no error is provided to an error event
2013-03-10 09:53:24 -07:00
koichik
c9a4ec9c63 http: ServerRequest does not timeout after 'end'
Fixes #4967
2013-03-10 20:14:43 +09:00
isaacs
e2400f88d8 http: Do not setTimeout a not-yet-existent socket
Fixes #4967
2013-03-10 18:34:41 +09:00
isaacs
21a99664ae uv: Upgrade to 5462dab 2013-03-09 18:34:59 -08:00
isaacs
12713c3bb7 win/msi: Fix typos 2013-03-09 09:22:00 -08:00
isaacs
31b5d41f57 npm: Upgrade to 1.2.14 (fixed) 2013-03-09 09:11:22 -08:00
hc
5757ce48b4 http: check if incoming parser has already been freed
Fix #4948

This adds a check before setting the incoming parser
to null. Under certain circumstances it'll already be set to
null by freeParser().

Otherwise this will cause node to crash as it tries to set
null on something that is already null.
2013-03-09 08:46:44 -08:00
Andreas Madsen
7becf156a9 timers: consistent this keyword in setImmediate
When calling setImmediate with extra arguments the this keyword in the
callback would refer to the global object, but when not calling
setImmediate with extra arguments this would refer to the returned
handle object.

This commit fixes that inconsistency so its always set handle object.
The handle object was chosen for performance reasons.
2013-03-09 08:19:57 -08:00
isaacs
80472bc301 domain: Fix double-exit on nested domains
Minor oversight in fix for #4953.
2013-03-09 07:00:21 -08:00
isaacs
4d1e9e5370 Now working on 0.10.0 2013-03-08 21:52:09 -08:00
isaacs
7c9ff8e94a lint 2013-03-08 20:26:26 -08:00
Gil Pedersen
77a776da90 stream: Always defer preemptive reading to improve latency 2013-03-08 20:09:21 -08:00
isaacs
061a7ddbff Merge remote-tracking branch 'ry/v0.8' into master
Conflicts:
	AUTHORS
	ChangeLog
	src/node_version.h
2013-03-08 18:59:44 -08:00
isaacs
6e34dfd9e8 test: Fail faster in simple/test-cluster-bind-twice-v2
Crashing on windows, but at least now it's a crash rathert han a timeout.
2013-03-08 18:56:32 -08:00
isaacs
98c6a81771 test: Kill zombies when debugger-client fails on windows 2013-03-08 18:56:32 -08:00
isaacs
8cf2d4c2c1 test: Don't run async operation in process 'exit'
Also, this seems to occasionally cause some annoying file-locking
errors in Windows.  Not sure if this is the best fix, but it seems
to make the warnings go away in that spot.
2013-03-08 18:56:31 -08:00
isaacs
f5c293b5ed test: Use copy instead of symlink in child-process-fork-exec-path 2013-03-08 18:56:31 -08:00
isaacs
9826159bf1 test: Trim cat output for windows 2013-03-08 18:56:31 -08:00
isaacs
99a2059e40 test: Sending dgram sockets to child procs not supported on windows 2013-03-08 18:56:31 -08:00
isaacs
6076a25e80 core: Append filename properly in dlopen on windows
Fixes simple/test-module-loading on win32
2013-03-08 18:56:31 -08:00
isaacs
08f5db112f test: Make stream2-transform less timing-dependent 2013-03-08 18:56:31 -08:00
isaacs
6d593a9026 test: Don't fail tls-session-cache if openssl is bad 2013-03-08 18:56:31 -08:00
isaacs
b3cbb16f41 zlib: Manage flush flags appropriately
If you call z.flush();z.write('foo'); then it would try to write 'foo'
before the flush was done, triggering an assertion in the zlib binding.

Closes #4950
2013-03-08 18:56:31 -08:00
isaacs
29cd0f2a77 domains: Handle errors thrown in nested error handlers
If a domain error handler throws, it should be caught if it was
in a stack of nested domains.

Fix #4953
2013-03-08 14:46:58 -08:00
Ben Noordhuis
e325ace53c buffer: speed up ascii character scanning
Speed up ASCII character scanning and conversion by 25% to 30% by scanning and
converting whole words instead of individual bytes.
2013-03-08 14:42:15 -08:00
Ben Noordhuis
96a314b68b buffer: strip high bits when converting to ascii
Consider the following example:

  console.log(Buffer('ú').toString('ascii'));

Before this commit, the contents of the buffer was used as-is and hence it
prints 'ú'.

Now, it prints 'C:'. Perhaps not much of an improvement but it conforms to what
the documentation says it does: strip off the high bits.

Fixes #4371.
2013-03-08 14:42:15 -08:00
isaacs
632b7d8750 Revert "http: check if incoming parser has already been freed"
This reverts commit 9f4c3b0d45.
2013-03-08 14:35:00 -08:00
hheennrryy@gmail.com
9f4c3b0d45 http: check if incoming parser has already been freed
Fix #4948

This adds a check before setting the incoming parser
to null. Under certain circumstances it'll already be set to
null by freeParser().

Otherwise this will cause node to crash as it tries to set
null on something that is already null.
2013-03-08 14:14:58 -08:00
isaacs
ea30ca9533 doc: Add wrk's license to LICENSE file 2013-03-08 13:47:36 -08:00
Bert Belder
3c22c42519 win/msi: enable modify and repair 2013-03-08 18:00:41 +01:00
Bert Belder
fa1efa3675 win/msi: miscellaneous style cleanups 2013-03-08 18:00:40 +01:00
Bert Belder
4147680d59 win/msi: don't include architecture in start menu group name 2013-03-08 18:00:40 +01:00
Bert Belder
8365a56541 win/msi: update 'install finished' message 2013-03-08 18:00:39 +01:00
Bert Belder
952d6c5e4c win/msi: clean up the 'documentation shortcuts' feature 2013-03-08 18:00:39 +01:00
Bert Belder
fb6253209e win/msi: refactor 'node.js runtime' feature
* This feature now includes the start menu items.
* 'nodejsvars.bat' was renamed to 'nodevars.bat'.
* Improved feature description.
2013-03-08 18:00:38 +01:00
Bert Belder
2320ffbdff win/msi: make 'add to path' a separate feature 2013-03-08 18:00:37 +01:00
Bert Belder
5e832ac7b9 win/msi: separate features for ETW and perfctr support 2013-03-08 18:00:37 +01:00
Bert Belder
51e3a59946 win/msi: make npm a feature separate from the runtime 2013-03-08 18:00:36 +01:00
Bert Belder
4348241bcc win/msi: use consistent registry key paths 2013-03-08 18:00:36 +01:00
Bert Belder
0604d9ab93 win/msi: don't create empty npm folder in %appdata%
Npm creates this folder when it's needed. Creating it in the installer
violates the per-user / per-machine scope separation.
2013-03-08 18:00:35 +01:00
Bert Belder
8542c9afba win/msi: don't install pdb file
It's only available in debug builds, and we're not providing
installer packages for debug builds anyway.
2013-03-08 18:00:35 +01:00
Bert Belder
7514779388 win/msi: define features before directories/components 2013-03-08 18:00:34 +01:00
Bert Belder
52f7a14aaf win: make nodejsvars.bat detect whether npm is available 2013-03-08 18:00:34 +01:00
isaacs
90368770e6 stream: Emit error on stream object, not global
Apparently this function got abstracted out at some point, and 'this'
wasn't changed to the correct object.
2013-03-08 07:35:41 -08:00
Bert Belder
d5959c5cea Revert "build, windows: disable SEH"
This is no longer necessary - the underlying issue was fixed in 01fa5ee.
This reverts commit d879042860.
2013-03-08 12:43:58 +01:00
Bert Belder
3446157269 win/openssl: mark assembled object files as seh safe
There are no unsafe structured exception handlers in object files
generated from hand-crafted assembly - because they contain no exception
handlers at all.
2013-03-08 12:43:57 +01:00
Raymond Feng
95871ac1db windows/msi: fix msi build issue with WiX 3.7/3.8
The `heat` tool that gathers NPM source files wasn't getting called.
Closes #4896
2013-03-08 12:38:13 +01:00
isaacs
4b47bb4dbc uv: Upgrade to b68ee40 2013-03-07 18:17:28 -08:00