Commit Graph

1560 Commits (e02af94947bf3702648a9eb04d073090833d4e43)

Author SHA1 Message Date
isaacs d1effbb338 Merge branch 'http-memleak' into v0.6 2012-05-04 10:54:24 -07:00
isaacs 2fc528ce00 http: Clean up parser usage
Move parsers.free(parser) to a single function, which also
nulls all of the various references we hang on them.

Also, move the parser.on* methods out of the closure, so that
there's one shared definition of each, instead of re-defining
for each parser in a spot where they can close over references
to other request-specific objects.
2012-05-04 10:40:50 -07:00
isaacs e3ceee2dce http: .once() usage in setTimeout 2012-05-03 10:39:16 -07:00
isaacs b7e8e35c0e http leak: Null links from parser to req/res 2012-05-03 10:20:45 -07:00
vvo 75f2365558 Fix #3179 HTTP memory leak using ClientRequest. 2012-05-03 07:45:46 -07:00
Ben Noordhuis df2c5fa81d fs: fix file descriptor leak in sync functions
Fixes #3202. This is a back-port of commit 4e290e4.
2012-05-03 02:49:36 +02:00
Ben Noordhuis 47d6a94656 fs: fix ReadStream / WriteStream double close bug
* Calling fs.ReadStream.destroy() or fs.WriteStream.destroy() twice would close
  the file descriptor twice. That's bad because the file descriptor may have
  been repurposed in the mean time.

* A bad value check in fs.ReadStream.prototype.destroy() would prevent a stream
  created with fs.createReadStream({fd:0}) from getting closed.
2012-05-03 01:01:46 +02:00
isaacs c9be1d5ffd http client: Destroy on timeout 2012-05-02 12:13:54 -07:00
isaacs bce68134b6 http: Remove socket ondata/onend in parser cleanup 2012-05-01 15:25:59 -07:00
isaacs bfe9cdb7f2 Null references to request object on socket errors.
Regarding #3199 and #3179 and issues seen in production.
Hopefully this fixes them.
2012-05-01 14:26:18 -07:00
Bert Belder 55e4d54927 Child process: support the `gid` and `uid` options 2012-04-27 22:13:00 +02:00
isaacs c75f71dd72 fs.WriteStream: Handle modifications to fs.open
If the fs.open method is modified via AOP-style extension, in between
the creation of an fs.WriteStream and the processing of its action
queue, then the test of whether or not the method === fs.open will fail,
because fs.open has been replaced.

The solution is to save a reference to fs.open on the stream itself when
the action is placed in the queue.

This fixes isaacs/node-graceful-fs#6.
2012-04-09 09:03:00 -07:00
isaacs 45b772d8cb fs.readFile: Emit 'close' if we don't expect a close later
This fixes a regression introduced by 40b7302
2012-04-07 16:53:18 -07:00
Bert Belder 40b7302af8 fs.readFile: don't make the callback before the fd is closed
On Windows it is not possible to unlink() the read file in the callback.
This fixes #3051. A test is included.
2012-04-06 03:13:56 +02:00
Igor Zinkovsky 0dcc43316f don't crash when queued write fails 2012-03-22 17:09:22 -07:00
Joshua Holbrook 4065b241e8 child_process: remove dummy "setsid" option setting 2012-02-29 02:06:20 +01:00
koichik 63431796f4 net: fix race write() before and after connect()
Fixes #2827.
2012-02-28 19:27:27 +09: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
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
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
Bert Belder d91bc7cb09 Windows: get rid of process._cwdForDrive() 2012-02-16 00:10:51 +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
Igor Zinkovsky c7771bc2ec set readable/writable for pipes 2012-02-10 11:28:43 -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
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
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
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
Fedor Indutny ccf7b41a69 module: fix --debug-brk on symlinked scripts
* fixes #1519
2012-01-24 19:07:38 +01: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
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