Граф коммитов

566 Коммитов

Автор SHA1 Сообщение Дата
Herbert Vojčík 28b21d15c3 Fix undefined_reference_in_new_context test for own-context module loader. 2010-08-18 14:06:30 -07:00
Herbert Vojčík 2b126da395 Tests for behaviour of 'global'. 2010-08-18 12:08:39 -07:00
Herbert Vojčík 9253333850 Fix registerExtension for NODE_MODULE_CONTEXTS
Fix of registerExtension-produced non-string module loading with own
context. Plus finishing touches to the test.
2010-08-18 11:46:37 -07:00
Herbert Vojčík cf2b206a8e More changes to tests so they really work under context module loader.
Plus, getting rid of test/common.js defining things in global.
2010-08-17 08:41:05 -07:00
Herbert Vojčík 32e309440f Fix of 'sys.common.debug' calls in tests. 2010-08-17 08:08:36 -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
Ryan Dahl a8c2bb41af Fix tests 2010-08-13 08:55:42 -07:00
Ryan Dahl 03123435e0 Remove platform specific asserts 2010-08-13 08:13:54 -07:00
Bert Belder 0e8d858aba One more test with a race condition fixed 2010-08-13 07:18:38 -07:00
Rasmus Andersson 758f12f34c added read and write support for process.title Darwin
This will only manipulate the OS X-level process name, not the title shown
in e.g. ps.
2010-08-12 16:23:41 -07:00
Rasmus Andersson 8d5e05668b Added support for multiple listeners to DNS multicast datagrams.
Some platforms require SO_REUSEPORT to be set for the socket.
2010-08-11 19:02:20 -07:00
Bert Belder 7059be19ec Fix http and net tests failing due to race condition
Plus some minor cosmetic corrections
2010-08-11 17:27:44 -07:00
Ryan Dahl 9395786d11 Fix race conditions in tests 2010-08-10 17:48:37 -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 7db5c8a10d Fix toString('base64') bug
Thanks to Stepan Stolyarov for the test case.
2010-08-04 11:38:48 -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
Ryan Dahl 31b59400f8 Allow null context in Script 2010-08-04 10:20:40 -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
Ben Noordhuis f72ac17c89 Buffer: graciously handle padding in base64-encoded input. 2010-07-30 10:49:00 -07:00
Ryan Dahl f291fbc8a7 Fix ending \0 in base64 decoding 2010-07-29 14:52:40 -07:00
Ben Noordhuis 95638c9b0d Buffer: adjust buffer size so the base64-decoded input fits snugly.
Stops Valgrind from complaining about uninitialized memory access.
2010-07-28 11:37:23 -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 f18d9d8466 querystring.js: JSLint warnings fixed 2010-07-19 10:54:50 -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
Benjamin Fritsch 0ed3532699 added test for Issue #214 2010-07-19 10:16:31 -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 c926ab7746 Fix test-executable-path.js
Now that process.version doesn't say if the build is debug or not.
2010-07-15 14:21:32 -07:00
Ryan Dahl 8921bf454d Remove race conditions and simplify test-http-exceptions.js 2010-07-15 14:21:32 -07:00
Ryan Dahl 4c6f4dabf5 Adjust tests for error reporting on JSON.parse(undefined)
The V8 upgrade changed the stacktrace reports (?)
2010-07-15 14:21:32 -07:00
Ryan Dahl 9fd5e3c89c Update tests to work with module contexts 2010-07-15 14:21:31 -07:00
Ryan Dahl 5f30377bbc Load modules in individual contexts
Add NODE_MODULE_CONTEXTS env var

Only one test was modified to check that this works. NEED to go through all
tests and modify them so that

  NODE_MODULE_CONTEXTS=1 make test

passes.
2010-07-15 10:34:39 -07:00
Matt Ranney 4e50197e53 Datagram socket refactor. Add tests and documentation.
Support setTTL() and setBroadcast() socket options.
2010-07-15 10:27:44 -07:00