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

597 Commits

Author SHA1 Message Date
Sam Stephenson
6560ab9073 Send multiple header lines in ServerResponse#writeHead when header values are arrays 2010-09-15 15:55:30 -07:00
Ryan Dahl
6bdc42cee7 shorten some lines in events.js 2010-09-15 15:47:28 -07:00
Ryan Dahl
ae8f8e7258 Optimize emit for two arguments 2010-09-15 15:20:04 -07:00
Ryan Dahl
77fc61d539 Default value for second arg of Buffer#slice 2010-09-14 15:39:27 -07:00
Mark Nottingham
4fe3007a1a Support for outgoing HTTP trailing headers 2010-09-14 15:20:45 -07:00
isaacs
686d9f9cc6 Bug in realpath with symlinks to absolute folder paths which have children.
Found by Cliffano Subagio
http://groups.google.com/group/nodejs/browse_thread/thread/f46f093938265ac0/387e14da08c7dd7b?
2010-09-14 10:27:57 -07:00
Peter Griess
422d3c93bc Get rid of PHP/Rails style parameter munging.
- Handle only the most basic of query string parsing and construction.
  Leave the rest (e.g. Rails/PHP behaviors) to modules higher up the
  stack, like Express.
2010-09-13 12:39:30 -07:00
Ryan Dahl
2d09ef8541 Fix style in readline 2010-09-12 21:47:56 -07:00
Ryan Dahl
0ef8a86af2 Add SIGWINCH handler for readline 2010-09-12 21:23:53 -07:00
Ryan Dahl
3a9570386a Fix fs.realpathSync('/') 2010-09-09 18:49:28 -07:00
Ryan Dahl
b8bfbdab48 Rename SlowBuffer in binding 2010-09-09 11:03:51 -07:00
Ryan Dahl
5bc4efe820 Remove blobs, simplify SlowBuffer
Implement SlowBuffer.prototype.slice in js
2010-09-09 11:03:51 -07:00
Ryan Dahl
ba2e4a2306 Simplify fast buffer constructor 2010-09-09 11:03:50 -07:00
Ryan Dahl
3e9f636b64 Improve long buffer test 2010-09-09 11:03:50 -07:00
Ryan Dahl
17ba821e60 defineProperty is slow, don't use it for fastbuffer 2010-09-09 11:03:50 -07:00
Ryan Dahl
d3fcd1c75a Expose SlowBuffer 2010-09-09 11:03:50 -07:00
Ryan Dahl
8b4f1e05f9 Expose Buffer.poolSize 2010-09-09 11:03:50 -07:00
Ryan Dahl
5506f99dfa map charsWritten to fast buffer 2010-09-09 11:03:49 -07:00
Ryan Dahl
7b772f3f68 More fast buffer work 2010-09-09 11:03:48 -07:00
Ryan Dahl
d5bdda74c1 fast buffer bounds checking in copy() 2010-09-09 11:03:48 -07:00
Tim-Smart
6ea99721f1 string.length !== Buffer.byteLength(string) 2010-09-09 11:03:48 -07:00
Ryan Dahl
2dda6be799 Fast Buffer safe constructor 2010-09-09 11:03:48 -07:00
Ryan Dahl
b87669cbf4 Fix fastbuffer style
Fix style
2010-09-09 11:03:48 -07:00
Tim-Smart
2b07c9fcae Some silly fixes to buffer.js 2010-09-09 11:03:47 -07:00
Tim-Smart
746d487da8 FastBuffer implementation. API needs migration 2010-09-09 11:03:47 -07:00
isaacs
ba0c32e2e1 Fix issue #262. Allow fs.realpath to traverse above the current working directory. 2010-09-08 17:35:58 -07:00
Ryan Dahl
0e501f4ec5 Fix style; undefined reference bug 2010-09-08 12:03:33 -07:00
Tobie Langel
ccf4afa256 Do not emit WriteStream's drain event before ws.write has been called. 2010-09-08 11:58:54 -07:00
Tobie Langel
f5e4047064 Avoid closing a WriteStream before it has been opened. 2010-09-08 11:51:29 -07:00
Tobie Langel
75f922c863 Avoid missing ref error in WriteStream.prototype.destroy(). 2010-09-08 11:50:56 -07:00
Ryan Dahl
24ac87f543 Increase ReadStream bufferSize to 64k 2010-09-08 10:14:04 -07:00
Trent Mick
1d961a6630 add ANSI coloring option to sys.inspect and, by default, to the repl 2010-09-08 09:47:13 -07:00
Trent Mick
5330fea954 Ctrl+W support for the REPL
FWIW, command-line style (delete back to whitespace) would be:
    leading = leading.replace(/\S+\s*$/, '');
2010-09-08 09:45:57 -07:00
Ryan Dahl
1be722a271 Special deepEquals for buffer 2010-09-07 17:14:04 -07:00
Ryan Dahl
3c00ec4e48 typo: forceClose -> destroy for WriteStreams 2010-09-05 02:27:02 -07:00
isaacs
0e311717b5 Treat "//some_path" as pathname rather than hostname by default.
Note that "//" is still a special indicator for the hostname, and this does
not change the parsing of mailto: and other "slashless" url schemes.  It
does however remove some oddness in url.parse(req.url) which is the most
common use-case for the url.parse function.
2010-09-02 09:24:21 -07:00
Marco Rogers
af9aa93e0c fix for fs.readFile to return string when encoding specified on zero length read 2010-08-30 14:08:18 -07:00
Marco Rogers
9c7c6e93e1 Fixed async fs writes with length 0, it should fire the callback 2010-08-30 13:58:50 -07:00
Bradley Meck
d5214b3627 Allow Strings for ports on net.Server.listen 2010-08-30 13:27:38 -07:00
Johan Euphrosine
e49be4768b add readline support for meta-d 2010-08-30 10:26:51 -07:00
Russell Haering
37b6e10684 Pass an error to the sys.pump callback if one occurs
- Add test case for pumping from unreadable stream.
- Document the sys.pump error handling behavior
2010-08-30 10:23:48 -07:00
Ryan Dahl
4fdebab005 Safe constructor: net.Server, net.Stream 2010-08-27 15:38:46 -07:00
Ryan Dahl
44a287987e Safe constructors: http.Server and http.Client 2010-08-27 13:58:52 -07:00
Brian
d9eb64928e Fix home/end keys in repl for putty/xterm. 2010-08-23 09:18:36 -07:00
Russell Haering
6078c37be5 Modify fs.open to use accept a callback without a mode 2010-08-23 02:42:25 -07:00
Johan Euphrosine
748469c71c add readline support for meta-f and meta-b 2010-08-23 01:47:41 -07:00
Johan Euphrosine
fd3e84499e add home/end support in rxvt and readline tests 2010-08-23 01:46:14 -07:00
isaacs
e55c486801 Missing 'var' in sys.inspect (Found by Oleg Slobodskoi) 2010-08-22 13:45:39 -07:00
Johan Euphrosine
0e1e00e68b fix home/end on GNU/Linux 2010-08-22 12:34:58 -07:00
Ryan Dahl
2982e75a0b set-cookies header is an array of values. always 2010-08-21 16:34:38 -07:00
Ryan Dahl
51ecba8da9 Add get/set methods to Buffer 2010-08-19 23:29:06 -07:00
Trent Mick
293809b8b6 drop obsolete TODO comment 2010-08-18 23:02:54 -07:00
Trent Mick
1aeaf8d289 repl tab completion: insert common prefix of multiple completions 2010-08-18 23:02:30 -07:00
Trent Mick
5c1ffa165f repl completion: completion for arguments to "require" 2010-08-18 22:59:49 -07:00
Trent Mick
2134982ea4 repl completion: comment/TODO cleanup, no functional change 2010-08-18 22:59:35 -07:00
Herbert Vojčík
5dc2b93311 Fix sys.inspect for regex in different context. 2010-08-18 11:47:43 -07:00
Marco Rogers
6744e59e46 detect 0 length fs writes with tests 2010-08-16 23:57:01 -07:00
Ryan Dahl
4593c04959 Implement net.Server.maxConnections
Simplify EMFILE behavior.
2010-08-15 14:01:55 -07:00
Illarionov Oleg
cde80d9859 Fix OpenSSL 100% CPU usage on error 2010-08-15 13:23:09 -07:00
Rasmus Andersson
cf909e8725 added dns.getHostByAddr() -- resolve an external IP address to hostname(s) 2010-08-12 16:25:45 -07:00
Ryan Dahl
9acd76ed6e Don't throw on HEAD requests 2010-08-12 10:06:52 -07:00
Trent Mick
72e4a49cac repl completion: multi-column display of completions 2010-08-12 00:07:26 -07:00
Trent Mick
1c9a85b9a6 First pass at tab-completion in the REPL 2010-08-11 13:42:45 -07:00
Rasmus Andersson
fd3cd755d1 [dgram] only look up hostname for the requested address family
- [lib/dns.js] dns.lookup takes a new optional argument "family" which
  should be the integer 4, 6, dns.AF_INET or dns.AF_INET6. Passing a
  non-false "family" argument makes c-ares explicitly look up addresses for
  the specified family.

- [test/simple/test-c-ares.js] test explicit address family lookups
2010-08-10 17:53:32 -07:00
Ryan Dahl
3d551e5538 Close fd on readFile(emptyfile) 2010-08-10 14:47:40 -07:00
Ryan Dahl
1c5d5e0b72 uppercase request methods 2010-08-09 21:23:52 -07:00
Bert Belder
7d4e8a9a71 If no options are given to child_process.spawn, env should default to process.env
Regression.
2010-08-09 15:37:14 -07:00
Ryan Dahl
7068912fbb Export Interface from readline.js 2010-08-08 11:52:31 -07:00
Bert Belder
aaa1f451e6 Expose cwd option to child_process.exec() 2010-08-06 13:38:41 -07:00
Bert Belder
94914135df New api for child_process.spawn; ability to set cwd for spawn()ed process
Tests for child_process.spawn() use new API

Test for deprecated child_process.spawn() API
2010-08-06 13:37:30 -07:00
Ryan Dahl
d408de87fc Remove module.js - put code into src/node.js 2010-08-06 12:34:02 -07:00
cloudhead
fe3e419687 querystring.parse: handle undefined value properly 2010-08-05 10:46:28 -07:00
Nick Stenning
0a3eff8021 Standardise module load order for native and registered file extensions.
This patch standardises the load order for modules. Highest priority is trying to load exactly the file the user specified, followed by native extensions, followed by registered extra extensions, etc.

In full, if we require('foo') having registered '.coffee' as an alternative extension, we try and load the following files in order:

    foo
    foo.js
    foo.node
    foo.coffee
    foo/index.js
    foo/index.node
    foo/index.coffee
2010-08-04 16:03:08 -07:00
Nick Stenning
78520ba482 Don't attempt to load a directory.
This patch replaces the path.exists check for module loading with a call to
fs.statSync (or fs.stat for require.async) which ensures that it's not trying
to load a directory.
2010-08-04 15:55:47 -07:00
Ryan Dahl
adec544fdd Revert "Expose the V8 debug object process.debug"
This reverts commit d9fbb8a580.
2010-08-04 10:38:19 -07:00
Ben Noordhuis
4b19bd2896 Client.onend: Anticipate that the HTTP parser object is uninitialized when the client setup failed. 2010-08-02 11:25:53 -07:00
Ryan Dahl
d9fbb8a580 Expose the V8 debug object process.debug
Add one duplicate test from V8, just to make sure it works.
2010-08-02 00:46:09 -07:00
Mikeal Rogers
3214116be6 Implement keep-alive for http.Client
Send the 'Connection: keep-alive' header in your request to enable.
2010-08-01 22:34:17 -07:00
isaacs
65037eeb32 Don't let path.normalize get above the root.
Any path.join or path.normalize that starts with a / will not go "above" that after normalization.  This is important because /../foo is almost *always* some sort of error, and doesn't match the corollary in sh: `cd $p; pwd`

At the worse, this can be a vector for exploits, since a static file server might do path.join(docroot, path.normalize("/"+req)) to get the file.  If the normalized request path could be something like "/../../../etc/passwd" then bad things could happen.
2010-08-01 20:20:17 -07:00
Danny Coates
dc8c079d90 remove node::CheckBreak in favor of using the v8 debugger js object 2010-08-01 20:04:31 -07:00
Ryan Dahl
b5b83b210b Fix --debug-brk; hacky solution 2010-07-27 20:36:58 -07:00
Matt Ranney
f7c5334195 Check for socket on Unix domain connect.
Change scope to context in REPL docs.
2010-07-26 19:02:15 -07:00
Chandra Sekar S
66deea10c7 Support for HOME and END in REPL. 2010-07-26 10:59:34 -07:00
Dmitry Baranovskiy
8ab3c3e7c3 Added ability to pass offset to buffer write and toString methods as a string, i.e. '2' and encoding as anything 2010-07-25 20:16:37 -07:00
Ryan Dahl
2c1ca4078d Implement buffer.write for base64
There might be an off-by-one on the returned value.
2010-07-23 16:36:52 -07:00
Ryan Dahl
528015e0d8 Implement buffer.toString('base64') 2010-07-23 13:52:44 -07:00
isaacs
f0f247d7e5 Fix dirname so that dirname('/a/b/') -> '/a', like sh's does.
Before there was this comment:
  Can't strip trailing slashes since module.js incorrectly
  thinks dirname('/a/b/') should yield '/a/b' instead of '/a'.
But now, such thinking is corrected.
2010-07-23 09:08:49 -07:00
Chandra Sekar S
f5f7cb9264 Support for reading byte ranges from files using fs.createReadStream. 2010-07-21 11:33:35 -07:00
Peter Griess
56f200af5d Fix Buffer.toString() on 0-length slices.
- Buffer.toString('ascii', 0, 0) incorrectly returns the entire contents
  of the buffer. Fix this.
- Provide similar behavior to Buffer.write() and Buffer.copy() when
  dealing with 0-length in valid and invalid byte ranges.
2010-07-20 15:38:10 -07:00
isaacs
d75b63bc3c Support including modules that don't have an extension.
This way, require("/foo") will work if there is a "foo.js", or a file named
simply "foo" with no extension.
2010-07-20 10:26:24 -07:00
Ryan Dahl
7067a7155f Specify env differently in execFile
Callbacks should always be the last argument.
2010-07-19 20:08:35 -07:00
isaacs
49e0f14a2f Cache modules based on filename rather than ID
This is ever so slightly less efficient than caching based on ID, since the
filename has to be looked up before we can check the cache.  However, it's
the most minimal approach possible to get this change in place.  Since
require() is a blocking startup-time operation anyway, a bit of slowness is
not a huge problem.

A test involving require.paths modification and absolute loading. Here's the
gist of it.

Files: /p1/foo.js /p2/foo.js

  1. Add "/p1" to require.paths.
  2. foo1 = require("foo")
  3. assert foo1 === require("/p1/foo") (fail)
  4. Remove /p1 from require.paths.
  5. Add /p2 to require.paths.
  6. foo2 = require("foo")
  7. assert foo1 !== foo2 (fail)
  8. assert foo2 === require("/p2/foo") (fail)

It's an edge case, but it affects how dependencies are mapped by npm.
If your module requires foo-1.2.3, and my module requires foo-2.3.4,
then you should expect to have require("foo") give you foo-1.2.3, and
I should expect require("foo") to give me foo-2.3.4.  However, with
module ID based caching, if your code loads *first*, then your "foo"
is THE "foo", so I'll get your version instead of mine.

It hasn't yet been a problem, but only because there are so few
modules, and everyone pretty much uses the latest version all the
time.  But as things start to get to the 1.x and 2.x versions, it'll
be an issue, I'm sure.  Dependency hell isn't fun, so this is a way to
avoid it before it strikes.
2010-07-19 14:17:22 -07:00
Micheil Smith
299671b731 querystring: Removing typecasting of numeric strings to numbers
The tests did not accurately test for a strict equality, meaning that the
number == to the string.
2010-07-19 11:07:08 -07:00
Jan Kassens
bb2acd5e75 querystring.stringify is now more solid
* handles NaN and Infinity
* works with arrays from other contexts
2010-07-19 10:53:32 -07:00
Ryan Dahl
65f2e72d77 Fix style in readline 2010-07-19 10:16:20 -07:00
Jérémy Lal
0fd1656d63 Support DEL in the REPL. 2010-07-18 22:20:23 -07:00
Ryan Dahl
458bbb4687 fs.writeSync should return bytes written 2010-07-16 19:05:28 -07:00
Сергей Крыжановский
078a48a97b added env to child_process.exec 2010-07-15 17:17:03 -07:00
Ryan Dahl
02729d4af7 instanceof Buffer to Buffer.isBuffer() 2010-07-15 15:58:35 -07:00
Ryan Dahl
6961bc568f More instanceof Array fixes 2010-07-15 14:37:56 -07:00