0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-30 07:27:22 +01:00
Commit Graph

157 Commits

Author SHA1 Message Date
Ryan Dahl
f623fd7658 Normalize HTTP headers.
"Content-Length" becomes "content-length".
2009-10-07 16:56:19 +02:00
Ryan Dahl
b76d853f0d Fix test-signal-handler.js on macintosh - pause before exit. 2009-10-07 15:39:39 +02:00
Felix Geisendörfer
abbc624f52 Multipart test now uses a fixture instead of CURL 2009-10-07 02:03:24 +02:00
Brandon Beacher
f068251494 Added signal handler.
To be used internally. Needs an exposed interface.
2009-10-07 01:23:29 +02:00
Ryan Dahl
82465fc4b1 Do not use /bin/sh to create child processes.
Instead directly call execvp(). This change is needed for the
soon-to-be-added signal handlers because the /bin/sh parent process does not
pass all signals to it's children, particularly SIGUSR1 on Linux.

The parameters of createChildProcess had to be changed slightly.
utils.exec() also has a changed implementation. A bug involving quoted
arguments was knowingly introduced into utils.exec(). Will fix later.
2009-10-07 01:08:33 +02:00
Ryan Dahl
8185e1fd25 Remove include() add node.mixin()
include() should not be used by libraries because it will pollute the global
namespace. To discourage this behavior and bring Node more in-line with
the current CommonJS module system, include() is removed.

Small scripts like unit tests often times do want to pollute the global
namespace for ease. To avoid the boiler plate code of

  var x = require("/x.js");
  var foo = x.foo;
  var bar = x.bar;

The function node.mixin() is stolen from jQuery's jQuery.extend. So that it
can be written:

  node.mixin(require("/x.js"));

Reference:
http://docs.jquery.com/Utilities/jQuery.extend
http://groups.google.com/group/nodejs/browse_thread/thread/f9ac83e5c11e7e87
2009-10-05 15:46:31 +02:00
Ryan Dahl
522909bcbf Parse queryString into req.uri.params 2009-10-05 14:52:26 +02:00
Ryan Dahl
a8c0211e73 Bugfix: require() and include() should work in callbacks.
Removing requireAsync and includeAsync from global scope for now as a
temporary fix.  Reported by Yuffster.
2009-09-29 19:28:54 +02:00
Ryan Dahl
095470854b Move tcp library to /tcp.js 2009-09-28 18:48:18 +02:00
Ryan Dahl
f6657c3c9d Move http library to /http.js 2009-09-28 12:36:36 +02:00
Ryan Dahl
7abad8b7b3 API: Move node.puts(), node.exec() and others to /utils.js 2009-09-28 12:06:30 +02:00
Felix Geisendörfer
27c750154e Multipart stream parser 2009-09-27 16:58:56 +02:00
Ryan Dahl
106287c368 Tighten window on timer test. 2009-09-23 16:40:04 +02:00
Ryan Dahl
e0ec0036ca Add connection.setNoDelay() to disable Nagle algorithm. 2009-09-23 15:36:34 +02:00
Ryan Dahl
07792afe0a Remove "raw" encoding. Rename "raws" to "binary".
Deprecation warnings have been added to help the conversion to this new API.
2009-09-21 12:27:22 +02:00
Ryan Dahl
cd70d4a9c0 Add "/file.js" buffered disk I/O object.
This is similar to the class node.File which was removed in
82cb1b5acb.

Needs documentation.
2009-09-20 20:42:23 +02:00
Ryan Dahl
4b8f503fac Move mjsunit.js to system module directory. 2009-09-20 18:19:33 +02:00
Ryan Dahl
c8b143bf30 Absolute path names for require() refer to node.libraryPaths 2009-09-19 17:21:12 +02:00
Jon Crosby
e57c16bc2d Add failing spec for node.fs.write 2009-09-17 14:58:01 +02:00
Ryan Dahl
083d150bc4 Add node.exec() 2009-09-15 15:42:16 +02:00
Ryan
dbe116ddfe API: Change arguments of emit(), emitSuccess(), emitError()
Instead of

  myemitter.emit("event", [arg1, arg2, arg3]);

the API is now

  myemitter.emit("event", arg1, arg2, arg3);

This change saves the creation of an extra array object for each event.
The implementation is also slightly more simple.
2009-09-12 14:21:37 +02:00
Ryan
241950c1df Add isDirectory(), isFile(), isSocket(), ... methods to stats object.
Thanks to Felix Geisendörfer for the initial patch.
2009-09-11 13:41:47 +02:00
Ryan
8890070b88 Introduce "raws" encoding. Raw String.
This allows you to have binary data imported into your application via
strings instead of arrays of numbers! This needs testing before release.
2009-09-09 17:22:20 +02:00
Ryan
1a2696f10a Almost completely remove onExit and onLoad.
They were deprecated in 723c7d9f7c and
31265be4a6.

Still retaining error message.
2009-09-07 14:45:48 +02:00
Ryan
9dbd92476e Bugfix: Trap exceptions in URIParser.
A user was able to crash chat.tinyclouds.org by sending it a malformed URL!
Not good.
2009-09-04 17:42:00 +02:00
Ryan
1bd5277233 Add test-mkdir-rmdir.js 2009-09-04 11:46:31 +02:00
Ryan
b6eed30379 Sort files in readdir test. 2009-09-03 21:59:31 +02:00
Ryan
9b3e2ae192 Add node.fs.readdir() 2009-09-03 21:32:27 +02:00
Ryan
aefbd57514 Add stack to promise.wait().
The problem was that if promise A was waiting and promise B was created and
then also told to wait (from some callback coming off the event loop), and
then promise A finished, promise B's wait would return. Promise A's wait
would not return until promise B was finished. This is incorrect.

To solve this issue properly, one probably needs to allocate separate
execution stacks. I use, instead, Poor Man's Coroutines. We continue to use
the main execution stack and force promises created most recently to return
first.

That is even if Promise A finishes first, neither wait() returns. Not until
Promise B finishes, will its wait() return. After that is complete, Promise
A's wait() will return.

This introduces the problem of growing the "wait stack" infinitely. Thus
I've added a strong warning to the documentation only to use this operation
sparingly. require() and include() seem to be the proper use case for such a
thing: they are called usually at program start up - they don't take too
long to finish and they won't be called so often.

Let's experiment with this stop-gap. If the infinite promise stack becomes a
problem for many, then I will remove promise.wait() entirely or perhaps only
use it for thread pool events.
2009-09-03 10:48:39 +02:00
Ryan
afd9e714d3 Stack traces for mjsunit errors, better error reporting function.
The error reporting function tries to look at the "stack" element of the
exception.
2009-08-31 18:42:50 +02:00
Ryan
7beea2cd5f Upgrade evcom; Add setTimeout method to node.tcp.Connection
The default timeout is 60 seconds, but it can now be changed.

evcom upgrade includes fixes to force_close.
2009-08-31 18:26:50 +02:00
Ryan
ad9d683f9f API: rename node.Process to node.ChildProcess
This is to avoid confusion with the global "process" object, especially for
the instances of node.Process.
2009-08-26 22:36:45 +02:00
Ryan
116f4dea05 lint 2009-08-26 22:14:45 +02:00
Ryan
723c7d9f7c Replace onExit() with process.addListener("exit")
- Update documentation.

- Depreciation message for onExit().
2009-08-26 22:14:44 +02:00
Ryan
31265be4a6 Depreciate onLoad 2009-08-26 22:14:44 +02:00
Ryan
18d0511777 promise.block() renamed to promise.wait()
promise.wait() now returns the arguments of the "success" event.  If there
was only a single argument, then it is returned.  If there was more than
one, they are returned as an array.  If there was an error, it is thrown.
See documentation.
2009-08-26 17:28:49 +02:00
Ryan
db42ad959d API: All EventEmitters emit "newListener" when listeners are added.
The "newListener" event will also be emitted for listeners to "newListener".
Maybe useful?
2009-08-25 17:28:06 +02:00
Ryan
19f182a39f Experimental support for Promise.block() 2009-08-25 04:25:35 +02:00
Ryan
82cb1b5acb API: Remove buffered file object (node.File)
With the addition of non-libeio stdio (17c6a67f15)
this class is no longer being used internally. It has proved buggy and isn't
full-featured enough to be very useful.  Since it's implemented entirely in
javascript it will be easy for someone to extra into their own library if
needed.
2009-08-25 01:18:44 +02:00
Ryan
8658999c7d Refactor node.Process to take advantage of evcom_reader/writer. 2009-08-25 01:06:49 +02:00
Ryan
17c6a67f15 Introduce node.stdio
Remove old stdout, stderr, stdin objects.
2009-08-24 21:20:26 +02:00
Ryan
0727fcc9ed Speed up test-tcp-throttle.js 2009-08-24 21:11:02 +02:00
Ryan
316e2833f0 Use flat object instead of array-of-arrays for HTTP headers.
E.G. { "Content-Length": 10, "Content-Type": "text/html" } instead of
[["Content-Length", 10], ["Content-Type", "text/html"]].
The main reason for this change is object-creation efficiency.

This still needs testing and some further changes (like when receiving
multiple header lines with the same field-name, they are concatenated with a
comma but some headers ("Content-Length") should not be concatenated ; the
new header line should replace the old value).

Various thoughts on this subject:
http://groups.google.com/group/nodejs/browse_thread/thread/9a67bb32706d9efc#
http://four.livejournal.com/979640.html
http://mail.gnome.org/archives/libsoup-list/2009-March/msg00015.html
2009-08-23 12:32:49 +02:00
Ryan
368ea93bfe Upgrade evcom - fix API issues. 2009-08-19 17:41:32 +02:00
Ryan
7aaab320b3 API: tcp.Connection "disconnect" event renamed to "close".
More semantic, since the event will be emitted on connection error,
when the connection was ever established.
2009-08-14 12:51:46 +02:00
Ryan
dd5ae3183b Enable test-tcp-many-clients. 2009-08-13 15:05:02 +02:00
Ryan
3b0408ec1c Sync evcom after refactor; fix binding issues 2009-08-13 13:47:16 +02:00
Ryan
738d20f6f0 (evcom) Add fix for pausing against big buffers.
discussion:
http://groups.google.com/group/nodejs/browse_thread/thread/11a920da4d0ed21d
2009-08-10 12:32:54 +02:00
Ryan
94e8721771 Add connection.readPause() and connection.readResume() 2009-08-09 19:12:12 +02:00
Ryan
75fc21537a Bugfix: response.setBodyEncoding("ascii") not working.
This is same error that was fixed in 216fb3b9b2.

Reported by Felix Geisendörfer.
2009-08-09 18:04:10 +02:00