Commit Graph

1222 Commits (e0297ca59b748eb7912aab0eebc9e49952dd4835)

Author SHA1 Message Date
Felix Geisendörfer 2b91256c61 Fix error handling bug in stream.pipe()
Problem: Since stream.pipe() is registering it's own error handlers on
the source and destination stream, it needs to replicate the
EventEmitter 'error' emitting semantics of throwing an error if there
are no other listeners. However, there was a off-by-one error because
the check for remaining listeners was done after cleanup() which means
the pipe's own listener was no longer included.

This would cause 'error' events on either the dest or the source to
throw if there was one other error listener, and while swallowing
the 'error' event if there was no other listener.

Solution: I added a test demonstrating the two issues and fixed the
problem by correcting the off-by-one error.

Fixes #1095.
2011-05-24 10:50:33 -07:00
Ryan Dahl 59274e8a33 Merge branch 'v0.4'
Conflicts:
	lib/crypto.js
	lib/tls.js
2011-05-20 10:29:16 -07:00
Ryan Dahl 9c7f89bf56 CryptoStream.prototype.readyState shoudn't reference fd
Fixes #1069
2011-05-20 10:20:22 -07:00
David Trejo 8a0ac5b422 Add test for agent upgrade and example in docs 2011-05-19 18:44:42 -07:00
Ryan Dahl 6461af1baa Fix buffer test 2011-05-19 12:41:17 -07:00
Ryan Dahl 5e409c2f1a makeFastBuffer should not segfault but rather throw on non-buffer 2011-05-19 12:13:48 -07:00
Ryan Dahl 85bc8d02fa Merge branch 'v0.4'
Conflicts:
	src/node_crypto.cc
2011-05-16 19:29:02 -07:00
Ryan Dahl 103a450d3a Remove 'binary' encoding assert - add tests
Don't write large characters to buffers with binary encoding. You will be
silently injured.
2011-05-16 15:01:33 -07:00
koichik d4f82ea590 Fix dns.resolve() with 'PTR' throws Error: Unknown type "PTR"
Fixes #1038
2011-05-16 10:21:16 -07:00
Brian White e505a1215c Add reading/writing of floats and doubles from/to buffers
Code for readIEEE754/writeIEEE754 is from jspack: http://code.google.com/p/jspack/
2011-05-15 18:39:07 -07:00
koichik 80c2fe9456 Fix event listener leak check timing
Fixes #1041.
2011-05-14 14:43:00 -07:00
Felix Geisendörfer e7ac6d8fcd Error argument for http.ServerRequest 'close'
Problem: It was not possible to detect the reason for a premature
connection termination in http requests.

This patch provides a new `err` argument to the 'close' event which
can be inspected to differentiate between a timeout and a client
actively terminating the connection.

Also contains tests for this new behavior for http and https.
2011-05-14 14:15:31 -07:00
Felix Geisendörfer 1fde5f51b4 Make https 'timeout' events bubble up
Also adds a test case for it.
2011-05-14 13:38:04 -07:00
Ryan Dahl 337c48db5f Rename spawnNode to fork 2011-05-11 13:32:40 -07:00
Ryan Dahl 9e26dab150 child_process.spawnNode
For making easy worker processes.
2011-05-11 02:24:48 -07:00
isaacs 307f39ce9e Fix a url regression
The change for #954 introduced a regression that would cause
the url parser to fail on special chars found in the auth
segment.  Fix that, and also don't create invalid urls when
format() is called on an object containing an auth member
containing '@' characters or delimiters.
2011-05-10 13:57:25 -07:00
isaacs 205b9beb6b Merge branch 'v0.4'
Conflicts:
	lib/tls.js
	lib/url.js
	src/node_version.h
	test/simple/test-buffer.js
	test/simple/test-url.js
2011-05-07 20:38:32 -07:00
Håvard Stranden 9f0b1a9bc6 Add Diffie-Hellman support to crypto module
Fixes #573
2011-05-06 14:36:04 -07:00
Konstantin Käfer 5e1b7cadb4 Add Buffer::fill method to do memset
Fixes #477.
2011-05-06 13:39:12 -07:00
Ryan Dahl 75a0cf970f cleartextstream.destroy() should destroy socket.
This fixes a critical bug see in MJR's production. Very difficult to build a
test case. Sometimes HTTPS server gets sockets that are hanging in a
half-duplex state.
2011-05-02 15:03:50 -07:00
Robert Mustacchi 9812e31e8b Add reading/writing of C integers to buffers 2011-05-01 14:02:33 -07:00
koichik fcc04e67c8 Fix SlowBuffer.write() with 'ucs2' throws ReferenceError. 2011-04-28 04:57:00 -04:00
isaacs a7ce79124e Add arch/platform to os module 2011-04-26 20:04:32 -07:00
Mark Cavage a2328dc73c Add support for Unix Domain Sockets to HTTP
fixes #979.
2011-04-25 16:52:31 -07:00
isaacs 8df6f9e544 Close #974 Properly report traceless errors.
Also, tests for the same.
2011-04-25 12:22:18 -07:00
isaacs 8fd1c68f06 A test that running 100 stream pipes in parallel is ok 2011-04-22 19:33:23 -07:00
Ryan Dahl 621b024b6e Bump bounds on #897 test - was too small for slow machines 2011-04-22 17:50:40 -07:00
Ryan Dahl c8e447ee63 Fix timeouts with floating point numbers bug
fixes #897.
2011-04-22 16:38:29 -07:00
isaacs 5cfac21852 GH-853 fs.fchmod and fs.fchown 2011-04-20 16:04:33 -07:00
isaacs 90802d628d Close #954 URL parsing/formatting corrections
1. Allow single-quotes in urls, but escape them.
2. Add comments about which RFCs we're following for guidance.
3. Handle any invalid character in the hostname portion.
4. lcase protocol and hostname portions, since they are
case-insensitive.
2011-04-20 15:44:34 -07:00
Fedor Indutny c9b40da368 OpenSSL NPN in node.js
closes #926.
2011-04-19 11:32:26 -07:00
Ryan Dahl 9e6498d5fa Merge branch 'v0.4'
Conflicts:
	src/node_version.h
2011-04-18 18:58:16 -07:00
Ryan Dahl b4ff36a41b Add --cov code coverage option 2011-04-14 23:42:08 -07:00
Felix Geisendörfer 80711b0ff9 Feature: WriteStream#bytesWritten property
Implemented a new property for writable file streams that keeps track
of the bytes written (not queued). This helps when you are piping
another stream to a file, and would like to know how big the file is
without having to issue another stat call.

closes #930
2011-04-14 14:26:46 -07:00
Felix Geisendörfer 6c5b31bd80 Fix: Multiple pipes to the same stream were broken
When creating multiple .pipe()s to the same destination stream, the
first source to end would close the destination, breaking all remaining
pipes. This patch fixes the problem by keeping track of all open
pipes, so that we only call end on destinations that have no more
sources piping to them.

closes #929
2011-04-14 14:12:01 -07:00
Ryan Dahl 598792ba91 Merge branch 'v0.4'
Conflicts:
	src/platform_sunos.cc
	test/simple/test-os.js
2011-04-14 01:11:21 +00:00
Scott McWhirter 90348a616d Add os.cpus() and os.uptime() support for sunos 2011-04-13 17:42:54 -07:00
Ryan Dahl 2f98451561 Revert "Add os.cpus() and os.uptime() support for sunos"
Cherry-pick fail. Breaks linux. Will land again shortly.

This reverts commit e8cf98c841.
This reverts commit d953856d87.
This reverts commit 752bbd6b42.
2011-04-13 17:31:09 -07:00
Scott McWhirter e8cf98c841 Add os.cpus() and os.uptime() support for sunos 2011-04-14 00:18:19 +00:00
Ryan Dahl 296ff04cdc Test to demonstrate #892 2011-04-13 12:49:13 -07:00
Brian White ac1da4b407 Add remoteAddress and remotePort for client TCP connections
https://groups.google.com/d/topic/nodejs-dev/Asr87_YFSkg/discussion
2011-04-13 10:24:28 -07:00
koichik 9533e879f0 Fix Buffer.write() with UCS-2 should not be write partial char
closes #916.
2011-04-13 09:55:49 -07:00
Felix Geisendörfer 301f53c2aa Allow omission of end option for range reads
Problem: Sometimes it is useful to read a file from a certain position
to it's end. The current implementation was already perfectly capable
of this, but decided to throw an error when the user tried to omit
the end option. The only way to do this, was to pass {end: Infinity}.

Solution: Automatically assume {end: Infinity} when omitted, and remove
the previous exception thrown. Also updated the docs.

closes #801.
2011-04-13 09:46:28 -07:00
Nick Campbell 425b57bedc Lowercase protocol and hostname since casing isn't significant.
Signed-off-by: Nick Campbell <nicholas.j.campbell@gmail.com>
2011-04-13 01:10:47 -07:00
Jakub Lekstan 81cbd42cf5 Fixes the circular reference in vm modules.
Fixes the circular reference problem. Closes GH-822.
2011-04-12 15:51:57 -07:00
Abe Fettig 83727a4c86 Fix bug where http response.readable was never set to false
Closes GH-867.
2011-04-12 14:55:18 -07:00
Felix Geisendörfer bc8489580c Allow to remove all EventEmitter listeners at once
This patch adds support for calling EventEmitter#removeAllListeners
with no parameters in order to remove all listeners as once.

See discussion: https://groups.google.com/forum/#!topic/nodejs-dev/Mcyal1ThTHY

Closes GH-889.
2011-04-12 14:47:16 -07:00
Ryan Dahl 9ccf0e527f Don't error on ENOTCONN from shutdown() 2011-04-11 15:33:24 -07:00
Ryan Dahl bfa9db9dd6 Merge branch 'v0.4'
Conflicts:
	src/node_version.h
	test/simple/test-buffer.js
2011-04-03 23:42:56 -07:00
isaacs 7ee8c5676b Modify futimes test to allow ENOSYS 2011-04-01 17:41:42 -07:00
isaacs 6d85da185c Closes GH-721 Set default host header properly
However, this test is failing for some quite unrelated issue.
Getting some odd "socket hangup" crashes, and only the first request
ever makes it to the server.
2011-04-01 17:40:41 -07:00
isaacs e1a72f0e2e Closes GH-535 Immediate pause/resume race condition
Calling resume() immediately after calling pause() would trigger
a race condition where it would try to read() from a file
descriptor that was already being read from, causing an EBADF
2011-04-01 17:40:19 -07:00
isaacs 4d64f36338 Closes GH-310 Format slashes properly 2011-04-01 17:40:19 -07:00
Ryan Dahl f2dd8dd2b9 Fix test/message/undefined_reference_in_new_context
Broke after 75db199.
2011-04-01 12:36:58 -07:00
Ryan Dahl ed74db01f3 process.stderr.write should return true 2011-03-30 15:53:07 -07:00
Ryan Dahl 6394ba28c8 Add test for circular refs in deepEquals
Closes GH-207.
2011-03-30 10:18:58 -07:00
Ryan Dahl 038306a6c3 Closes GH-843. Fix SlowBuffer.prototype.slice 2011-03-29 10:47:14 -07:00
Jorge Chamorro Bieling e7604b1ea7 Retain buffers in fs.read/write()
Closes GH-814.
Closes GH-827.
2011-03-28 15:28:55 -07:00
Mikeal Rogers 2a65d29625 Fix listener leak in stream.pipe() 2011-03-28 11:19:44 -07:00
Arnout Kazemier 53bec1c862 Added support for removing .once listeners
Closes GH-806.
2011-03-25 11:51:29 -07:00
Ryan Dahl 7a8c729830 Merge branch 'v0.4'
Conflicts:
	src/node_version.h
2011-03-22 13:12:07 -07:00
Ryan Dahl d7a86ff05e Fix GH-819. Drop out if connection destroyed before connect() 2011-03-21 14:48:26 -07:00
Ryan Dahl 602a4637bf Merge branch 'v0.4'
Conflicts:
	src/node_version.h
2011-03-18 11:11:43 -07:00
Ryan Dahl 66570c1964 Fix double free of parser on error in http.Agent.
Thanks to Stéphan Kochen for the fix and Maurice Fonk for reproducing the
bug.

Closes GH-784.
Closes GH-803.
2011-03-18 10:42:43 -07:00
Ryan Dahl af923154e2 hello.txt should be stored in tmpdir 2011-03-18 09:14:15 -07:00
Daniel Ennis 911cbd0cef Add support for file descriptor type detection.
setImplementationMethods checks the type of a socket and defines different
behavior based on the type, so auto detect it if type not implicitly
specified.
2011-03-17 10:35:47 -07:00
Ryan Dahl 19e53512b8 os.getNetworkInterfaces() 2011-03-16 16:34:12 -07:00
isaacs 3c9fb3ec1a Fix invalid end handling for SlowBuffer#hexSlice 2011-03-15 11:39:11 -07:00
Ryan Dahl 3c0dd8196a Fix test-process-uptime.js test 2011-03-14 17:50:24 -07:00
Ryan Dahl 247d880113 Merge branch 'v0.4'
Conflicts:
	src/node_version.h
2011-03-14 17:45:15 -07:00
Ryan Dahl 55048cdf79 Update copyright headers 2011-03-14 17:37:05 -07:00
Ryan Dahl 36e75b7351 Fix HTTP agent disconnection problem
https://groups.google.com/forum/#!topic/nodejs-dev/V5fB69hFa9o

Closes GH-787.
2011-03-14 14:47:41 -07:00
Felix Geisendörfer 9d4c5a12f4 Crypto update should only accept strings / buffers
I have seen a lot of people trying to pass objects to crypto's update
functions, assuming that it would somehow serialize the object before
hashing.

In reality, the object was converted to '[object Object]' which was
then hashed, without any error message showing.

This patch modifies the DecodeBytes function (used exclusively by
crypto at this point) to complain when receiving anything but a
string or buffer.

Overall this should be a less-suprising, more robust behavior.
2011-03-14 13:16:31 -07:00
Ryan Dahl 2e40328c82 Extend OpenSSL expiration dates 2011-03-14 11:30:21 -07:00
koichik 113b1e6e0c Fix GH-746 process.stdin.destroy() breaks http server 2011-03-11 16:33:07 -08:00
Tony Huang 502900c0bc add path.relative 2011-03-08 11:03:21 -08:00
Ryan Dahl 81d3de7e6d setMaxListeners should initialize _events 2011-03-07 13:16:00 -08:00
Tom Hughes cf78ce59b3 Add process.uptime(). 2011-03-07 10:45:25 -08:00
Andreas Reich 5e91042fcb Don't decrease server connection counter again if destroy() is called more than once
Test: Anders Conbere <aconbere@gmail.com>
Fix: Andreas Reich <andreas@reich.name>

Closes GH-431.
Closes GH-502.
2011-03-04 15:45:12 -08:00
Ryan Dahl ca8be39b9e Disable test-http-agent2.js for the moment
Still broken.
2011-03-02 21:21:29 -08:00
Ben Noordhuis 1d5ff15a46 fs.utimes() and fs.futimes() support. 2011-03-02 20:35:45 -08:00
koichik 4e7c37b87c Fix fs.WriteStream.end(data, [encoding]) throws TypeError 2011-03-01 10:49:20 -08:00
Felix Geisendörfer 0304f1fc22 Expose errno with a string for dns/cares
This is to mirror the behavior introduced in
aa95e5708f.

Closes GH-727.
2011-02-28 09:54:16 -08:00
isaacs d664bf376d Closes GH-711 URL parse more safely
This does 3 things:

1. Delimiters and "unwise" characters are never included in the
   hostname or path.
2. url.format will sanitize string URLs that are passed to it.
3. The parsed url's 'href' member will be the sanitized url, which may
   not match the argument to url.parse.
2011-02-27 17:17:40 -08:00
koichik 0a51a6d3ac Fix process.stdout.end() throws ENOTSOCK error. 2011-02-27 13:06:08 -08:00
Ryan Dahl 8838e14ac0 Merge branch 'v0.4' 2011-02-25 16:48:48 -08:00
Russell Haering 7276ff9822 http: fix missing 'drain' events 2011-02-24 17:39:59 -08:00
Ryan Dahl ea9f5b110a Add 'close' and 'aborted' events to Agent responses
Closes GH-722.
2011-02-24 17:16:13 -08:00
Nathan Rajlich a9a252fda9 Read up the prototype of the 'env' object.
Closes GH-713.
2011-02-24 16:36:23 -08:00
Felix Geisendörfer 66601f13d9 Do not cache modules that throw exceptions
If a module throws an exception on load, it should not be cached.
This patch shows the problem in a test case and also fixes it.

See: https://groups.google.com/forum/#!topic/nodejs-dev/1cIrvJcADbY

Closes GH-707
Closes GH-710
2011-02-24 16:14:04 -08:00
Ryan Dahl 1f50d711b2 Fix memleak in vm.runInNewContext
Closes GH-704.
2011-02-24 15:46:55 -08:00
Felix Geisendörfer f423ec90fc In addition to 'aborted' emit 'close' from incoming requests
Closes GH-160.
2011-02-24 12:41:51 -08:00
cloudhead a91b140963 fix process.on edge case with signal event
When adding a listener for a signal event, removing it, and
adding it back again, it triggers a condition with an
undefined variable.
2011-02-23 12:57:05 -08:00
Ryan Dahl 7dad30afe9 Merge branch 'v0.4'
Conflicts:
	src/node_version.h
2011-02-19 19:26:56 -08:00
isaacs 0aa1a8a005 Closes GH-695 Add 'hex' encoding to Buffer 2011-02-19 19:24:23 -08:00
Ryan Dahl c2a62951f6 TLS sockets should not be writable after 'end'
Closes GH-694.
2011-02-19 18:25:15 -08:00
Ryan Dahl c72ae27be1 test-tls-securepair-server: don't shutdown stdout 2011-02-19 16:56:56 -08:00
isaacs 8b9dbdad27 Closes GH-687 Don't read fs read stream if not open 2011-02-19 16:38:21 -08:00
Ryan Dahl ebfc90b505 Remove test-http-eof-before-eom - wasn't testing anything important 2011-02-18 11:30:52 -08:00
Ryan Dahl 26e580bbc4 Use console.error in test-timers
In attempt to understand buildbot failures.
2011-02-18 11:20:45 -08:00
isaacs f8defa3e09 package.json main as indexed subdir
Closes GH-686.
2011-02-18 10:43:06 -08:00
Ryan Dahl aac5cbe025 HTTP Agent sockets should not reconnect on error
Closes GH-684.
2011-02-18 10:40:09 -08:00
Matt Ranney ab969bfaf8 Add failing test for broken HTTP responses with extra bytes.
For GH-680.
2011-02-18 00:08:05 -08:00
Ryan Dahl 15a6aa7500 Add more broken tests 2011-02-17 21:06:16 -08:00
Ryan Dahl 7f78e5857f Move test-tls-throttle to pummel 2011-02-16 18:12:08 -08:00
Ryan Dahl 89bfa419a5 Make test-http-curl-chunk-problem more portable
Use 'openssl sha1' instead of 'shasum'
2011-02-16 13:17:19 -08:00
Ryan Dahl e0e52f930e Remove artificial timeout from test-https-large-response 2011-02-16 12:22:48 -08:00
Ryan Dahl c365f56061 https was missing 'end' event sometimes
Closes GH-671.
2011-02-15 17:13:53 -08:00
Tj Holowaychuk 42a369620f Fixed null signal preservation
Closes GH-674.
2011-02-15 16:35:50 -08:00
Ryan Dahl 60ad3aa917 Disable test-tls-large-push, taking too long 2011-02-15 14:06:23 -08:00
Felix Geisendörfer 29b0dc4ec8 Fix: fs.open callback did not fire
Problem: Omitting the mode parameter causes the provided callback
parameter to never fire. This was originally fixed in 6078c37b and
later broken in 5f2e9093.

Solution: Overwriting the value of a parameter also overwrites the
reference in the arguments object. This patch works arround this
fact by not touching the mode parameter until a reference to the
callback has been established.
2011-02-15 13:50:59 -08:00
Richard Rodger b11d78b386 Fix for DNS fail in HTTP request
Closes GH-653.
2011-02-14 16:36:23 -08:00
Tj Holowaychuk fe838611f6 Fixed field merging with progressive fields on writeHead() 2011-02-14 13:40:31 -08:00
Tim Caswell b09c5889be Add support for mutable/implicit headers for http.
This works for both ServerResponse and ClientRequest.
Adds three new methods as a couple properties to to OutgoingMessage objects.
Tests by Charlie Robbins.

Change-Id: Ib6f3829798e8f11dd2b6136e61df254f1564807e
2011-02-10 02:31:41 -08:00
Theo Schlossnagle 01a864a29d TLS: CRL support
Needs more tests.
2011-02-10 00:49:15 -08:00
Mikeal Rogers 634e7236f7 Add 'pipe' event 2011-02-09 23:04:35 -08:00
Ryan Dahl e9257b859d New DTrace probes from CA team 2011-02-09 18:50:26 -08:00
Ryan Dahl 778fb859c6 New keys, agent1-cert.pem was expired 2011-02-09 18:30:47 -08:00
isaacs 81b4d45354 Better assert in the node_modules tests 2011-02-09 14:35:08 -08:00
isaacs 46513483cd node_modules module lookup, +docs and test. 2011-02-09 14:24:22 -08:00
isaacs 9bed5dcb2c Support caching for realpath, use in module load
This adds support for a cache object to be passed to the
fs.realpath and fs.realpathSync functions.  The Module loader keeps an
object around which caches the resulting realpaths that it looks up in
the process of loading modules.

This means that (at least as a result of loading modules) the same files
and folders are never lstat()ed more than once.  To reset the cache, set
require("module")._realpathCache to an empty object.  To disable the
caching behavior, set it to null.
2011-02-08 18:02:59 -08:00
Ryan Dahl 6b50a9f5f4 (won't) fix test-next-tick-ordering 2011-02-07 21:15:58 -08:00
isaacs 2e6a263e29 Closes GH-609 Support array-ish args to Buffer ctor
Any array-ish thing (whether a Buffer, an Array, or just an object with
a numeric "length") is interpreted as a list of bytes.
2011-02-07 14:13:18 -08:00
isaacs 5f2e90934e Support octal strings for modes
This allows the various fs utilities and process.umask to be used in
ECMAScript 5 Strict Mode, where the octal literal format is verboten,
without requiring users to litter their code with a bunch of parseInt
calls.
2011-02-07 14:05:06 -08:00
Konstantin Käfer 9e101f2b01 UCS-2 support
Closes GH-644.
2011-02-07 13:35:06 -08:00
Russell Haering e6ede31554 http: fix buffer writes to outgoing messages 2011-02-07 12:59:25 -08:00
isaacs da2f4b2dc4 support for package.json
This adds basic support for situations where there is a package.json
with a "main" field.  That "main" module is used as the code that is
loaded when the package folder is required.
2011-02-07 11:00:22 -08:00
Ryan Dahl 4733d0b1f0 http: handle aborts 2011-02-04 18:07:00 -08:00
Ryan Dahl aa95e5708f Expose errno with a string. 2011-02-04 14:41:51 -08:00
Ryan Dahl 97f7c06451 TLS: fix throttling
Re-enable test-https-large-response.js

Closes GH-614.
2011-02-03 12:20:19 -08:00
Ryan Dahl 41b4ec7952 TLS: flush buffer before destroy
Also disable test-https-large-response.js. Covered by
test/simple/test-tls-throttle.js
2011-02-02 15:34:21 -08:00
isaacs f86ec1366f Closes GH-619 Make require.main be the main module 2011-02-02 11:18:34 -08:00
Jorge Chamorro Bieling ff7fc093a1 Longer nexttick ordering test
Closes GH-604.
2011-02-01 10:23:03 -08:00
Joe Walnes df6e497793 dgram: setMulticastTTL, setMulticastLoopback and addMembership.
These are options needed for real-world multicasting.

Implementation notes:
- POSIX only.
- IPv4 only (IPv6 multicast is a tricky beast).
- Didn't update tests, because it can't effectively be demonstrated on
  localhost only.
2011-02-01 10:16:48 -08:00
Ryan Dahl 33e8e3d799 Add simpler failing tls throttle test 2011-01-31 16:38:05 -08:00
Ryan Dahl ef123600ce Add artificial timeout to broken test-https-large-response 2011-01-31 10:44:08 -08:00
Ryan Dahl 6ede26cb9c Add socket.bufferSize 2011-01-31 10:41:52 -08:00
Tim Caswell 845df3cd2e Slightly throttle https large body test 2011-01-28 14:35:20 -08:00
Ryan Dahl 286389202f Fix pummel/text-exec 2011-01-27 20:07:53 -08:00
Ryan Dahl 895968d8f8 Add test-https-large-response.js 2011-01-27 19:27:25 -08:00
Ryan Dahl cb06abe1e5 Helpful error when child_process.exec hit maxBuffer 2011-01-27 17:45:17 -08:00
Ryan Dahl fbb74784b5 Remove more process.assert 2011-01-27 17:02:25 -08:00
Greg Hughes 1a5e513084 Fix style issues with ext_key_usage patch
Closes GH-586.
2011-01-27 16:16:22 -08:00
Greg Hughes 6c32e155d3 Add ext_key_usage to getPeerCertificate 2011-01-27 14:06:40 -08:00
isaacs 6cdeb3b3fd A module ID with a trailing slash must be a dir.
require('./foo/') should not try to load './foo.js'.  It should only
look for ./foo/index.js

Closes GH-588
2011-01-27 14:02:43 -08:00
Ali Farhadi 36ef5643c3 Fixing bug in http request default encoding. 2011-01-26 12:18:25 -08:00
Ali Farhadi c70dd70301 Adding callback parameter to Socket's setTimeout method. 2011-01-26 12:13:03 -08:00
Ryan Dahl 129217a4e9 Increase timeout on test-repl to 5 seconds
Hopefully wont get failures on buildbot slaves.
2011-01-25 17:35:08 -08:00
Ali Farhadi 910a859b9c Adding test for many keep-alive connections 2011-01-25 17:20:25 -08:00
Carter Allen 5ad93ab573 Fix tests when spaces are in path 2011-01-25 12:56:35 -08:00
Ryan Dahl 72dd8778b9 Fix undefined_reference_in_new_context 2011-01-24 22:40:06 -08:00
Daniel Ennis 52f93185c7 Adding support for require-like initialization of node,
so `node foo`
will load one of:
./foo.js
./foo.node
./foo/index.js
./foo/index.node

Test cases added.
Ensured no conflict with native names.
2011-01-24 21:33:30 -08:00
Ryan Dahl 068b733583 Land Cantrill's DTrace patch
only works on solaris
2011-01-24 18:59:06 -08:00
Felix Geisendörfer 91cc2d8c4b Restructure src/node.js startup code
This patch introduces a logical structure and sequence for the
bootstrap code found src/node.js.
2011-01-24 14:52:25 -08:00
Ryan Dahl 555184663a windows compat: undefined_reference_in_new_context test 2011-01-23 15:32:07 -08:00
Ali Farhadi d81afcb3a6 Fixing bug in http request's end method. 2011-01-23 15:22:42 -08:00
Felix Geisendörfer 5a49f96505 Move commonjs module system into lib/module.js
This de-couples NativeModule from the module system and completes the
main objective of this refactoring.
2011-01-23 14:53:17 -08:00
Ryan Dahl 7dfbccf9bd Add test-https-agent 2011-01-21 15:56:27 -08:00
Ryan Dahl 68f2aa2715 http: agent should cycle on close 2011-01-21 14:55:29 -08:00
Ryan Dahl a86747603c Fix test-http-upload-timeout
Cannot just close the connection or client will error.
2011-01-20 18:24:00 -08:00
Ryan Dahl 7a16e2a2a0 test-http-client-reconnect-bug: hang up should be error. 2011-01-20 18:19:30 -08:00
Ryan Dahl f465949516 hacky work around socket hangups on http requests 2011-01-20 18:10:15 -08:00
Ryan Dahl d89454e5d4 Backport client 'upgrade' events 2011-01-20 18:10:15 -08:00
Ryan Dahl cb14236bb4 Use common.PORT not 8000 2011-01-18 22:27:12 -08:00
Ryan Dahl 39535d74df move test-exec to pummel - too slow 2011-01-18 22:25:38 -08:00
Ryan Dahl 2f6cb66009 Add setEncoding to CryptoStream 2011-01-18 18:30:12 -08:00
Ryan Dahl b22b5e341b listen/bind errors should close net.Server 2011-01-18 16:22:43 -08:00
Ryan Dahl 2ec4cd5525 factor linklist code into own file 2011-01-18 14:26:32 -08:00
Felix Geisendörfer 0263f01475 Fix test-require-cache-without-stat.js
This path adds an additional cache to the module system for caching the
location of previously required modules. Since it is embedded in the
loop that iterates over all require.paths, this patch also handles the
case where require.paths is being modified.

The patch also cleans up some code around it.

See: https://groups.google.com/forum/#!topic/nodejs-dev/QGGlrvLDHVs
2011-01-16 14:52:55 -08:00
Ryan Dahl c3b0d133aa Add built-in module loading to test-require-cache-without-stat 2011-01-16 14:34:39 -08:00
Ryan Dahl f35773ad07 Add broken test for require cache working
require is caching the compiled code but still stating the filenames.
https://groups.google.com/d/topic/nodejs-dev/QGGlrvLDHVs/discussion
2011-01-16 01:21:40 -08:00
Ryan Dahl 7df8a05129 debugger: primative object inspection 2011-01-13 13:32:16 -08:00
Ryan Dahl 29f48d48e5 A few more list clean ups 2011-01-13 02:22:09 -08:00
Ryan Dahl 09994438e5 Expose link-list from timers.js; add tests 2011-01-13 02:10:09 -08:00
Ryan Dahl 5f5201db2f Fix test-net-connect-buffer
Change to end() behavior in 33c339 was breaking it. end() should wait for
connection before dumping. Changed test-net-connect-timeout to use destroy()
instead.
2011-01-12 13:29:45 -08:00
Ryan Dahl 5f795efd4e net: Timeouts should work before DNS resolution 2011-01-12 12:59:58 -08:00
Ryan Dahl 33c33949b2 Add test for connection timeouts
Also make socket.end() destroy connection if still trying to connect.
Previously was ignoring.
2011-01-12 10:57:03 -08:00
Ryan Dahl 7c0f453b7c Add delay into test-debugger-client 2011-01-11 16:30:01 -08:00
Ryan Dahl 8e461673c4 Put a little delay into test-tls-securepair-client.js
Avoids race. openssl s_server is a terrible program.
2011-01-11 15:37:58 -08:00
isaacs 435ece5058 child_process: Support setting uid/gid by name 2011-01-11 13:54:51 -08:00
isaacs 6f5d95de6d child_process: Add gid/uid flags to spawn config
This is mostly working, but not completely ideal for two reasons.

1. Rather than emitting an error on the ChildProcess object when the
setgid/setuid fails, it is simply printing the error to stderr and
exiting.  The same happens with the cwd, so that's not completely
terrible.

2. I don't have a good test for this.  It fails with an EPERM if you try
to change the uid or gid as a non-root user.
2011-01-11 10:02:58 -08:00
Ryan Dahl 907e569980 Fix expired keys 2011-01-10 16:30:26 -08:00
Ryan Dahl 2e76cd382f TLS: Forward errors to cleartext
But only after control has been inverted.
2011-01-07 10:58:13 -08:00
Bert Belder 7c731ec9dd Path.resolve, path module windows compatibility
Removes path.normalizeArray() and path.split()
2011-01-06 15:36:25 -08:00
Bert Belder 9ddfcfecca Remove keepBlanks flag from path functions 2011-01-05 11:17:38 -08:00
Bert Belder 3c330b05b1 Merge branch 'master' of git://github.com/ry/node
Conflicts:
	src/node.cc
	src/node.js
2011-01-05 00:41:59 +01:00
Ryan Dahl 94f8368cf9 First pass at new https server 2011-01-03 15:51:05 -08:00
Ryan Dahl 6593a96373 Merge branch 'debugger' 2011-01-03 10:27:16 -08:00
Ryan Dahl feb77eab65 Fix REPL for named functions
add some tests.
2011-01-02 18:27:14 -08:00
Bert Belder 33118df8f9 Merge remote branch 'origin/master'
Conflicts:
	src/node_net.cc
	src/node_os.cc
2011-01-02 22:57:32 +01:00
Ryan Dahl b5637170b1 Fix openssl version check 2011-01-02 12:37:27 -08:00
Ryan Dahl 7e831bfba1 Disable TLS tests when node doesn't have OpenSSL. 2011-01-02 01:54:19 -08:00
Ryan Dahl 8b352bdc5d Add '{a:1}' to REPL tests 2011-01-01 21:14:06 -08:00
Ryan Dahl aea568b04a Fix some errors in debugger tests 2010-12-30 17:53:53 -08:00
Ryan Dahl 294bcb33e6 debugger: Fix some parser issues
Wouldn't handle events if it got backed up.
2010-12-30 17:33:07 -08:00
Ryan Dahl 4e81cf7def Debugger client emits ready after recving initial res 2010-12-30 01:35:11 -08:00
Ryan Dahl a8417c128e Add more debugger tests 2010-12-30 01:35:11 -08:00
Ryan Dahl 797aa97e19 Fix test-debugger-client 2010-12-30 01:35:11 -08:00
Ryan Dahl 8d82ec2130 Add beginning of build-in debugger
+ test-debugger-client (which is currently broken)
2010-12-30 01:35:11 -08:00
Brian White d75c338dd6 Add more functionality to the os module 2010-12-22 11:01:25 -08:00
Tom Hughes 0d58353d66 Don't access buffer data before initializing it.
Prevents valgrind from complaining and still tests that buffer data is
treated as unsigned.
2010-12-22 10:33:46 -08:00
Oleg Slobodskoi 23cf938e4f fix assert.throws 2010-12-21 12:41:57 -08:00
Bert Belder d66cf5f32c Work around intermittent mkdir failures in testcfg.py 2010-12-20 23:51:28 +01:00
Jeremy Martin 6f726cf8c7 url.parse(url, true) defaults query field to {} 2010-12-20 13:48:44 -08:00
Ryan Dahl 8db0bbe0dc Add callback to CryptoStream.write 2010-12-20 11:08:51 -08:00
Ryan Dahl 3cf2cbf904 Parse issuer and subject from CryptoStream.getPeerCertificate 2010-12-18 11:26:54 -08:00
Ryan Dahl d1f36accbf Remove toJSON usage - it was removed from V8 2010-12-17 09:50:41 -08:00
Jorge Chamorro Bieling e530507cb1 Add failing test for GH-511 2010-12-16 18:41:13 -08:00
Ryan Dahl 033ab7ebb6 Add 5 sec timeout to test-tls-securepair-client
This test is broken for people who don't have OpenSSL 1.0.0 - but it's just
a bug in OpenSSL. Add this timeout so that it doesn't take super long to run
the tests.
2010-12-16 12:23:38 -08:00
Ryan Dahl 632da2a393 Add callback paramenter to socket.connect() 2010-12-15 15:57:41 -08:00
Ryan Dahl c4161f32f5 Add callback to socket.write() 2010-12-15 15:47:02 -08:00
Ryan Dahl c970968ee6 better option parsing for socket.write() 2010-12-15 15:15:27 -08:00
Felix Geisendörfer e27418ca3f Prefer require.cache over native module cache
This patch changes node's module loading behavior so that the
require.cache is always the first place to consider when loading a
module.

The motivation for this change is to help people who are writing
focused tests for their node.js applications, and need a mechanism
to inject test doubles to replace native node.js modules.
2010-12-13 17:58:24 -08:00
Ryan Dahl a59483bd1d TLS: server should die on junk 2010-12-11 02:45:38 -08:00
Ryan Dahl 953561ab06 Factor out CryptoStream.end; support data on end() 2010-12-11 01:18:45 -08:00
Brian White f1762ff815 Add os module and getHostname 2010-12-11 00:51:20 -08:00
Ryan Dahl 8ef683dead Rename the securepair test to be prefixed with tls 2010-12-10 18:03:39 -08:00
Ryan Dahl c444293be9 Start a simple TLS client verification test 2010-12-10 18:02:58 -08:00
Ryan Dahl 5138992f3c Add some verification code to tls.connect() 2010-12-09 02:46:57 -08:00
Ryan Dahl a473b8dafb Move getPeerCertificate and getCipher to CryptoStream 2010-12-09 02:31:22 -08:00
Ryan Dahl 2ca63c8f79 Initial implementation of tls.connect()
Seems to work checkout test/disabled/tls-client.js
Type "GET /" after connected.
2010-12-09 00:38:12 -08:00
Ryan Dahl 137c361517 pair.cleartext, pair.encrypted now instances of tls.CryptoStream 2010-12-09 00:10:27 -08:00
Ryan Dahl dac4d486ec Accept Buffers as well as strings for addCert, addKey 2010-12-08 13:21:50 -08:00
Ryan Dahl 0ea0b921b7 TLS: emit 'secureConnection' instead of two events 2010-12-08 12:05:19 -08:00
Ryan Dahl bb46b63e33 test-tls-server-verify: add ca2 test case 2010-12-08 11:55:04 -08:00
Ryan Dahl 13b14300b9 TLS: emit 'end' on both streams 2010-12-08 11:51:41 -08:00
Ryan Dahl a0c55dfe09 TLS: don't use events when control hasn't been inverted 2010-12-08 11:46:19 -08:00
Ryan Dahl 0ec57ea34c Some TLS clean ups 2010-12-08 11:27:17 -08:00
Ryan Dahl 5d60b06b76 Add 'make test' to test/fixtures/keys/Makefile 2010-12-07 17:13:51 -08:00
Ryan Dahl 6bc9b2ef92 clients without certs are unauthed. 2010-12-07 16:51:23 -08:00
Ryan Dahl ee5366a410 Fix CNs for agent keys; can't be the same as CA's CN
Also add makefile for easy tweaking.
2010-12-07 16:36:10 -08:00
Ryan Dahl 5b8c62f7d1 Add broken, but detailed TLS verify test
Plus a bunch of keys.
2010-12-07 11:53:41 -08:00
Ryan Dahl 0b0faceb19 Move securepair stuff into tls.js 2010-12-05 18:19:18 -08:00
Ryan Dahl 5bca100afe Server must not request cert. 2010-12-05 18:13:20 -08:00
Oleg Efimov 093dfaf801 GJSLint all tests, only 3 long lines left in test-url.js
test/simple/test-url.js:31:(0110) Line too long (82 characters).
test/simple/test-url.js:39:(0110) Line too long (85 characters).
test/simple/test-url.js:40:(0110) Line too long (92 characters).
2010-12-05 15:42:41 -08:00
Oleg Efimov 0665f0271e GJSLint all simple tests exclude http-*, url, path 2010-12-05 15:41:58 -08:00
isaacs 47c40bf18d test-fs-realpath: Put junk in tmp, not fixtures.
Prevents test/fixtures/cycles/folder/cycles from being created every time
the tests are run.
2010-12-05 15:28:15 -08:00
isaacs dc2b4b2a81 test-fs-realpath: move absDir fetching to separate function 2010-12-05 15:27:01 -08:00
isaacs 6525c04522 test-fs-realpath: lint 2010-12-05 15:26:48 -08:00
Oleg Efimov 0ce9cbab29 GJSLint continue 2010-12-05 09:28:18 -08:00
Ryan Dahl 02cc39f221 Check for global leaks in all tests 2010-12-04 16:36:21 -08:00
Ryan Dahl 92789b16e5 Fix global leaks 2010-12-04 16:36:21 -08:00
Ryan Dahl a0159b4b29 Fix global leaks 2010-12-04 15:58:50 -08:00
Ryan Dahl fbdff52b44 Fix global leaks in test-buffer.js 2010-12-04 13:40:21 -08:00
Anders Conbere c4f8f871c9 adding module tests for .js and bare files
Currently the module tests don't cover the cases for when a user
requires a file with a request that includes the extension, and for a
request to a file with no extensions.

ex.

require("./a.js") // not tested
require("./foo") // (not tested with trying to load a file named ./foo)
2010-12-03 16:00:10 -08:00
Oleg Efimov c0d69a4883 GJSLint part of tests 2010-12-02 17:49:23 -08:00
Ryan Dahl d3532a4bf2 Fix indention in 'make test-message' 2010-12-02 17:01:18 -08:00
Ryan Dahl 712c74fc7a test-securepair-client: handle broken stdout packets 2010-12-02 16:38:23 -08:00
Ryan Dahl 08d8116f6b style 2010-12-01 13:43:05 -08:00
Ryan Dahl cd48649c61 Require without .js in test-repl 2010-12-01 13:40:28 -08:00
Ryan Dahl d8f2880ca4 New TLS server API 2010-12-01 13:00:17 -08:00
Michael W 5f3464cf4e fixed timers, whoops.
Fixes issue https://github.com/ry/node/issues/issue/481
2010-11-30 22:33:29 -08:00
Ryan Dahl e15e214747 Fix test-child-process-cwd.js on Joyent servers
It's symlinked to /usr/bin so this test fails.
2010-11-30 19:53:51 +00:00
Michael W 645c3b3713 Fixed: clearTimeouts calling multiple times
When clearTimeouts was called on a timer multiple times, it would break the
doubly-linked list along with future timeouts. This patch fixes that.
2010-11-29 18:17:13 -08:00
Ryan Dahl 1dbbaa7fa0 Add test to show ECONNREFUSED works 2010-11-29 17:36:59 -08:00
Jeremy Martin 144b2a5338 Fix number of args emitted by EventEmitter during "fast case" (lte 3 args) 2010-11-29 17:25:50 -08:00
Oleg Slobodskoi 02083412eb assert.throws can now accept as RegExp
makes validation of errors more flexible
2010-11-29 17:22:36 -08:00
Ryan Dahl 3fceb491d4 Style 2010-11-29 16:19:28 -08:00
Ryan Dahl 735b9d50a3 Simplify state transitions in http.Client
Fixes new bug shown in test-http-allow-req-after-204-res.js pointed out by
Tom Carden <tom.carden@gmail.com>.
2010-11-29 14:21:51 -08:00
Ryan Dahl 85827bde34 Avoid cascading EADDRINUSE test failure
See note in test-securepair-client.js
2010-11-29 14:21:51 -08:00
Ryan Dahl 105501c195 test-fs-realpath: Don't ceate things in /tmp; use tmpDir 2010-11-29 00:10:37 -08:00
Ryan Dahl 102b1d999d Add simple securepair client test 2010-11-28 18:40:50 -08:00
isaacs a52f59b437 Use a proper tty test. 2010-11-27 11:36:34 -08:00
Daniel Gröber ea29cb4e46 cmake cleanup
* Removed useless include_directories
 * Print ssl library path in build summary
 * ExternalProject also exists on 2.8.0
 * include pummel tests when testing with ctest
 * Moved tests.cmake to test/CMakeList.txt
 * Removed inconsistent, unnecessary condition in else
2010-11-23 23:33:19 -06:00
Ryan Dahl a6f6532dfb Fix test-securepair-server 2010-11-23 18:30:52 -08:00
Ryan Dahl 4f32a59307 Fix buffer.slice(0, 0) 2010-11-23 12:20:22 -08:00
isaacs b52b4196ab Fix problem with requireNative not exporting 'module' object
Broke require('constants'). Add unrelated test which breaks it.
2010-11-22 11:55:31 -08:00
Ben Noordhuis 611dffabb6 Support CNAME lookups in DNS module. 2010-11-21 20:53:57 -08:00
Ben Noordhuis f0b8cc6a94 require() should work with `node --eval`.
with tests

Fix module path resolve bug.  Normally the module path is taken from
realpath(__filename) but with eval there is (of course) no filename
2010-11-21 20:24:26 -08:00
Ryan Dahl 2320497992 Revert "Merge branch 'writev'"
This reverts commit cd9515efd9, reversing
changes made to df46c8e698.

Too slow. Needs more work.
2010-11-20 20:55:15 -08:00
Marco Rogers 118b88e44f update repl to distinguish JSON.parse SyntaxErrors from the rest 2010-11-20 20:36:14 -08:00
Ryan Dahl 15d5378684 Add failing test for TLS server 2010-11-19 13:28:13 -08:00
Ryan Dahl 0b1214c16b Fix a bug regarding queueSize, add asserts 2010-11-18 16:47:38 -08:00
Ryan Dahl 3884b4185a Small clean ups 2010-11-18 16:47:38 -08:00
Ryan Dahl fa556a1425 Add callback to socket.write(), fix test-sendfds 2010-11-18 16:47:38 -08:00
Ryan Dahl 913789da3e IOWatcher::Dump(), writev 2010-11-18 16:47:31 -08:00
Ryan Dahl df46c8e698 Rip out the old TLS implementation 2010-11-18 16:46:37 -08:00
Ryan Dahl 2a750bffcc Add tests for querystring.unescapeBuffer 2010-11-18 16:22:14 -08:00
Ryan Dahl 2219c64a04 fix race in test-http-big-proxy-responses.js 2010-11-18 13:50:54 -08:00
Ryan Dahl cea3a95f9f Add ref to buffer during fs.write and fs.read
There was the possibility the buffer could be GCed while the eio_req was
pending.  Still needs test coverage for the fs.read() problem.

See:
http://groups.google.com/group/nodejs/browse_thread/thread/c11f8b683f37cef
2010-11-16 16:26:55 -08:00
Ryan Dahl cf05257fb7 Test for server.listen() more carefully, fix bug 2010-11-16 15:33:21 -08:00
Ryan Dahl 4144024e6b Test and fix for self-assigned port from net.Server 2010-11-15 20:22:54 -08:00
Ryan Dahl 8b1082825c Rename require('javascript') to require('vm') 2010-11-15 18:37:27 -08:00
isaacs 9996b459e1 Implement new path.join behavior
1. Express desired path.join behavior in tests.
2. Update fs.realpath to reflect new path.join behavior
3. Update url.resolve() to use new path.join behavior.
2010-11-14 22:49:26 -08:00
isaacs 589e27948b writeFile fixes
writeFileSync could exhibit pathological behavior when a buffer could
not be written to the file in a single write() call.

Also, writeFile was not quite as optimized as it could be.
2010-11-14 01:43:30 -08:00
Ryan Dahl d787a444c5 Use require('javascript') instead of process.binding('evals') 2010-11-13 15:19:15 -08:00
Ryan Dahl c7b24efd21 Move ev_loop out of javascript 2010-11-11 16:34:26 -08:00
Ryan Dahl 06267f4d8d Remove -e from echo in test. Non-portable 2010-11-10 22:32:26 -08:00
Guillaume Tuton 07da49b095 Set FD_CLOEXEC flag on stdio FDs before spawning.
With regression test.
2010-11-07 13:07:14 -08:00
Ben Noordhuis b4def4806c Make writes to process.env update the real environment. Tests included. 2010-11-03 12:15:07 -07:00
Ryan Dahl 07812c47a4 Add test for http-buffer problem
Already fixed in 7e24a05cba
2010-11-01 18:23:13 -07:00
Ryan Dahl 97c9745063 Back to WAF
Too much instability right now. Hopefully we can revisit autoconf soon.
2010-11-01 16:51:20 -07:00
Chandra Sekar S 2b08bacd56 Removed range read optimization as it doesn't work with libeio. 2010-11-01 08:28:57 -07:00
Ryan Dahl 7a48fd8455 Handle null values in clearTimeout 2010-10-29 00:00:43 -07:00
isaacs 987cbbc191 Handle cyclic links smarter in fs.realpath
Rather than aborting in the face of *any* repeated link in a given path,
instead only abort if such a cycle actually makes a given path unresolvable.

Test for this by doing a normal stat.  Still use the seenLinks object to
cache link contents so as to cut own a little bit on readlink calls.

Also add a pathological test that fails without the change to fs.js.
2010-10-27 17:02:42 -07:00
Ryan Dahl 2470d2ee92 allowHalfOpen disabled by default
Users too often would forget to add

  socket.on('end', function () {
    socket.end();
  });

Which is a mistake. Therefore we default to this behavior and
only optionally let people handle the 'end' case themselves.
2010-10-26 01:10:18 -07:00
Ryan Dahl fcd0c3ebc0 Remove test-base64-bigfile
Already tested in test/simple/test-buffer.js. Takes too long, uses too much
memory.
2010-10-24 19:21:12 -07:00
Ryan Dahl 15594eaf87 Replace WAF with make/autoconf 2010-10-24 18:39:36 -07:00
Ryan Dahl 477df1aaec Revert "Add some failing tests for path.join"
This reverts commit 8c0e87f9c3.

(Revert until fix comes)
2010-10-23 15:35:58 -07:00
Ryan Dahl 38f117cb6d one more 'listening' race condition 2010-10-23 14:26:31 -07:00