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

2262 Commits

Author SHA1 Message Date
Ben Noordhuis
79ae8b7ae2 Merge remote-tracking branch 'origin/v0.8' 2012-12-20 12:39:04 +01:00
Ben Noordhuis
5a19c07c08 http: pack response body buffer in first tcp packet
Apply the same optimization to res.end(buf) that is applied to res.end(str).

Speeds up `node benchmark/http_simple_auto -k -c 1 -n 25000 buffer/1`
(non-chunked response body) by about 750x. That's not a typo.

Chunked responses:

  $ cat tmp/http-chunked-client.js
  // Run `node benchmark/http_simple` in another terminal.
  var http = require('http'), url = require('url');
  var options = url.parse('http://127.0.0.1:8000/buffer/1/1');
  options.agent = new http.Agent({ maxSockets: 1 });
  for (var i = 0; i < 25000; ++i) http.get(options);

Before:

  $ time out/Release/node tmp/http-chunked-client.js
  real    16m40.411s
  user    0m9.184s
  sys     0m0.604s

After:

  $ time out/Release/node tmp/http-chunked-client.js
  real    0m5.386s
  user    0m2.768s
  sys     0m0.728s

That's still a 185x speed-up.

Fixes #4415.
2012-12-20 12:02:06 +01:00
Farid Neshat
dcaebec208 fs: add autoClose=true option to fs.createReadStream 2012-12-20 11:25:39 +01:00
isaacs
9f4c0988c3 streams2: Process write buffer in a loop, not recursively
This fixes pummel/test-net-write-callbacks
2012-12-19 10:55:23 -08:00
isaacs
cab22644a5 net: Properly read buffer in Socket.bytesWritten 2012-12-19 10:55:23 -08:00
isaacs
f63af64eb8 test-pummel: Add call validation in net-write-callbacks 2012-12-19 10:55:23 -08:00
isaacs
82c7c84e25 net: Handle sync writable streams synchronously
This fixes the case where stderr doesn't flush before the process exits.
2012-12-17 15:08:57 -08:00
isaacs
6c5356bfe2 Revert "buffer: allocate memory with mmap()"
Also Revert "buffer: use MAP_ANON, fix OS X build"

This reverts commit ddb15603e7.
This reverts commit 2433ec8276.
2012-12-17 10:47:17 -08:00
Brian White
827b2a9b0b http: bubble up parser errors to ClientRequest
Make parser errors bubble up to the ClientRequest instead of the underlying
net.Socket object.

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

Fixes #3776.
2012-12-16 17:25:03 +01:00
Ben Noordhuis
2433ec8276 buffer: allocate memory with mmap()
Work around an issue with the glibc malloc() implementation where memory blocks
are never returned to the operating system when they are allocated with brk()
and have overlapping lifecycles.

Fixes #4283.
2012-12-16 10:19:09 +01:00
isaacs
3751c0fe40 streams2: Still emit error if there was a write() cb 2012-12-14 17:46:23 -08:00
isaacs
1d369317ea http: Refactor for streams2
Because of some of the peculiarities of http, this has a bit of special
magic to handle cases where the IncomingMessage would wait forever in a
paused state.

In the server, if you do not begin consuming the request body by the
time the response emits 'finish', then it will be flushed out.

In the client, if you do not add a 'response' handler onto the request,
then the response stream will be flushed out.
2012-12-14 17:46:23 -08:00
isaacs
81e356279d child_process: Remove stream.pause/resume calls
Unnecessary in streams2
2012-12-14 10:52:30 -08:00
isaacs
bb56dcc450 tty/stdin: Refactor for streams2 2012-12-14 10:52:30 -08:00
isaacs
8a3befa0c6 net: Refactor to use streams2
This is a combination of 6 commits.

* XXX net fixup lcase stream

* net: Refactor to use streams2

    Use 'socket.resume()' in many tests to trigger old-mode behavior.

* net: Call destroy() if shutdown() is not provided

    This is important for TTY wrap streams

* net: Call .end() in socket.destroySoon if necessary

    This makes the http 1.0 keepAlive test pass, also.

* net wtf-ish stuff kinda busted

* net fixup
2012-12-14 10:52:30 -08:00
isaacs
854171dc6f streams2: Remove extraneous bufferSize setting 2012-12-14 10:52:29 -08:00
isaacs
04541cf7bc streams2: Emit pause/resume events 2012-12-14 10:52:29 -08:00
isaacs
8fe7b0c910 streams2: Support a Readable hwm of 0
Necessary for proper stdin functioning
2012-12-14 10:52:29 -08:00
isaacs
5760244cc6 streams2: Writable only emit 'finish' once 2012-12-14 10:52:28 -08:00
isaacs
8f428f3b0d streams2: Call read(0) on resume()
Otherwise (especially with stdin) you sometimes end up in cases
where the high water mark is zero, and the current buffer is at 0,
and it doesn't need a readable event, so it never calls _read().
2012-12-14 10:52:28 -08:00
isaacs
fc7d8d59f7 lint 2012-12-14 10:52:28 -08:00
isaacs
dbcacc5afe streams2: NextTick the emit('readable') in resume()
Otherwise resume() will cause data to be emitted before it can be handled.
2012-12-14 10:52:28 -08:00
isaacs
99021b7a4f streams2: pause() should be immediate 2012-12-14 10:52:28 -08:00
isaacs
42981e2aad streams2: Switch to old-mode immediately, not nextTick
This fixes the CONNECT/Upgrade HTTP functionality, which was not getting
sliced properly, because readable wasn't emitted on this tick.

Conflicts:

	test/simple/test-http-connect.js
2012-12-14 10:52:28 -08:00
isaacs
83704f1279 streams2: Set readable=false on end 2012-12-14 10:52:27 -08:00
isaacs
dd3ebb8cf6 crypto: Streaming interface for Sign and Verify 2012-12-14 10:52:27 -08:00
isaacs
e336134658 crypto: Streaming interface for cipher/decipher/iv 2012-12-14 10:52:27 -08:00
isaacs
175f78c6ba crypto: Streaming api for Hmac 2012-12-14 10:52:27 -08:00
isaacs
90de2ddb77 crypto: Streaming interface for Hash 2012-12-14 10:52:26 -08:00
isaacs
0e01d6398f zlib: streams2 2012-12-14 10:52:26 -08:00
isaacs
44b308b1f7 fs: streams2 2012-12-14 10:52:26 -08:00
isaacs
d58f2654bc streams2: Unpipe on dest.emit('close') 2012-12-13 17:00:34 -08:00
isaacs
49ea653363 streams2: Remove pipe if the dest emits error 2012-12-13 17:00:34 -08:00
isaacs
ac5a185edf streams2: Handle pipeChunkSize properly 2012-12-13 17:00:33 -08:00
isaacs
53fa66d9f7 streams2: Set 'readable' flag on Readable streams 2012-12-13 17:00:33 -08:00
isaacs
4b4ff2dff1 streams2: Refactor out .once() usage from Readable.pipe() 2012-12-13 17:00:33 -08:00
isaacs
38e2b0053a streams2: Get rid of .once() usage in Readable.pipe
Significant performance impact
2012-12-13 17:00:33 -08:00
isaacs
b15e19a232 streams2: Remove function.bind() usage
It's too slow, unfortunately.
2012-12-13 17:00:32 -08:00
isaacs
2ff499c022 streams2: Do multipipe without always using forEach
The Array.forEach call is too expensive.
2012-12-13 17:00:32 -08:00
isaacs
0118584433 streams2: Writable organization, add 'finishing' flag 2012-12-13 17:00:31 -08:00
isaacs
286c54439a streams2: Only emit 'readable' when needed 2012-12-13 17:00:31 -08:00
isaacs
62dd04027b streams2: Set Readable lwm to 0 by default 2012-12-13 17:00:31 -08:00
isaacs
f20fd22abd streams2: Add high water mark for Readable
Also, organize the numeric settings a bit on the ReadableState class
2012-12-13 17:00:30 -08:00
isaacs
63ac07b32b streams2: Export Readable/Writable State classes 2012-12-13 17:00:30 -08:00
isaacs
5856823223 streams2: Fix duplex no-half-open logic 2012-12-13 17:00:29 -08:00
isaacs
286aa04910 streams2: Abstract out onread function 2012-12-13 17:00:29 -08:00
isaacs
f624ccb475 streams2: Use StringDecoder.end 2012-12-13 17:00:29 -08:00
isaacs
cf0b4ba410 streams2: flow() is not always bound to src 2012-12-13 17:00:28 -08:00
isaacs
e82d06bef9 streams2: Fix regression from Duplex ctor assignment 2012-12-13 17:00:28 -08:00
isaacs
71e2b61388 streams2: Support write(chunk,[encoding],[callback]) 2012-12-13 17:00:27 -08:00
isaacs
0678480b57 streams2: Allow Writables to opt out of pre-buffer-izing 2012-12-13 17:00:27 -08:00
isaacs
545f512619 streams2: ctor guards on Stream classes 2012-12-13 17:00:26 -08:00
isaacs
8acb416ad0 streams2: Handle immediate synthetic transforms properly 2012-12-13 17:00:26 -08:00
isaacs
06e321d0f9 streams2: Correct drain/return logic
It was testing the length *before* adding the current chunk, which
is the opposite of correct.

Also, the return value was flipped.
2012-12-13 17:00:25 -08:00
isaacs
02f017d24f streams2: Allow 0 as a lowWaterMark value 2012-12-13 17:00:25 -08:00
isaacs
caa853bb06 transform: Automatically read() on _write when read buffer is empty 2012-12-13 17:00:25 -08:00
isaacs
3b59fd70f4 streams2: Make Transform streams pull-style
That is, the transform is triggered by a _read, not by a _write.

This way, backpressure works properly.
2012-12-13 17:00:24 -08:00
isaacs
9b5abe5bfe streams2: setEncoding and abstract out endReadable 2012-12-13 17:00:24 -08:00
isaacs
51a52c43a2 streams2: Set flowing=true when flowing 2012-12-13 17:00:24 -08:00
isaacs
639fbe28d1 streams2: Convert strings to buffers before passing to _write() 2012-12-13 17:00:23 -08:00
isaacs
420e07c577 streams2: The new stream base classes 2012-12-13 17:00:23 -08:00
isaacs
17834ed28c Add 'stream' as a native module in repl 2012-12-13 17:00:23 -08:00
isaacs
314c6b3060 Don't allow invalid encodings in StringDecoder class 2012-12-13 17:00:22 -08:00
isaacs
77ed12fe7a Merge remote-tracking branch 'ry/v0.8' into master
Conflicts:
	AUTHORS
	ChangeLog
	deps/uv/test/test-spawn.c
	deps/uv/uv.gyp
	src/cares_wrap.cc
	src/node.cc
	src/node_version.h
	test/simple/test-buffer.js
	tools/gyp/pylib/gyp/common.py
	tools/install.py
2012-12-13 16:57:58 -08:00
Ben Noordhuis
d65832ccd0 fs: fix WriteStream fd leak
Close the file descriptor when a write operation fails.

Fixes #4387.
2012-12-12 09:46:22 +01:00
Ben Noordhuis
6e97b2cc17 fs: fix ReadStream fd leak
Close the file descriptor when a read operation fails.

Fixes #4387.
2012-12-12 09:46:22 +01:00
Ryunosuke SATO
0506d294dc events: fix typos in code comment
- newListeners -> newListener
2012-12-10 13:08:26 +01:00
Ryunosuke SATO
eb502205d5 events: setMaxListeners() should not have side effects
This object initialization has been unnecessary since 12cf730b.

Ref #3803.
2012-12-10 13:07:35 +01:00
Ryunosuke SATO
1c7acd2c84 events: use assigned variable instead of arguments
Always `arguments[0]` is used when `EventEmitter#emit` called.
Using assigned variable is faster than `arguments[0]`.
2012-12-10 13:04:46 +01:00
Ryunosuke SATO
0397223ab4 events: use null assignment instead of deleting property 2012-12-10 08:59:14 +01:00
Bert Belder
3c293ba272 http: protect against response splitting attacks 2012-12-07 17:13:51 -08:00
isaacs
0e95ea42ce lint
introduced in 5b65638.
2012-12-07 16:58:16 -08:00
isaacs
33fa740577 fs: Raise error when null bytes detected in paths
Reworking of @bnoordhuis's more aggressive approach.
2012-12-07 16:52:46 -08:00
Ben Noordhuis
5b65638124 tls, https: add tls handshake timeout
Don't allow connections to stall indefinitely if the SSL/TLS handshake does
not complete.

Adds a new tls.Server and https.Server configuration option, handshakeTimeout.

Fixes #4355.
2012-12-06 17:39:24 +01:00
Ben Noordhuis
1f76a2eddc fs: add long stacktrace debugging facility
Enable long stacktraces if NODE_DEBUG=fs is set in the environment. Only
applies to the default rethrow callback; it's to help you find places where
you forgot to pass in a callback.
2012-12-04 08:12:12 +01:00
Ben Noordhuis
a80434736b fs: fix 'object is not a function' callback errors
Use a default callback if the user omitted one. Avoids errors like the one
below:

  fs.js:777
      if (err) return callback(err);
                      ^
  TypeError: object is not a function
          at fs.appendFile (fs.js:777:21)
          at Object.oncomplete (fs.js:297:15)

This commit fixes the behavior of fs.lchmod(), fs.lchown() and fs.readFile()
when the callback is omitted. Before, they silently swallowed errors.

Fixes #4352.
2012-12-04 08:05:55 +01:00
Trevor Norris
6772308883 buffer: Don't double-negate numeric buffer arg
Fix #4331

Using double negate forces values into 32bit space. Because of this
Math.ceil needs to be used. Since NaN comparisons are always false, use
that to our advantage to return 0 if it is.

Also added two tests to verify the changes.
2012-11-30 16:23:49 -08:00
Joshua Erickson
c9f2531ae0 net: More accurate IP address validation and IPv6 dotted notation.
* Added isIP method to make use of inet_pton to cares_wrap.cc
* Modified net.isIP() to make use of new C++ isIP method.
* Added new tests to test-net-isip.js.

This is a back-port of commit fb6377e from the master branch.
2012-11-28 21:51:27 +01:00
Ben Noordhuis
121ed91331 tls: fix tls.connect() resource leak
The 'secureConnect' event listener was attached with .on(), which blocked it
from getting garbage collected. Use .once() instead.

Fixes #4308.
2012-11-26 01:51:05 +01:00
Ben Noordhuis
4cb17cb219 net: fix net.connect() resource leak
The 'connect' event listener was attached with .on(), which blocked it from
getting garbage collected. Use .once() instead.

Fixes #4308.
2012-11-24 15:27:14 +01:00
Scott Blomquist
f657ce685d windows: add tracing with performance counters
Patch by Henry Rawas and Scott Blomquist.
2012-11-21 01:21:53 +01:00
Bert Belder
bc9388342f windows: fix normalization of UNC paths 2012-11-21 01:21:25 +01:00
Ben Noordhuis
b6e989759b repl: don't interpret floating point numbers
Don't interpret floating point numbers, e.g. ".1234", as REPL commands.

Fixes #4268.
2012-11-10 18:21:17 +01:00
Trevor Norris
13c5db9771 buffer: remove duplicate assertion tests
Many assertion tests are duplicated in buffer.js. These few could be easily
removed and still have all tests pass.
2012-11-10 02:11:04 +01:00
Nathan Rajlich
5e4e87ade5 os: add os.endianness() function 2012-11-08 12:31:45 -08:00
Nathan Rajlich
3c91a7ae10 readline: use a "string_decoder" to parse "keypress" events
While updating the readline test cases to test both "terimal: false" and
"terminal: true" mode, it turned out that the test case testing utf8 chars
being sent over multiple write() calls was failing. The solution is to use
a string_decoder instance when parsing the "keypress" events.
2012-11-06 16:28:30 -08:00
Nathan Rajlich
e95e095289 readline: don't emit "line" events with a trailing '\n' char
Before this commit, readline was inconsistent in whether or not it would emit
"line" events with or without the trailing "\n" included. When "terminal"
mode was true, then there would be no "\n", when it was false, then the "\n"
would be present. However, the trailing "\n" doesn't add much, and most of the
time people just end up stripping it manually.

Part of #4243.
2012-11-06 16:28:24 -08:00
Joshua Erickson
fb6377ebd0 net: More accurate IP address validation and IPv6 dotted notation.
* Added isIP method to make use of inet_pton to cares_wrap.cc
* Modified net.isIP() to make use of new C++ isIP method.
* Added new tests to test-net-isip.js.
2012-11-06 16:49:21 +01:00
Fedor Indutny
05882668f9 debugger: exit and kill child on SIGTERM or SIGHUP 2012-11-04 01:34:46 +01:00
Girish Ramakrishnan
2f03eaf76f doc: tls: rejectUnauthorized defaults to true after 35607f3a 2012-11-01 16:16:27 +01:00
isaacs
07d3b21f43 zlib: s/clear/close/ and match other close() semantics 2012-10-31 16:56:30 -07:00
J. Lee Coltrane
54d293da56 url: make url.format escape delimiters in path and query
`url.format` should escape ? and # chars in pathname, and # chars in
search, because they change the semantics of the operation otherwise.
Don't escape % chars, or anything else. (see: #4082)
2012-10-30 09:16:13 -07:00
Brandon Philips
19b87bbda0 tls: delete useless removeListener call
onclose was never attached to 'end' so this call to remove this listener
is useless.  Delete it.
2012-10-30 16:58:07 +01:00
Ben Noordhuis
570e4be932 zlib: reduce memory consumption, release early
In zlibBuffer(), don't wait for the garbage collector to reclaim the zlib memory
but release it manually. Reduces memory consumption by a factor of 10 or more
with some workloads.

Test case:

  function f() {
    require('zlib').deflate('xxx', g);
  }
  function g() {
    setTimeout(f, 5);
  }
  f();

Observe RSS memory usage with and without this commit. After 10,000 iterations,
RSS stabilizes at ~35 MB with this commit. Without, RSS is over 300 MB and keeps
growing.

Cause: whenever the JS object heap hits the high-water mark, the V8 GC sweeps
it clean, then tries to grow it in order to avoid more sweeps in the near
future. Rule of thumb: the bigger the JS heap, the lazier the GC can be.

A side effect of a bigger heap is that objects now live longer. This is harmless
in general but it affects zlib context objects because those are tied to large
buffers that live outside the JS heap, on the order of 16K per context object.

Ergo, don't wait for the GC to reclaim the memory - it may take a long time.

Fixes #4172.
2012-10-30 15:03:17 +01:00
isaacs
45a13d9674 events: Don't clobber pre-existing _events obj in EE ctor 2012-10-25 13:37:08 -07:00
isaacs
c7b2e29e5e events: Make the EventEmitter class monomorphic
Always add domain, _events, and _maxListeners properties, set to the
default values at first.

Leads to a very very slight perf improvement when using setMaxListeners,
or dealing with a lot of EE objects that don't have any listeners.
2012-10-25 07:51:05 -07:00
Ben Noordhuis
9b61f570d8 Merge remote-tracking branch 'origin/v0.8'
Conflicts:
	configure
	deps/v8/build/common.gypi
2012-10-25 16:08:58 +02:00
Ben Noordhuis
de0303d3ad url: parse hostnames that start with - or _
Allow hostnames like '-lovemonsterz.tumblr.com' and '_jabber._tcp.google.com'.

Fixes #4177.
2012-10-25 01:06:00 +02:00
Bert Belder
f34f1e30a6 repl: call resume() after setRawMode()
Solves #4178, but does not fix the underlying issue
2012-10-24 02:52:18 +02:00
Bert Belder
6822488c93 repl: call resume() after setRawMode()
Solves #4178, but does not fix the underlying issue
2012-10-24 02:42:57 +02:00
isaacs
d7da20c812 crypto: pbkdf2 throws when no callback provided 2012-10-23 10:48:51 -07:00
isaacs
c87b524c5f crypto: Clean up buffer handling and DH methods 2012-10-23 10:48:51 -07:00
isaacs
76b0bdf720 crypto: Add crypto.DEFAULT_ENCODING (defaults to 'buffer')
This is a flag to make it easier for users to upgrade through the
breaking crypto change, and easier for us to switch it back if it's a
problem.

Explicitly set default encoding to 'buffer' in other tests, in case it
ever changes back.
2012-10-23 10:48:51 -07:00
isaacs
4266f5cf2e tls: Provide buffer to Connection.setSession 2012-10-23 10:48:50 -07:00
isaacs
bfb9d5bbe6 crypto: Binding only accepts buffers 2012-10-23 10:48:50 -07:00
isaacs
9901b69c8e crypto: Move encoding logic to JS, default=buffer
crypto: Hash and Hmac default to buffers

crypto: Move Cipher encoding logic to JS

crypto: Move Cipheriv encoding logic to JS

crypto: Move Decipher encoding logic to JS

crypto: Move Decipheriv into JS, default to buffers

crypto: Move Sign class to JS

crypto: Better encoding handling in Hash.update

crypto: Move Verify class to JS

crypto: Move DiffieHellman to JS, default to buffers

crypto: Move DiffieHellmanGroup to JS, default to buffers

Also, create a test for this feature
2012-10-23 10:22:42 -07:00
Soarez
72ce9baa75 streams: remove useless line
The removed line was removing a calllback that was never setup
in first place. 016afe2 forgot to remove this.
2012-10-21 22:58:14 +02:00
Nathan Rajlich
4b238b4c2a Merge remote-tracking branch 'origin/v0.8'
Conflicts:
	AUTHORS
	ChangeLog
	deps/uv/test/runner-win.c
	doc/api/process.markdown
	lib/repl.js
	src/node_crypto.cc
	src/node_version.h
2012-10-13 16:16:56 -07:00
Ben Noordhuis
2fbf0612a1 crypto: sort return value of getCiphers/getHashes 2012-10-13 02:55:17 +02:00
Ben Noordhuis
14a6c4efb8 crypto: add crypto.getHashes() 2012-10-13 02:55:14 +02:00
Ben Noordhuis
f53441ab1f crypto: add crypto.getCiphers()
Returns a list of, unsurprisingly, the available ciphers.
2012-10-13 01:49:57 +02:00
Nathan Rajlich
b1e78cef09 repl: ensure each REPL instance gets its own "context"
Before there was this weird module-scoped "context" variable which seemingly
shared the "context" of subsequent REPL instances, unless ".clear" was invoked
inside the REPL. To be proper, we need to ensure that each REPL gets its own
"context" object. I literally don't know why this "sharing" behavior was in place
before, but it was just plain wrong.
2012-10-12 16:37:17 -07:00
Ben Noordhuis
61978f57e6 dgram: remove stale code 2012-10-13 01:27:15 +02:00
isaacs
8509073458 lint 2012-10-12 11:46:36 -07:00
isaacs
061f2075cf string_decoder: Add 'end' method, do base64 properly 2012-10-11 16:46:18 -07:00
Nathan Rajlich
4eb5399bb2 util: add a "customInspect" option to util.inspect()
For disabling calling the custom `inspect()` function when defined on an object
that is being inspected.
2012-10-10 14:40:36 -07:00
Nathan Rajlich
07774e6b95 util: make inspect() accept an "options" argument
Consolidates all the formatting options into an "options" object argument.
This is so that we don't have to be constantly remembering the order of
the arguments and so that we can add more formatting options easily.

Closes #4085.
2012-10-10 13:31:47 -07:00
Ben Noordhuis
0ad005852c https: fix renegotation attack protection
Listen for the 'clientError' event that is emitted when a renegotation attack
is detected and close the connection.

Fixes test/pummel/test-https-ci-reneg-attack.js
2012-10-09 16:38:00 +02:00
Ben Noordhuis
7394e89ff6 tls: remove dead code
Remove dead code. Forgotten in 76ddf06.
2012-10-09 16:32:51 +02:00
Aaditya Bhatia
c668185add cluster: make 'listening' handler see actual port
Make the 'listening' event handler in the master process see the actual port
that the worker bound to when the worker specified port 0, i.e. a random port.
2012-10-09 16:23:24 +02:00
Ricky Ng-Adam
8bd4590a31 buffer: include encoding value in exception when invalid
Encoding failures can be somewhat confusing, especially when they are due to
control flow frameworks auto-filling parameters from the previous step output
values to functions (such as toString and write) that developers don't expect
to take an encoding parameter. By outputting the value as part of the message,
should make it easier to track down these sort of bugs.
2012-10-09 16:18:26 +02:00
Bert Belder
5288ed75be windows: use USERPROFILE to get the user's home dir
Fixes #3461
Close #3462
Close #4093
2012-10-09 00:47:38 +02:00
Ben Noordhuis
76ddf06f10 tls: don't use a timer to track renegotiations
It makes tls.createSecurePair(null, true) hang until the timer expires.

Using a timer here is silly. Use a timestamp instead.
2012-10-08 02:23:46 +02:00
Nathan Rajlich
7611c7cd25 repl: dynamically lookup the require extensions for tab complete
Removes 2 TODO items
2012-10-07 11:33:33 -07:00
Nathan Rajlich
59c166cfba repl: move "isSyntaxError()" definition to the bottom
fixes lint "line length too long" error
2012-10-05 18:33:28 -07:00
isaacs
836a06fc4f Revert "http: make http.ServerResponse emit 'end'"
This reverts commit 790d651f0d.

This makes Duplex streams unworkable, and would only ever be a special
case for HTTP responses, which is not ideal.

Intead, we're going to just bless the 'finish' event for all Writable
streams in 0.10
2012-10-03 17:40:14 -07:00
koichik
016afe21ae streams: fix pipe is destructed by 'end' from destination 2012-10-03 10:57:31 -07:00
Paul Serby
41e53e5579 path: add platform specific path delimiter
Closes #3728
Closes #4071
2012-10-01 22:10:36 +02:00
Nathan Rajlich
3b7312d23a repl: make "end of input" JSON.parse() errors throw in the REPL 2012-10-01 11:36:06 -07:00
Nathan Rajlich
f1722a280c repl: make invalid RegExp modifiers throw in the REPL
Fixes #4012.
2012-09-30 22:47:57 -07:00
isaacs
ae40f1c438 Merge remote-tracking branch 'ry/v0.8' into v0.8-merge
Conflicts:
	AUTHORS
	ChangeLog
	deps/openssl/openssl.gyp
	deps/uv/src/unix/linux/linux-core.c
	deps/uv/src/unix/process.c
	deps/uv/src/unix/stream.c
	deps/v8/src/arm/builtins-arm.cc
	deps/v8/src/arm/code-stubs-arm.cc
	deps/v8/src/arm/full-codegen-arm.cc
	lib/tls.js
	src/node_version.h
	test/simple/test-http-client-timeout-agent.js
2012-09-28 09:47:48 -07:00
Fedor Indutny
d68c02e3fe debugger: test repeating last command
* debugger: Add NODE_FORCE_READLINE environment variable, handle
 `SIGINT`'s sent to process while in this mode.
2012-09-28 10:58:50 +04:00
Alex Kocharin
8ac1a73635 Fixed a bug with last command repeating in debugger 2012-09-28 10:21:37 +04:00
Pavel Lang
b38277be26 http: add response.headersSent property
Boolean property getter. True if headers was sent, false otherwise.
2012-09-28 02:57:01 +02:00
thewilli
33a5c8a814 http: handle multiple Proxy-Authenticate values
Just as the 'WWW-Authenticate' HTTP header the 'Proxy-Authenticate' header might
be received several times as well. Currently only one value is preserved. This
change allows to receive multiple values concatenated by space and comma.
2012-09-27 13:28:16 -07:00
thewilli
ac17dc1764 http: handle multiple Proxy-Authenticate values
Just as the 'WWW-Authenticate' HTTP header the 'Proxy-Authenticate' header might
be received several times as well. Currently only one value is preserved. This
change allows to receive multiple values concatenated by space and comma.
2012-09-27 01:11:00 +02:00
isaacs
411d46087f tls: lint
cc @indutny >_<
2012-09-25 11:09:39 -07:00
isaacs
2a9a5e2318 domain: Remove stray console.log 2012-09-25 11:08:52 -07:00
Fedor Indutny
7651228ab2 tls: use slab allocator 2012-09-25 08:37:08 -07:00
Nathan Rajlich
0f2ed2bc2c http: make the client "res" object gets the same domain as "req"
Fixes #4046.
2012-09-24 11:48:39 -07:00
Nathan Rajlich
4a2670740c repl: make invalid RegExps throw in the REPL
Fixes #2746.
2012-09-21 19:49:29 -07:00
Andreas Madsen
5070eccf1b child_process: don't die when disconnect event exists 2012-09-22 03:49:17 +02:00
Ben Noordhuis
212466bea2 child_process: make .fork()'d child auto-exit
A child process created with .fork() needed to call `process.exit()` explicitly
because the communication channel with the parent kept the event loop alive.

Fix that by only ref'ing the channel when there are 'message' event listeners.

Fixes #3799.
2012-09-22 03:48:59 +02:00
Ben Noordhuis
56668f54d1 events: speed up .removeAllListeners() 2012-09-22 03:48:59 +02:00
Ben Noordhuis
b7fd55e9a0 events: speed up newListener/removeListener events 2012-09-22 03:48:59 +02:00
Ben Noordhuis
84221fd1d6 events: add 'removeListener' event 2012-09-22 03:48:59 +02:00
isaacs
0400571676 domain: Properly exit() on domain disposal
This addresses #4034.  There are two problems happening:

1. The domain is not exited automatically when calling dispose() on it.
Then, since the domain is disposed, attempting to exit it again will do
nothing.

2. The active domain is stored on process.domain.  Since thrown errors
call `process.emit('uncaughtException', er)`, and the process is an
event emitter with a `.domain` member, it re-enters the domain a second
time before calling the error handler, pushing it onto the stack again.

Thus, if the handler calls `domain.dispose()`, then the domain is now on
the stack twice, and cannot be exited properly.  Since the domain is
disposed, any subsequent IO will be no-op'ed, since we've declared that
this context is done and best forgotten.

The solution here is twofold:

1. In EventEmitter.emit, do not enter the domain if `this===process`.
2. Automatically exit the domain when calling `domain.dispose()`.
2012-09-21 09:22:50 -07:00
tasogarepg
21c4b9a9eb debugger: fix --debug-brk 2012-09-18 10:56:37 +04:00
isaacs
7144be70db url: Go much faster by using Url class
V8 loves it when JavaScript pretends to be a Classic inheritance
type of language.

Before:

$ ./node benchmark/url.js
benchmarking parse() ... 1.868 sec
benchmarking format() ... 1.906 sec
benchmarking resolve("../foo/bar?baz=boom") ... 7.800 sec
benchmarking resolve("foo/bar") ... 7.099 sec
benchmarking resolve("http://nodejs.org") ... 8.403 sec
benchmarking resolve("./foo/bar?baz") ... 7.974 sec

After:

$ ./node benchmark/url.js
benchmarking parse() ... 1.769 sec
benchmarking format() ... 1.793 sec
benchmarking resolve("../foo/bar?baz=boom") ... 4.254 sec
benchmarking resolve("foo/bar") ... 3.932 sec
benchmarking resolve("http://nodejs.org") ... 4.382 sec
benchmarking resolve("./foo/bar?baz") ... 4.293 sec
2012-09-17 10:44:23 -07:00
Ben Noordhuis
39a0836d5c fs: fix watchFile() missing deletion events
Make sure the deletion event gets reported in the following scenario:

  1. Watch a file.
  2. The initial stat() goes okay.
  3. Something deletes the watched file.
  4. The second stat() fails with ENOENT.

The second stat() translates into the first 'change' event but a logic error
stopped it from getting emitted.

Fixes #4027.
2012-09-17 17:52:50 +02:00