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

1860 Commits

Author SHA1 Message Date
Dmitry Nizovtsev
1e9bcf26ce net, http, https: add localAddress option
Binds to a local address before making the outgoing connection.
2012-03-06 13:35:49 +01:00
isaacs
959a19e118 lint 2012-03-03 23:48:57 -08:00
ssuda
578ba76e6c util: fix util.format() formatting of %% 2012-03-03 18:22:34 +01:00
Jimb Esser
78db18739a tls: proxy set(Timeout|NoDelay|KeepAlive) methods
- fix crash calling ClientRequest::setKeepAlive if the underlying request is
  HTTPS.
- fix discarding of callback parameter when calling ClientRequest::setTimeout on
  HTTPS requests.
- fix discarding of noDelay parameter when calling ClientRequest::setNoDelay on
  HTTPS requests.
2012-03-03 00:28:43 +01:00
Blake Miner
7343f8e776 tls: add honorCipherOrder option to tls.createServer()
Documented how to mitigate BEAST attacks.
2012-02-29 02:16:08 +01:00
Joshua Holbrook
56cfcea4b4 child_process: remove dummy "setsid" option setting 2012-02-29 02:10:56 +01:00
Joshua Holbrook
4065b241e8 child_process: remove dummy "setsid" option setting 2012-02-29 02:06:20 +01:00
koichik
cd5d2473a4 net: fix race write() before and after connect()
Fixes #2827.
2012-02-28 19:57:13 +09:00
koichik
63431796f4 net: fix race write() before and after connect()
Fixes #2827.
2012-02-28 19:27:27 +09:00
isaacs
44daa9836b Wrap NodeScript binding class in JavaScript layer
This makes it easy to prevent errors where Script methods
are called on non-script objects, resulting in Assertion failures.
2012-02-27 17:28:42 -08:00
AJ ONeal
493a6bb19a [ISSUE #2554 #2567] throw if fs args for 'start' or 'end' are strings 2012-02-27 14:18:51 -08:00
AJ ONeal
7f58d207f3 [ISSUE #2554 #2567] throw if fs args for 'start' or 'end' are strings 2012-02-27 14:17:09 -08:00
Mathias Bynens
483edbdf1a punycode: Update to v1.0.0 2012-02-27 14:03:18 -08:00
Mathias Bynens
cacd651ec6 punycode: Update to v1.0.0 2012-02-27 14:00:18 -08:00
Roly Fentanes
db8940dae2 newListener emits correct fn when using once
Fixes #2826.
2012-02-25 15:37:38 +09:00
isaacs
d3b8372615 lint, missed in QS speed merge 2012-02-22 20:58:24 -08:00
Ben Noordhuis
3502e45b6c dgram: defer send error to next tick 2012-02-23 02:07:39 +01:00
Ben Noordhuis
defa637378 dgram: fix out-of-bound memory read 2012-02-23 02:07:39 +01:00
Colton Baker
fd61bfc731 readline: ^Z (SIGSTP) handling
Bugfix and update.

- Fixed bug where Node's REPL wouldn't continue when returning from ^Z
  (SIGTSTP)
- Removed old readline callback

Readline API update with docs.

- ^Z (SIGTSTP) is now bypassed on Windows systems.
- SIGCONT is now bypassed on Windows systems.
- Docs updated to reflect above.
2012-02-22 16:07:23 -08:00
Colton Baker
ac9fa2b846 Removed rl.on('close', ...) callback 2012-02-22 16:05:55 -08:00
Brian White
5e3ca98155 Make QueryString.parse() even faster 2012-02-21 12:17:26 -08:00
Tomasz Buchert
c6a04ce78f crypto: add function getDiffieHellman()
Returns a well known, predefined RFC group.
2012-02-21 14:07:25 +01:00
Maciej Małecki
da908364a8 tls http https: don't pollute user's options object 2012-02-20 21:58:00 +01:00
Maciej Małecki
c6c6f98f1c util: add util._extend for extending objects
There were 2 duplicates with such functionality in `cluster` and
`child_process` modules which were replaced by this function.
2012-02-20 21:58:00 +01:00
Ben Noordhuis
86f4846c21 url: decode url entities in auth section
Fixes #2736.
2012-02-20 17:11:21 +01:00
Brandon Benvie
b72277183f repl: add automatic loading of built-in libs 2012-02-20 13:56:27 +01:00
Luke Gallagher
8d3c46daa8 util: fix typo in lib/util.js 2012-02-20 13:42:27 +01:00
Mikeal Rogers
d530ee62cd Issue #2762. Add callback to close function. 2012-02-18 17:46:28 -08:00
isaacs
0cdf85e28d Lint all the JavaScripts. 2012-02-18 15:34:57 -08:00
isaacs
31721da4b1 Merge remote-tracking branch 'ry/v0.6' into v0.6-merge
Conflicts:
	AUTHORS
	ChangeLog
	Makefile
	doc/about/index.html
	doc/api/tls.markdown
	doc/community/index.html
	doc/index.html
	doc/logos/index.html
	doc/template.html
	lib/http.js
	lib/tls.js
	src/node_version.h
	src/platform_win32.cc
	test/simple/test-tls-connect-given-socket.js
2012-02-18 09:46:58 -08:00
isaacs
dfed2cef75 Merge branch 'v0.6.11-release' into v0.6 2012-02-17 13:35:52 -08:00
isaacs
a2851b6234 Revert "cluster: propagate bind errors"
This reverts commit 30e462e919.
2012-02-17 12:39:45 -08:00
Fedor Indutny
ae5e23310e repl: remove double calls where possible
Repl is doing double evaluation of code: wrapped in parens and without
them. That's needed to allow users typing multiline chunks of code by
handling syntax errors on repl side. However if function declaration is
wrapped in parens (`(function a() {})`) calling it will be impossible,
so we're evaluating functions twice. That works fine for declaration,
but if entered code chunk returns function - it should not be called
twice.

fix #2773
2012-02-18 00:30:52 +06:00
Nathan Rajlich
a118f21728 repl: make tab completion work on non-objects 2012-02-17 15:51:33 +01:00
Ben Noordhuis
30e462e919 cluster: propagate bind errors
This commit fixes a bug where the cluster module failed to propagate EADDRINUSE
errors.

When a worker starts a (net, http) server, it requests the listen socket from
its master who then creates and binds the socket.

Now, OS X and Windows don't always signal EADDRINUSE from bind() but instead
defer the error until a later syscall. libuv mimics this behaviour to provide
consistent behaviour across platforms but that means the worker could end up
with a socket that is not actually bound to the requested addresss.

That's why the worker now checks if the socket is bound, raising EADDRINUSE if
that's not the case.

Fixes #2721.
2012-02-16 23:47:17 +01:00
einaros
83fd1c1de5 Add WebSocket RFC6455 multiheader fields to the http parser. 2012-02-16 14:12:38 -08:00
Ben Noordhuis
2c07712860 http: allow multiple WWW-Authenticate headers 2012-02-16 14:11:49 -08:00
Ben Noordhuis
3415427dbf tls: mitigate session renegotiation attacks
The TLS protocol allows (and sometimes requires) clients to renegotiate the
session. However, renegotiation requires a disproportional amount of server-side
resources, particularly CPU time, which makes it a potential vector for
denial-of-service attacks.

To mitigate this issue, we keep track of and limit the number of renegotiation
requests over time, emitting an error if the threshold is exceeded.
2012-02-16 18:15:21 +01:00
Colton Baker
ce485791db Readline proposal and bugfixes. Related: #2737 #2756
- Removed extra newline from .question(); Users can input a
  newline if it they require it.
- Removed .close() due to it only emulating closing, causing a bug where
  readline is left open to trigger events such as .on('line', ...').
- Removed ._attemptClose()
- .pause() now triggers event .on('pause', ...)
- .resume() now triggers event .on('resume', ...)
- CTRL-C (SIGINT) in readline will now default to .pause() if no SIGINT event
  is present.
- CTRL-D (delete right) will also default to .pause() if there is nothing to
  delete (signaling the end of the file).
- Added new event `SIGTSTP`
- Added new event `SIGCONT`
- Added `resume` to `write` to resume the stream if paused.
- Docs updated.
- Updated repl.js
2012-02-16 12:12:03 +06:00
Bert Belder
d91bc7cb09 Windows: get rid of process._cwdForDrive() 2012-02-16 00:10:51 +01:00
Mark Nottingham
1e425e3fa7 Generate Date headers on responses when not already present. 2012-02-15 12:35:34 -08:00
Ben Noordhuis
6141386f7e http: allow multiple WWW-Authenticate headers 2012-02-15 17:04:10 +01:00
koichik
b19b8836c3 tls: Allow establishing secure connection on the existing socket 2012-02-14 11:53:05 -08:00
Seth Fitzsimmons
1ce14eca44 dgram: handle close of dgram socket before DNS lookup completes 2012-02-14 14:10:21 +01:00
Fedor Indutny
3f43b1c039 debugger: export debug_port to process
`process.debug_port` is useful for changing debugger port in runtime,
before starting it (via SIGUSR1).

Using `--port=` argument for debugger repl, tests will run debugger
server on a `common.PORT` (as it usually does for any other servers).

`process._debugEnd()` stops debugger and its server.

* debugger: implemented process._debugEnd(), `node debug --port=5858 app.js`
* test: start debugger repl on common.PORT
* fixes #2613
* fixes #2614
2012-02-12 22:27:12 +06:00
Ben Noordhuis
8a6576f764 Merge remote-tracking branch 'origin/v0.6'
Conflicts:
	common.gypi
2012-02-12 16:12:26 +01:00
Igor Zinkovsky
c7771bc2ec set readable/writable for pipes 2012-02-10 11:28:43 -08:00
Andreas Madsen
9da830e895 child_process: stop .disconnect() call if channel is diconnected 2012-02-08 11:42:38 -08:00
Ben Noordhuis
09c296b44d debugger: fix --debug-brk
Commit 840229a forgot to update the debugger special case in lib/module.js

Fixes #2710.
2012-02-07 23:16:40 +01:00
isaacs
116835561d Merge remote-tracking branch 'ry/v0.6'
Conflicts:
	ChangeLog
	deps/v8/src/version.cc
	deps/v8/tools/gyp/v8.gyp
	doc/about/index.html
	doc/community/index.html
	doc/index.html
	doc/logos/index.html
	doc/template.html
	lib/path.js
	lib/querystring.js
	src/node_version.h
2012-02-06 15:43:21 -08:00
Andreas Madsen
1595a6e885 cluster: use process.disconnect method
After adding a .disconect method and connected flag in child_process
we should no longer use the process._channel object.
2012-02-06 14:54:11 -08:00
Andreas Madsen
a20872045a cluster: simplify process event handling
This simplify the internalMessage and exit event handling
And simply relay message and error event to the worker object
Note that the error event was not relayed before
2012-02-06 14:54:11 -08:00
koichik
c2dc673eb5 http: fix http-parser is freed twice
after response to CONNECT/Upgrade request.

Fixes #2704.
2012-02-07 02:29:28 +09:00
Ben Noordhuis
74a8215a86 Revert support for isolates.
It was decided that the performance benefits that isolates offer (faster spin-up
times for worker processes, faster inter-worker communication, possibly a lower
memory footprint) are not actual bottlenecks for most people and do not outweigh
the potential stability issues and intrusive changes to the code base that
first-class support for isolates requires.

Hence, this commit backs out all isolates-related changes.

Good bye, isolates. We hardly knew ye.
2012-02-06 15:44:42 +01:00
koichik
0f0af55a0a net: fix large file downloads failing
Fixes #2678.
2012-02-05 17:41:49 +09:00
Christopher Jeffrey
f64989e63b fs: fix ReadStream fails to read from existing fd
A ReadStream constructed from an existing file descriptor failed to start
reading automatically. Avoids a userspace call to ReadStream.prototype._read().
2012-02-04 22:14:58 +01:00
Stefan Rusu
4671e54495 net: destroy socket on DNS error
The socket was never destroyed on DNS errors. This broke some clients, including
lib/https.js.
2012-02-04 00:40:53 +01:00
Bert Belder
e5ea6ad0f0 _makeLong shouldn't turn the empty string into \\?\C:\ 2012-02-02 17:14:03 +01:00
Bert Belder
a661830569 Run path.exists paths through _makeLong 2012-02-02 17:14:01 +01:00
Philip Tellis
5166758927 Make QueryString.parse run faster
Use decodeURIComponent when appropriate, and only fall back to
querystring.decode if it throws, or if the character is a '+'.

Fix #2248
2012-02-01 16:04:01 -08:00
Ben Noordhuis
3deceaf6e7 Revert "Process symlinked shared library as .node"
This reverts commit 7e0bf7d57d.

It's possible to make GYP generate an XCode project that produces a .node file,
hence this commit is no longer needed.
2012-02-01 22:49:56 +01:00
Ben Noordhuis
a9723df1b7 Revert "Process symlinked shared library as .node"
This reverts commit 7e0bf7d57d.

It's possible to make GYP generate an XCode project that produces a .node file,
hence this commit is no longer needed.
2012-02-01 22:28:23 +01:00
isaacs
bd21038078 Merge remote-tracking branch 'ry/master' into merge-v0.6 2012-01-31 18:22:10 -08:00
isaacs
18d179c2d8 Merge remote-tracking branch 'ry/v0.6' into master
Conflicts:
	ChangeLog
	deps/uv/src/unix/udp.c
	deps/uv/src/win/fs.c
	deps/uv/src/win/udp.c
	deps/uv/test/test-fs.c
	doc/index.html
	doc/logos/index.html
	doc/template.html
	src/node_version.h
2012-01-31 18:18:00 -08:00
Paddy Byers
7e0bf7d57d Process symlinked shared library as .node 2012-01-31 17:50:16 -08:00
Paddy Byers
840229a825 Tidy _resolveFilename 2012-01-31 17:50:11 -08:00
Igor Zinkovsky
db3c4efd1d support for sharing streams accross isolates 2012-01-31 17:45:50 -08:00
Andreas Madsen
33b7fc250f child_process: do not disconnect on exit emit
When using isolate the .fork would break because it had
no .disconnect method. This remove the exit handler there
would call .disconnect since it was not required.
It also change .disconnect to throw if the channel is closed,
this was not possible before because .disconnect would be called
twice.
2012-01-31 17:22:21 -08:00
Ben Noordhuis
279e7e7341 fs: add O_EXCL support, exclusive open file 2012-01-31 14:29:32 +01:00
Ben Noordhuis
88b919ea56 fs, test: add file open mode tests 2012-01-31 14:29:27 +01:00
Łukasz Walukiewicz
a94ffdaec5 url: Support for IPv6 addresses in URLs.
Fixes #1138, #2610.
2012-01-31 16:58:41 +09:00
Andreas Madsen
836344c90e Add disconnect method to forked child processes
This disconnect method allows the child to exit gracefully.
This also adds a disconnect event and connect property.
2012-01-30 16:35:27 +01:00
koichik
3fd13c6426 http: fix free http-parser too early
when the status code is 100 (Continue).

Fixes #2636.
2012-01-31 00:16:01 +09:00
Ben Noordhuis
b221fe9b29 timers: add v0.4 compatibility hack
If a timer callback throws and the user's uncaughtException handler ignores the
exception, other timers that expire on the current tick should still run.

If #2582 goes through, this hack should be removed.

Fixes #2631.
2012-01-30 14:12:23 +01:00
Brandon Benvie
5403a8ce4c core: add NativeModule.prototype.deprecate
Formalize and cleanup handling of deprecated core methods.
2012-01-30 00:27:07 +01:00
Dan VerWeire
e4afb2f724 tty: emit 'unknown' key event if key sequence not found
Add key.code and key.sequence -mad props go out to @TooTallNate
2012-01-28 17:01:04 +01:00
Fedor Indutny
ccf7b41a69 module: fix --debug-brk on symlinked scripts
* fixes #1519
2012-01-24 19:07:38 +01:00
Fedor Indutny
27c85727ed module: fix --debug-brk on symlinked scripts
* fixes #1519
2012-01-24 23:13:37 +06:00
Ben Noordhuis
e806ad39d0 net, tls, http: remove socket.ondrain
Replace the ondrain hack with a regular 'drain' listener. Speeds up the
bytes/1024 http benchmark by about 1.2%.
2012-01-24 15:57:50 +01:00
koichik
a6f3451e25 http: fix test-http-should-keepalive.js is fail
3df7c90 was removed when conflict was resolved.
2012-01-24 13:57:20 +09:00
Ben Noordhuis
2775c0e97e dgram: bring back setTTL() 2012-01-24 00:11:45 +01:00
Ben Noordhuis
46e86aa803 dgram: bring back setMulticastLoopback() 2012-01-24 00:11:45 +01:00
Ben Noordhuis
6999fb3d1e dgram: make addMembership() and dropMembership() conform to v0.4 API
- throw on error, don't return an error code
2012-01-24 00:05:34 +01:00
Ben Noordhuis
fc6a9673c8 dgram: make setBroadcast() conform to v0.4 API
- don't return a value
2012-01-24 00:05:34 +01:00
Ben Noordhuis
ed111975a0 dgram: make setMulticastTTL() conform to v0.4 API
- throw if the ttl argument is not a number
- return the ttl argument (not particulary useful but it's what v0.4 did)

Note that the 0 < ttl < 256 check has *not* been reinstated. On Linux, -1 is a
valid argument to setsockopt(IPPROTO_IP, IP_TTL).
2012-01-24 00:05:34 +01:00
Fedor Indutny
667aae596c Merge branch 'v0.6'
Conflicts:
	ChangeLog
	doc/template.html
	lib/cluster.js
	lib/http.js
	lib/tls.js
	src/node.h
	src/node_version.h
	test/simple/test-cluster-kill-workers.js
2012-01-24 00:30:28 +06:00
Brandon Benvie
f9014438c7 util: use getOwnPropertyDescripter
Change formatProperty in util.js to use Object.getOwnPropertyDescriptor
instead of __lookup[GS]etter__.

Use the cached value from the descriptor to reduce number of property
lookups from 3 to 1.

Fallback to standard lookup if the descriptor is empty. This doesn't
ever happen with normal JS objects (this function is called only when
the key exists) but apparently does with Node's custom ENV interface.

Fixes: #2109.
2012-01-22 17:29:40 +09:00
koichik
3df7c90c30 http: keep-alive should default with HTTP/1.1 server
As RFC 2616 says we should, assume that servers will provide a persistent
connection by default.

> A significant difference between HTTP/1.1 and earlier versions of
> HTTP is that persistent connections are the default behavior of any
> HTTP connection. That is, unless otherwise indicated, the client
> SHOULD assume that the server will maintain a persistent connection,
> even after error responses from the server.

> HTTP/1.1 applications that do not support persistent connections MUST
> include the "close" connection option in every message.

Fixes #2436.
2012-01-22 14:55:41 +09:00
Maciej Małecki
e10ed097cb path fs: move path.exists* to fs.exists*
`path.exists*` functions show a deprecation warning and call functions
from `fs`. They should be removed later.

test: fix references to `path.exists*` in tests

test fs: add test for `fs.exists` and `fs.existsSync`

doc: reflect moving `path.exists*` to `fs`
2012-01-21 14:37:14 +01:00
Ben Noordhuis
56e34c2f81 http: fix deprecation warning module ID
Mea culpa, I told @mmalecki wrong
2012-01-21 14:34:33 +01:00
Dan VerWeire
f2b1f57f74 dgram: reintroduce setMulticastTTL()
Removed during the early stages of node 0.5 refactoring to libuv.
2012-01-21 03:26:09 +01:00
Dan VerWeire
f749338e1e dgram: reintroduce setBroadcast()
Removed during the early stages of node 0.5 refactoring to libuv.
2012-01-21 03:26:04 +01:00
Roman Shtylman
a38fd6056c dgram: reintroduce addMembership() and dropMembership()
Removed during the early stages of node 0.5 refactoring to libuv.
2012-01-21 03:21:51 +01:00
koichik
35fe3eb5c7 http: reduce creating http-parser instances
Fixes #2577.
2012-01-20 16:24:01 -08:00
Nicolas LaCasse
40c93486e8 Fix #2365 zlib crashing on invalid input
Fix zlib crashes on error due to improper use of removeListener
in the error handler
2012-01-20 13:12:32 -08:00
Andreas Madsen
f9a47debfc Add cluster.setupMaster
Fixes #2470
2012-01-20 13:09:56 -08:00
Brandon Benvie
f7b612550a Add missing TTY key translations for F1-F5 on Windows 2012-01-18 16:00:55 +01:00
Bert Belder
d489a01f81 Make path.extname do the right thing when the last path component is . or ..
Closes GH-2526
2012-01-18 15:21:58 +01:00
Ben Noordhuis
d44ce97909 cluster: don't always kill the master on uncaughtException
uncaughtException handlers installed by the user override the default one that
the cluster module installs, the one that kills off the master process.

Fixes #2556.
2012-01-18 00:45:02 +01:00
Andreas Madsen
70884875c9 Allow calling fork() without args or options
Closes GH-2424
2012-01-17 19:07:57 +01:00
Andreas Madsen
ca6ededbd1 child_process: add errno property to exceptions
In case of a write failure when using fork() an error would be thrown. The
thrown exception was missing the `errno` property.
2012-01-17 18:37:02 +01:00
koichik
534df2f8d2 tls: fix double 'error' events on HTTPS Requests
Fixes #2549.
2012-01-17 17:09:27 +01:00
Ryan Dahl
ca2a047b8e Merge remote branch 'origin/v0.6'
Conflicts:
	deps/uv/src/win/util.c
	src/udp_wrap.cc
2012-01-16 15:20:26 -08:00
Maciej Małecki
d5047f5fe6 http: use util._deprecationWarning for deprecation warning 2012-01-16 19:45:14 +01:00
Fedor Indutny
03e689fae4 Revert "util: always display a warning for module in debug mode"
This reverts commit df62005ece.
2012-01-16 19:33:16 +06:00
Maciej Małecki
df62005ece util: always display a warning for module in debug mode 2012-01-16 19:19:56 +06:00
Fedor Indutny
23de33968f querystring: fix maxKeys = 0 is ignored 2012-01-16 16:36:24 +06:00
Fedor Indutny
f1678bfc65 http: do not accept headers if limit is exceeded
* fix limiting when parser was reused
* fix maxHeadersCount = 0 is ignored ( credit to @koichik )
* add test-http-max-headers-count.js ( credit to @koichik )
2012-01-16 16:36:23 +06:00
Fedor Indutny
8a98c2f1d8 http, querystring: added limits to prevent DoS 2012-01-16 02:45:05 +06:00
Ben Noordhuis
f0c1376e07 net: make .write() throw on bad input
Passing a non-buffer or non-string argument to Socket.prototype.write triggered
an assert:

  Assertion failed: (Buffer::HasInstance(args[0])), function Write,
  file ../src/stream_wrap.cc, line 289.

Fixes #2532.
2012-01-14 02:13:24 +01:00
koichik
7dffbaf2ce http: Upgrade/CONNECT request should detach its socket earlier
With Upgrade or CONNECT request, http.ClientRequest emits 'close' event
after its socket is closed. However, after receiving a response, the socket
is not under management by the request.

http.ClientRequest should detach the socket before 'upgrade'/'connect'
event is emitted to pass the socket to a user. After that, it should
emit 'close' event immediately without waiting for closing of the socket.

Fixes #2510.
2012-01-12 14:17:19 +09:00
Fedor Indutny
71ae175319 zlib: reset() method for deflate/inflate streams
* ammended test-zlib-dictionary to cover reusing streams
2012-01-12 03:19:19 +06:00
Mathias Bynens
8abb73ef58 punycode: Update to v0.3.0 2012-01-11 10:42:39 +01:00
Andreas Madsen
c8108aad83 child_process: fix typo in internal message event name 2012-01-11 09:59:50 +01:00
Maciej Małecki
4d49469d0d child_process: fix typo in internal message event name 2012-01-10 23:16:07 +01:00
Fedor Indutny
6b2091b58a debug threads 2012-01-10 02:28:49 +01:00
Ryan Dahl
b28e700ebd require('sys') now throws
To be removed in v0.9
2012-01-09 12:59:28 -08:00
Ryan Dahl
8b28d599a7 Merge remote branch 'origin/v0.6'
Conflicts:
	Makefile
	configure
	src/node_version.h
2012-01-09 11:20:22 -08:00
Ryunosuke SATO
22d7fe1206 events: fix checking max listeners with 1
Fixes #2490.
2012-01-09 04:02:01 +01:00
koichik
08a91acd76 http: better support for CONNECT method.
Introduces 'connect' event on both client (http.ClientRequest) and
server (http.Server).

Refs: #2259, #2474.
Fixes #1576.
2012-01-09 03:51:06 +01:00
koichik
c1a63a9e90 tls: Allow establishing secure connection on the existing socket
This is necessary to use SSL over HTTP tunnels.

Refs #2259, #2474.
Fixes #2489.
2012-01-09 02:31:46 +01:00
koichik
70033bd960 net: make connect() accept options
This makes API even with tls.connect().
Refs #1983.

See also:
http://groups.google.com/group/nodejs-dev/msg/3b6dbcc4a9a82d99

Fixes #2487.
2012-01-09 02:18:39 +01:00
Maciej Małecki
df0edf5fe6 https: make https use new tls.connect API
Refs #1983.
2012-01-08 11:13:18 +01:00
Maciej Małecki
4b4d059791 tls: make tls.connect accept port and host in options
Previous API used form:

    tls.connect(443, "google.com", options, ...)

now it's replaced with:

    tls.connect({port: 443, host: "google.com", ...}, ...)

It simplifies argument parsing in `tls.connect` and makes the API
consistent with other parts.

Fixes #1983.
2012-01-08 11:12:56 +01:00
koichik
dd9593ccc4 http: fix ServerResponse does not emit 'close'
Refs #2453.
2012-01-06 15:45:21 +09:00
Ben Noordhuis
42281124d4 child_process: add isolates support
Passing an options object with {thread:true} to .fork() or .spawn() will run the
target script in a thread instead of a separate process.
2012-01-06 00:47:14 +01:00
Emerson Macedo
aa67b1f375 fs: add appendFile() and appendFileSync() functions 2012-01-05 21:39:57 +01:00
koichik
baebd30eee http: use self insted of this 2012-01-05 17:43:00 +09:00
Andreas Madsen
e2f1e50c60 typos
fixes #2465
2012-01-05 00:31:49 -08:00
Andreas Madsen
5f08c3cfa1 cluster improvements: Worker class and isolate internal messages
Fixes #2388
2012-01-04 18:30:19 -08:00
Ben Noordhuis
c123ac05dc Merge remote-tracking branch 'origin/v0.6'
Conflicts:
	src/udp_wrap.cc
2012-01-02 12:29:39 +01:00
isaacs
8e57398b20 Fix #2034 repl message for .clear when useGlobal=true 2011-12-31 03:20:41 +01:00
Ben Noordhuis
c24276f008 net: defer net.Server 'close' event to next tick 2011-12-29 19:30:07 +01:00
Damon Oehlman
744ed46970 repl: fix repl.start not passing the ignoreUndefined arg to the REPLServer constructor 2011-12-29 14:46:04 +01:00
Ryan Dahl
4428b70cba Add isolate version of test-child-process-fork 2011-12-29 01:56:11 +01:00
Ben Noordhuis
bc7bae1d6b Merge remote-tracking branch 'origin/v0.6'
Conflicts:
	src/platform_win32.cc
2011-12-29 01:49:10 +01:00
koichik
a848a3efbf net: fix Socket.pause null reference when called on a closed Stream
Fixes #1980.
2011-12-28 15:13:57 +09:00
koichik
a337ac7584 http: fix XMLHttpRequest piped in a writable file stream hangs next request
Fixes #2263.
2011-12-27 17:42:37 +09:00
koichik
b962ff35dd tls: fix test-https-client-reject fails
Fixes #2417.
2011-12-27 17:33:23 +09:00
koichik
e6b6075024 http: Avoid 'data'/'end' events after pause()
Fixes #1040.
2011-12-26 16:14:47 +01:00
koichik
7aa5924dc6 http: fix resource leak
Fixes #2069
2011-12-26 08:05:35 +01:00
Ryan Dahl
48a9a2d355 Add deprecation message for http.Client 2011-12-23 17:42:27 -08:00
Ryan Dahl
c2d9e62f16 Merge remote branch 'origin/v0.6'
Conflicts:
	deps/v8/src/version.cc
2011-12-23 15:58:11 -08:00
Phil Sung
cf2513e1aa buffer: don't pollute global namespace in buffer.readInt* 2011-12-22 23:26:43 +01:00
Ju-yeong Park
5976d58796 net: raise exception when the socket is closed 2011-12-22 17:25:14 +01:00
Ben Noordhuis
d8c178bc16 timers: fix performance regression
Fix a 5-7% performance regression in the http_simple benchmark that was
introduced by the following commits:

  348d8cd timers: remove _idleTimeout from item in .unenroll()
  f2f3028 timers: fix memory leak in setTimeout
  098fef6 timers: remember extra setTimeout() arguments when timeout==0

Fix suggested by Bert Belder.
2011-12-22 14:42:25 +01:00
Ryan Dahl
f7f8af8420 Merge remote branch 'origin/v0.6'
Conflicts:
	Makefile
	lib/_debugger.js
2011-12-21 12:17:23 -08:00
koichik
07c27e040e tls: Fix node swallows openssl error on request
Fixes #2308.
Fixes #2246.
2011-12-21 19:48:15 +01:00
Ben Noordhuis
7a7f1062bf tls: remove duplicate assignment 2011-12-21 15:01:07 +01:00
Bert Belder
f4e34f1b76 Remove unnecessary statement 2011-12-20 17:15:22 +00:00
James Hartig
348d8cd04a timers: remove _idleTimeout from item in .unenroll()
Stops .active() from reactivating the timer.

Fixes #2114.
2011-12-20 00:57:15 +01:00
Maciej Małecki
5c7532e5b3 assert: test RegExp's properties when checking for equality
Previous code ignored the fact that `/a/ != /a/g`.

Test case included.
2011-12-20 00:10:49 +01:00
Pedro Teixeira
a805012d6f assert: .deepEqual() support for RegExp objects 2011-12-20 00:10:38 +01:00
Fedor Indutny
d87f551f36 debugger: Request backtrace w/o refs, see #1745
Fixes #2379
2011-12-19 13:30:43 -08:00
Andreas Madsen
3966e4e7a5 Remove debug console.log and optimize object copy
Fixes #2380
2011-12-19 13:25:19 -08:00
Andreas Madsen
07b1997388 Add env argument to cluster.fork
Fixes 2378
2011-12-19 12:34:59 -08:00
Fedor Indutny
80858761a8 break on exception
Fixes #2304
2011-12-19 11:09:40 -08:00
Fedor Indutny
a239ea0d40 use inlineRefs, as it's already impl 2011-12-19 11:09:16 -08:00
Fedor Indutny
b00b2f08bf pass noRefs as arguments 2011-12-19 11:09:16 -08:00
Fedor Indutny
b0388ccad0 pause command 2011-12-19 11:09:16 -08:00
Fedor Indutny
07ad11916f allow setBreakpoint(line) 2011-12-19 11:09:16 -08:00
Fedor Indutny
c07edd90f5 preserve cursor pos
* configurable via .prompt()'s preserveCursor argument (false by default)
2011-12-19 11:09:16 -08:00
Fedor Indutny
d9377f5eb0 request backtrace w/o refs, see #1745 2011-12-19 11:09:16 -08:00
Nathan Rajlich
3f987cd925 module: Set the error.code to 'MODULE_NOT_FOUND' when a bad path is given to require.
Fixes #2358.
2011-12-19 23:46:41 +09:00
Avi Flax
ee0a7b928b util: output Dates with Date.toString not Date.toUTCString 2011-12-18 23:07:47 +01:00
Yoshihiro Kikuchi
f2f30286bf timers: fix memory leak in setTimeout
Closing handle is leaked when setTimeout called with arguments which are
1. a callback
2. zero delay
(i.e. setTimeout(function(){}, 0); )
2011-12-18 01:50:01 +01:00
Ben Noordhuis
6df7bdd954 child_process: make .send() throw if message is undefined
JSON.stringify(undefined) returns "undefined" but JSON.parse() doesn't know how
to parse that.
2011-12-18 01:29:07 +01:00
Andreas Madsen
b084322f52 Add silent option to child_process.fork
Fixes #2354.
2011-12-17 12:53:44 -08:00
Ryan Dahl
1865b11dcb Merge remote branch 'origin/v0.6'
Conflicts:
	wscript
2011-12-16 13:57:36 -08:00
Andreas Madsen
a599aeb2a8 jslint
Fixes #2306
2011-12-16 12:57:03 -08:00
Igor Zinkovsky
d6bae2cb95 document mode argument for fs.symlink 2011-12-16 11:16:33 -08:00
Ben Noordhuis
97900776bb util: add internal function _deprecationWarning() 2011-12-14 13:36:21 +01:00
Ben Noordhuis
b1b3dc62ff fs: handle fractional or NaN ReadStream buffer size
Fixes #2320.
2011-12-13 16:31:12 +01:00
Ben Noordhuis
8295c80618 net: check status code in afterWrite
Fixes memory leak and spin on writing to dead fds. This was tested in
production.
2011-12-12 13:45:44 -08:00
koichik
f8c335d0ca tls: enable rejectUnauthorized option to client
Fiexes #2247.
2011-12-07 22:47:06 +09:00
Ryan Dahl
2003593143 Merge remote branch 'origin/v0.6'
Conflicts:
	deps/v8/src/debug.cc
	deps/v8/src/version.cc
	src/node_version.h
2011-12-06 11:50:54 -08:00
isaacs
580e67015c Apply #2257 fix for Pipe streams as well as TTYs 2011-12-06 10:13:31 -08:00
Fedor Indutny
e609195202 [zlib] added dictionary support 2011-12-05 17:58:31 -08:00
isaacs
cf20b6bf65 Fix #2257 pause/resume semantics for stdin
This makes it so that the stdin TTY-wrap stream gets ref'ed on
.resume() and unref'ed on .pause()

The semantics of the names "pause" and "resume" are a bit weird, but the
important thing is that this corrects an API change from 0.4 -> 0.6
which made it impossible to read from stdin multiple times, without
knowing when it might end up being closed.  If no one has it open, this
lets the process die naturally.

LGTM'd by @ry
2011-12-05 16:47:11 -08:00
isaacs
db273818f6 s/NPM/npm/
http://npmjs.org/doc/faq.html#If-npm-is-an-acronym-why-is-it-never-capitalized
2011-12-05 16:20:44 -08:00
Ryan Dahl
60e26668b3 Remove superfluous 'new' 2011-12-04 00:09:10 -08:00
Ben Noordhuis
49ba55b100 Merge branch 'v0.6'
Conflicts:
	src/node_version.h
2011-12-02 16:34:33 +01:00
Igor Zinkovsky
99c9d19184 binding for uv_pipe_pending_instances 2011-12-01 13:57:47 -08:00
Ben Noordhuis
03eb41c2ec net: don't emit 'close' event twice
Don't allow `socket.destroy()` to run twice. The self-destruct sequence itself
is idempotent but it makes the 'close' and 'error' events fire more than once,
which may confuse listeners.

Fixes #2223.
2011-12-01 14:57:06 +01:00
Mathias Bynens
cf89beec6f punycode: Update to v0.2.1 2011-11-30 15:28:48 +01:00
Nathan Rajlich
b204006105 util: ensure that the .inspect function isn't the one being executed
Fixes #2225.
2011-11-30 14:14:24 +01:00
Ben Noordhuis
5fea00581b sys: print stack trace if NODE_DEBUG=sys 2011-11-29 19:22:13 +01:00
seebees
aab958b713 OutgoingMessage.prototype.write does not take Array
Changed the type checking for OutgoingMessage.prototype.write so it only accepts string and Buffer.

And test.
Fixes #2162
Fixes #2208
2011-11-29 16:52:15 +09:00
Thomas Shinnick
eba1f7b1a4 child_process: fix order of args to errnoException() 2011-11-28 20:45:01 +01:00
koichik
5451ba3aa8 tls: fix https with fs.openReadStream hangs
Fixes #2185.
Fixes #2198.
2011-11-27 16:31:45 +09:00
Bert Belder
cffd0bb68d Merge branch 'v0.6'
Conflicts:
	Makefile
	src/node_version.h
	test/simple/test-http-response-no-headers.js
2011-11-25 12:34:29 +01:00
Author: Igor Zinkovsky
1f16a7b6e5 Enable long paths on windows 2011-11-25 09:35:52 +01:00
Bert Belder
83152d174c Dgram: correctly report recvmsg errors 2011-11-24 19:11:13 +01:00
Bert Belder
86fba381fd Windows: correctly resolve drive-relative paths 2011-11-24 02:38:34 +01:00
isaacs
0ba78d5f36 Close #2166 Close the fd in lchmod 2011-11-22 14:00:48 -08:00
Ryan Dahl
8595981195 Merge remote branch 'origin/v0.6'
Conflicts:
	Makefile
	src/node_version.h
	test/simple/test-crypto.js
2011-11-22 13:01:10 -08:00
Felix Geisendörfer
b3f91f15b2 Remove support for multi-source pipe()
This reverts 6c5b31bd which had too few use cases, too much complexity,
and can be handled in user-land by using `{end: false}`.

Closes #1996
2011-11-22 08:51:19 -08:00
Ben Noordhuis
59a9a9b5b0 buffer: add .read*() and .write*() methods to SlowBuffer prototype
Fixes #2138.
2011-11-18 11:13:37 +01:00
E. Azer Koçulu
1cb6fe47fc util: remove the line requiring events 2011-11-17 23:01:39 +01:00
Ben Noordhuis
bed405cfea Merge remote branch 'origin/v0.6' 2011-11-17 20:06:50 +00:00
E. Azer Koçulu
e258169666 util: remove the line requiring events 2011-11-17 20:21:48 +01:00
Ben Noordhuis
5e3b0095de tls: make cipher list configurable
options.ciphers existed but didn't work, the cipher list was effectively
hard-coded to RC4-SHA:AES128-SHA:AES256-SHA.

Fixes #2066.
2011-11-17 00:01:41 +01:00
Łukasz Walukiewicz
3b852d7fab buffer: fix minimum values for writeInt*() functions 2011-11-16 21:30:26 +01:00
Łukasz Walukiewicz
5d0b5a00aa buffer: fix minimum values for writeInt*() functions 2011-11-16 21:27:26 +01:00
Mathias Bynens
897208e06d punycode: Update to v0.1.1. 2011-11-13 15:38:27 +01:00
seebees
3421f43351 .load, .save and local scope tab completion
Fixes #2063.

REPLServer.prototype.resetContext:
Reset the line cache

REPLServer.prototype.memory (don't know if I like that name, called from finish)
pushes what cmd's have been executed against it into this.lines
pushes the "tab depth" for bufferedCommands, in this.lines.level

REPLServer.prototype.displayPrompt:
Uses "tab depth" from this.lines.level to adjust the prompt to visually
denote this depth e.g.
> asdf = function () {
… var inner = {
….. one:1

REPLServer.prototype.complete:
Now notices if there is a bufferedCommand and attempts determine locally
scoped variables by removing any functions from this.lines and evaling these
lines in a nested REPL e.g.
> asdf = function () {
… var inner = { one: 1};
… inn\t
will complete to 'inner' and inner.o\t will complete to 'inner.one'
If the nested REPL still has a bufferedCommand it will falls back to the
default.

ArrayStream is a helper class for the nested REPL to get commands pushed to it.
new REPLServer('', new ArrayStream());

Finally added two new REPL commands .save and .load, each takes 1 parameter,
a file and attempts to save or load the file to or from the REPL
respectively.
2011-11-12 11:34:55 -08:00
Ben Noordhuis
098fef6740 timers: remember extra setTimeout() arguments when timeout==0
Fixes #2079.
2011-11-12 13:31:28 +01:00
Shigeki Ohtsu
e0f10ecfd9 debugger: correctly handle source with multi-byte characters 2011-11-11 20:29:50 +01:00
Ryan Dahl
4e2343c6b5 Fixes #2073. Cluster should be silent. 2011-11-11 11:24:59 -08:00
Ben Noordhuis
326b2cb34e punycode: replace with Mathias Bynens's implementation
The currently bundled library doesn't pass all the test cases from RFC 3492.
Mathias's library does.

Home: https://github.com/bestiejs/punycode.js
2011-11-11 17:02:43 +01:00
Ryan Dahl
74f39041d4 dont use blue for numbers in util.inspect 2011-11-10 23:35:35 -08:00
Igor Zinkovsky
13324bf844 throw from stdout.end and stderr.end 2011-11-10 14:51:16 -08:00
Ryan Dahl
0fa3cf94a3 Remove 'report this bug' message from cluster master 2011-11-08 17:07:49 -08:00
Ryan Dahl
da9bf0ee80 Fixes #2047. Fill workers array immediately after fork 2011-11-08 17:03:29 -08:00
Ryan Dahl
2d13cdfd2a Fixes #2052. Readline get win cols correctly 2011-11-08 13:37:08 -08:00
Benjamin Pasero
b1bb17fd2b fs: fix fs.realpath on windows to return on error 2011-11-08 13:02:04 +01:00
Ben Noordhuis
04958e88a4 fs: make mkdir() call callback if mode is omitted
Fixes #2043.
2011-11-08 12:48:09 +01:00
Ben Noordhuis
105d1787dc cluster: fix call to undefined function 2011-11-08 08:29:25 +01:00
Ryan Dahl
d42006c80a cluster: Remove eachWorker, workerCount
unnecessary
2011-11-04 15:14:38 -07:00
Ryan Dahl
86528489ec new cluster api 2011-11-04 15:12:11 -07:00
Matt Robenolt
5213c39038 Close #1930 Convenience methods for zlib
This is a combination of 20 commits. Their commit messages are preserved
below for the benefit of future generations.

* Adding a shortcut to easily compress/decompress a string of text.
* Making the API consistent. unzip should accept a Buffer for input as well.
* Adding docs.
* Oops, typo.
* Propagate error through the callback.
* Adding zlib from string tests.
* Typo in test.
* Remove 'end' listeners, and join buffers properly instead of joining them
  as a string.
* Oops, needs to be rendered to a string.
* Updated test to include multi-byte characters.
* unzip should return a raw Buffer. Updated docs to reflect.
* And finally updating test.
* EventEmitter.destroy() is a bit more customary
* Revert "EventEmitter.destroy() is a bit more customary"
* Renaming internal methods to "buffer" instead of string.
* Remove the 'error' listeners as well.
* @isaacs: spacing/style, and compress duplicate functions into one
* @isaacs: Update docs
* @isaacs: doc style fix
2011-11-04 10:32:57 -07:00
Fedor Indutny
b5d32d4a9e debugger: do not request continue on connection
* Updated test
* Use `node debug file`, not `node debug -e "..."` in test
2011-11-04 17:50:46 +01:00
Bert Belder
829735e738 Implement process._debugProcess 2011-11-04 17:50:28 +01:00
Bert Belder
189dd8f803 Fix line endings and trailing whitespace 2011-11-04 16:24:34 +01:00
Jordan Sissel
358f0ce96b url: add '.' '+' and '-' in url protocol
- Based on BNF from RFC 1738 section 5.
- Added tests to cover svn+ssh and some other examples
2011-11-04 13:36:06 +01:00
Ben Noordhuis
5fd012e67a fs: don't use octal values, not allowed in strict mode 2011-11-04 13:10:07 +01:00
Ryan Dahl
a936768890 stdout and stderr are blocking when referring to regular files
Fixes message tests.
2011-11-03 13:27:33 -07:00
Ryan Dahl
4a8088a603 Socket.write should reset timeout timer.
Fixes #2002.
2011-11-03 12:37:04 -07:00
Ben Noordhuis
9c11e8a1ca net: implement Server.prototype.address() for pipes 2011-11-03 19:16:10 +01:00
Ben Noordhuis
11d68eb3fc fs: make mkdir() default to 0777 permissions
Fixes #1999.
2011-11-03 09:37:23 +01:00
Ben Noordhuis
359a65a6db http: emit Error object after .abort()
It was emitting the net.Socket object due to misuse of the arguments object.

Fixes #1399.
2011-11-03 01:30:03 +01:00
Fedor Indutny
9ad27f7853 ignore undefined messages in the debugger repl
fixes #1995
2011-11-02 15:55:36 -07:00
Maciej Małecki
6bd0bcd5af child_process: in a new ChildProcess set killed to false
This behavior is consistent with what v0.4 does.
2011-11-02 18:17:51 +01:00
Ryan Dahl
60818b957c Add missing copyright headers 2011-11-02 10:00:57 -07:00
Maciej Małecki
fc61134b1a doc: fix links
Changes:

  * 'http://github.com' => 'https://github.com'
  * 'https://github.com/ry/node' => 'https://github.com/joyent/node'
  * 'https://github.com/ry/http-parser' =>
    'https://github.com/joyent/http-parser'
  * old issue links
  * wiki link
2011-11-01 22:26:52 +01:00
Igor Zinkovsky
3060266ff1 windows: enable pending accepts knob 2011-11-01 14:14:52 -07:00
Ben Noordhuis
37bb37d151 os: rename getNetworkInterfaces() to networkInterfaces() 2011-11-01 18:10:06 +01:00
koichik
f53d092a2a tls, https: add passphrase option
Fixes #1925.
2011-10-31 17:36:43 +09:00
koichik
8a729270c1 fix for --harmony_block_scoping
Fixes #1969.
2011-10-31 00:49:20 +09:00
Siddharth Mahendraker
12cf730b69 events: separate maxListeners and _events
Fixes #1479.
Fixes #1923.
2011-10-30 02:14:30 +01:00
Tj Holowaychuk
528c28587f cluster: Add some docs, improve cluster.isWorker()
Fixes #1949.
2011-10-26 16:42:00 -07:00
Ryan Dahl
c5d54010bc node cluster is now a module instead of CLI interface
This is to make room for master process plugins instead of adding CLI
options as proposed in #1879.
2011-10-26 13:50:53 -07:00
Nathan Rajlich
ebefe77bc0 More bulletproof util.inspect() function.
Use the *real* versions of the Date and RegExp functions, from the
prototype. This defends against code like:

  var d = new Date()
  d.toUTCString = null
  util.inspect(d)
    // TypeError: toUTCString is not a function

Fixes #1944.
2011-10-27 04:58:34 +09:00
Nathan Rajlich
2dbb470ea1 Don't use instanceof in lib/util.js "is" checks.
While using `instanceof`, these functions could easily be faked with something
like:  Object.create(Date.prototype)

So let's just not use it at all. A little slower, but these functions are only
used in the REPL / for debugging so it's OK.

Fixes #1941.
Fixes #1942.
2011-10-27 04:33:24 +09:00
Nathan Rajlich
b8f3e18a5d Export the type checking functions from util.js.
As per discussion at:
http://groups.google.com/group/nodejs-dev/browse_thread/thread/b08970166e4670cf
2011-10-27 03:38:29 +09:00
koichik
cbcaeedba9 tls: add address(), remoteAddress/remotePort
Fixes #758.
Fixes #1055.
2011-10-27 00:28:16 +09:00
koichik
0e8a55d2a2 tls: does not emit 'end' from EncryptedStream
de09168 and 4cdf9d4 breaks `test/pummel/test-https-large-response.js`.
It is never finished.

Fixes #1936.
2011-10-27 00:18:29 +09:00
Nathan Rajlich
58cb0fa639 Directly export the Stream constructor.
Also setting up a circular reference back to the
stream as `Stream.Stream`, for backwards-compatibility.

Fixes #1933
2011-10-24 15:45:35 -07:00
Ryan Dahl
239b3d62de Remove resume and pause events
Too complex; unnecessary.
2011-10-24 13:23:59 -07:00
isaacs
4c5751ba97 Close #1929 zlib Respond to 'resume' events properly 2011-10-24 12:55:45 -07:00