Browse Source

Merge branch 'v0.4'

Conflicts:
	deps/libev/wscript
	doc/api/modules.markdown
v0.7.4-release
Ryan Dahl 14 years ago
parent
commit
041c983290
  1. 14
      deps/v8/src/v8natives.js
  2. 34
      deps/v8/test/mjsunit/execScript-case-insensitive.js
  3. 2
      deps/v8/test/mjsunit/function-names.js
  4. 33
      deps/v8/test/mjsunit/regress/regress-1341167.js
  5. 3
      doc/api/buffers.markdown
  6. 29
      doc/api/fs.markdown
  7. 9
      doc/api/globals.markdown
  8. 41
      doc/api/http.markdown
  9. 1
      doc/api/modules.markdown
  10. 2
      doc/api/stdio.markdown
  11. BIN
      doc/favicon.ico
  12. 4
      doc/index.html
  13. BIN
      doc/logo.png
  14. 98
      doc/logos/index.html
  15. BIN
      doc/logos/monitor.png
  16. BIN
      doc/logos/node-favicon.png
  17. BIN
      doc/logos/nodejs-1024x768.png
  18. BIN
      doc/logos/nodejs-1280x1024.png
  19. BIN
      doc/logos/nodejs-1440x900.png
  20. BIN
      doc/logos/nodejs-1920x1200.png
  21. BIN
      doc/logos/nodejs-2560x1440.png
  22. BIN
      doc/logos/nodejs-black.eps
  23. BIN
      doc/logos/nodejs-black.png
  24. BIN
      doc/logos/nodejs-dark.eps
  25. BIN
      doc/logos/nodejs-dark.png
  26. BIN
      doc/logos/nodejs-green.eps
  27. BIN
      doc/logos/nodejs-green.png
  28. BIN
      doc/logos/nodejs-light.eps
  29. BIN
      doc/logos/nodejs.png
  30. 56
      doc/pipe.css
  31. 47
      doc/sh_vim-dark.css
  32. BIN
      doc/sponsored.png
  33. BIN
      doc/trademark-policy.pdf
  34. 2
      lib/_debugger.js
  35. 16
      lib/assert.js
  36. 5
      lib/http.js
  37. 5
      lib/tls.js
  38. 18
      src/node_buffer.cc
  39. 31
      test/simple/test-assert.js
  40. 27
      test/simple/test-buffer.js
  41. 38
      test/simple/test-http-client-abort2.js
  42. 52
      test/simple/test-tls-client-abort.js

14
deps/v8/src/v8natives.js

@ -157,6 +157,17 @@ function GlobalEval(x) {
} }
// execScript for IE compatibility.
function GlobalExecScript(expr, lang) {
// NOTE: We don't care about the character casing.
if (!lang || /javascript/i.test(lang)) {
var f = %CompileString(ToString(expr));
f.call(%GlobalReceiver(global));
}
return null;
}
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -176,7 +187,8 @@ function SetupGlobal() {
"isFinite", GlobalIsFinite, "isFinite", GlobalIsFinite,
"parseInt", GlobalParseInt, "parseInt", GlobalParseInt,
"parseFloat", GlobalParseFloat, "parseFloat", GlobalParseFloat,
"eval", GlobalEval "eval", GlobalEval,
"execScript", GlobalExecScript
)); ));
} }

34
deps/v8/test/mjsunit/execScript-case-insensitive.js

@ -0,0 +1,34 @@
// Copyright 2008 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
var x = 0;
execScript('x = 1', 'javascript');
assertEquals(1, x);
execScript('x = 2', 'JavaScript');
assertEquals(2, x);

2
deps/v8/test/mjsunit/function-names.js

@ -128,6 +128,6 @@ var globalFunctions = [
"encodeURI", "encodeURIComponent", "Error", "TypeError", "encodeURI", "encodeURIComponent", "Error", "TypeError",
"RangeError", "SyntaxError", "ReferenceError", "EvalError", "RangeError", "SyntaxError", "ReferenceError", "EvalError",
"URIError", "isNaN", "isFinite", "parseInt", "parseFloat", "URIError", "isNaN", "isFinite", "parseInt", "parseFloat",
"eval"]; "eval", "execScript"];
TestFunctionNames(this, globalFunctions); TestFunctionNames(this, globalFunctions);

33
deps/v8/test/mjsunit/regress/regress-1341167.js

@ -0,0 +1,33 @@
// Copyright 2008 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Make sure that 'this' is bound to the global object when using
// execScript.
var result;
execScript("result = this");
assertTrue(result === this);

3
doc/api/buffers.markdown

@ -16,6 +16,9 @@ method. Here are the different string encodings;
* `'ascii'` - for 7 bit ASCII data only. This encoding method is very fast, and will * `'ascii'` - for 7 bit ASCII data only. This encoding method is very fast, and will
strip the high bit if set. strip the high bit if set.
Note that this encoding converts a null character (`'\0'` or `'\u0000'`) into
`0x20` (character code of a space). If you want to convert a null character
into `0x00`, you should use `'utf8'`.
* `'utf8'` - Multi byte encoded Unicode characters. Many web pages and other document formats use UTF-8. * `'utf8'` - Multi byte encoded Unicode characters. Many web pages and other document formats use UTF-8.

29
doc/api/fs.markdown

@ -255,8 +255,27 @@ Synchronous close(2).
### fs.open(path, flags, [mode], [callback]) ### fs.open(path, flags, [mode], [callback])
Asynchronous file open. See open(2). Flags can be 'r', 'r+', 'w', 'w+', 'a', Asynchronous file open. See open(2). `flags` can be:
or 'a+'. `mode` defaults to 0666. The callback gets two arguments `(err, fd)`.
* `'r'` - Open file for reading.
An exception occurs if the file does not exist.
* `'r+'` - Open file for reading and writing.
An exception occurs if the file does not exist.
* `'w'` - Open file for writing.
The file is created (if it does not exist) or truncated (if it exists).
* `'w+'` - Open file for reading and writing.
The file is created (if it does not exist) or truncated (if it exists).
* `'a'` - Open file for appending.
The file is created if it does not exist.
* `'a+'` - Open file for reading and appending.
The file is created if it does not exist.
`mode` defaults to `0666`. The callback gets two arguments `(err, fd)`.
### fs.openSync(path, flags, [mode]) ### fs.openSync(path, flags, [mode])
@ -419,6 +438,12 @@ Objects returned from `fs.stat()` and `fs.lstat()` are of this type.
`ReadStream` is a `Readable Stream`. `ReadStream` is a `Readable Stream`.
### Event: 'open'
`function (fd) { }`
`fd` is the file descriptor used by the ReadStream.
### fs.createReadStream(path, [options]) ### fs.createReadStream(path, [options])
Returns a new ReadStream object (See `Readable Stream`). Returns a new ReadStream object (See `Readable Stream`).

9
doc/api/globals.markdown

@ -79,6 +79,15 @@ A reference to the current module. In particular
for more information. for more information.
`module` isn't actually a global but rather local to each module. `module` isn't actually a global but rather local to each module.
### exports
An object which is shared between all instances of the current module and
made accessible through `require()`.
`exports` is the same as the `module.exports` object. See `src/node.js`
for more information.
`exports` isn't actually a global but rather local to each module.
### setTimeout(cb, ms) ### setTimeout(cb, ms)
### clearTimeout(t) ### clearTimeout(t)
### setInterval(cb, ms) ### setInterval(cb, ms)

41
doc/api/http.markdown

@ -52,7 +52,7 @@ per connection (in the case of keep-alive connections).
### Event: 'checkContinue' ### Event: 'checkContinue'
`function (request, response) {}` `function (request, response) { }`
Emitted each time a request with an http Expect: 100-continue is received. Emitted each time a request with an http Expect: 100-continue is received.
If this event isn't listened for, the server will automatically respond If this event isn't listened for, the server will automatically respond
@ -68,7 +68,7 @@ not be emitted.
### Event: 'upgrade' ### Event: 'upgrade'
`function (request, socket, head)` `function (request, socket, head) { }`
Emitted each time a client requests a http upgrade. If this event isn't Emitted each time a client requests a http upgrade. If this event isn't
listened for, then clients requesting an upgrade will have their connections listened for, then clients requesting an upgrade will have their connections
@ -84,7 +84,7 @@ sent to the server on that socket.
### Event: 'clientError' ### Event: 'clientError'
`function (exception) {}` `function (exception) { }`
If a client connection emits an 'error' event - it will forwarded here. If a client connection emits an 'error' event - it will forwarded here.
@ -394,6 +394,10 @@ Options:
- `path`: Request path. Should include query string and fragments if any. - `path`: Request path. Should include query string and fragments if any.
E.G. `'/index.html?page=12'` E.G. `'/index.html?page=12'`
- `headers`: An object containing request headers. - `headers`: An object containing request headers.
- `agent`: Controls `Agent` behavior. Possible values:
- `undefined` (default): use default `Agent` for this host and port.
- `Agent` object: explicitly use the passed in `Agent`.
- `false`: explicitly generate a new `Agent` for this host and port. `Agent` will not be re-used.
`http.request()` returns an instance of the `http.ClientRequest` `http.request()` returns an instance of the `http.ClientRequest`
class. The `ClientRequest` instance is a writable stream. If one needs to class. The `ClientRequest` instance is a writable stream. If one needs to
@ -483,7 +487,7 @@ Options:
### Event: 'upgrade' ### Event: 'upgrade'
`function (response, socket, head)` `function (response, socket, head) { }`
Emitted each time a server responds to a request with an upgrade. If this Emitted each time a server responds to a request with an upgrade. If this
event isn't being listened for, clients receiving an upgrade header will have event isn't being listened for, clients receiving an upgrade header will have
@ -537,14 +541,6 @@ A client server pair that show you how to listen for the `upgrade` event using `
}); });
### Event: 'continue'
`function ()`
Emitted when the server sends a '100 Continue' HTTP response, usually because
the request contained 'Expect: 100-continue'. This is an instruction that
the client should send the request body.
### agent.maxSockets ### agent.maxSockets
By default set to 5. Determines how many concurrent sockets the agent can have open. By default set to 5. Determines how many concurrent sockets the agent can have open.
@ -600,6 +596,14 @@ This is a `Writable Stream`.
This is an `EventEmitter` with the following events: This is an `EventEmitter` with the following events:
### Event: 'continue'
`function () { }`
Emitted when the server sends a '100 Continue' HTTP response, usually because
the request contained 'Expect: 100-continue'. This is an instruction that
the client should send the request body.
### Event 'response' ### Event 'response'
`function (response) { }` `function (response) { }`
@ -646,18 +650,27 @@ The response implements the `Readable Stream` interface.
### Event: 'data' ### Event: 'data'
`function (chunk) {}` `function (chunk) { }`
Emitted when a piece of the message body is received. Emitted when a piece of the message body is received.
### Event: 'end' ### Event: 'end'
`function () {}` `function () { }`
Emitted exactly once for each message. No arguments. After Emitted exactly once for each message. No arguments. After
emitted no other events will be emitted on the response. emitted no other events will be emitted on the response.
### Event: 'close'
`function (err) { }`
Indicates that the underlaying connection was terminated before
`end` event was emitted.
See [http.ServerRequest](#http.ServerRequest)'s `'close'` event for more
information.
### response.statusCode ### response.statusCode
The 3-digit HTTP response status code. E.G. `404`. The 3-digit HTTP response status code. E.G. `404`.

1
doc/api/modules.markdown

@ -318,7 +318,6 @@ Because `module` provides a `filename` property (normally equivalent to
`__filename`), the entry point of the current application can be obtained `__filename`), the entry point of the current application can be obtained
by checking `require.main.filename`. by checking `require.main.filename`.
## AMD Compatibility ## AMD Compatibility
Node's modules have access to a function named `define`, which may be Node's modules have access to a function named `define`, which may be

2
doc/api/stdio.markdown

@ -35,7 +35,7 @@ Mark a time.
Finish timer, record output. Example Finish timer, record output. Example
console.time('100-elements'); console.time('100-elements');
while (var i = 0; i < 100; i++) { for (var i = 0; i < 100; i++) {
; ;
} }
console.timeEnd('100-elements'); console.timeEnd('100-elements');

BIN
doc/favicon.ico

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

4
doc/index.html

@ -24,7 +24,7 @@
<div id="toc"> <div id="toc">
<ol> <ol>
<li><a href="#download">Download</a></li> <li><a href="#download">Download</a></li>
<li><a href="https://github.com/joyent/node/raw/v0.4/ChangeLog">ChangeLog</a></li> <li><a href="https://github.com/joyent/node/wiki/ChangeLog">ChangeLog</a></li>
<li><a href="#about">About</a></li> <li><a href="#about">About</a></li>
<li><a href="http://nodejs.org/docs/v0.4.9/api">v0.4.9 docs</a></li> <li><a href="http://nodejs.org/docs/v0.4.9/api">v0.4.9 docs</a></li>
<li><a href="http://nodejs.org/docs/v0.5.0/api">v0.5.0 docs</a></li> <li><a href="http://nodejs.org/docs/v0.5.0/api">v0.5.0 docs</a></li>
@ -33,6 +33,7 @@
<li><a href="http://blog.nodejs.org/">Blog</a></li> <li><a href="http://blog.nodejs.org/">Blog</a></li>
<li><a href="https://github.com/joyent/node/wiki/Community">Community</a></li> <li><a href="https://github.com/joyent/node/wiki/Community">Community</a></li>
<li><a href="http://chat.nodejs.org/">Demo</a></li> <li><a href="http://chat.nodejs.org/">Demo</a></li>
<li><a href="/logos/">Logos</a></li>
<li><a href="http://jobs.nodejs.org/">Jobs</a></li> <li><a href="http://jobs.nodejs.org/">Jobs</a></li>
<ol><!-- JOBS --><!-- JOBS --></ol> <ol><!-- JOBS --><!-- JOBS --></ol>
</ol> </ol>
@ -40,6 +41,7 @@
<div id="content"> <div id="content">
<!-- <h1><a href="http://nodejs.org/">Node</a></h1> --> <!-- <h1><a href="http://nodejs.org/">Node</a></h1> -->
<br /><br />
<img id="logo" src="logo.png" alt="node.js"/> <img id="logo" src="logo.png" alt="node.js"/>
<p id="introduction"> <p id="introduction">

BIN
doc/logo.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

98
doc/logos/index.html

@ -0,0 +1,98 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<style type="text/css">
ul {
padding: 0;
margin: 0;
}
</style>
<script type="text/javascript" src="../sh_main.js"></script>
<script type="text/javascript" src="../sh_javascript.js"></script>
<link type="image/x-icon" rel="icon" href="http://nodejs.org/favicon.ico">
<link type="image/x-icon" rel="shortcut icon" href="../node-favicon.png">
<link type="text/css" rel="stylesheet" href="../pipe.css">
<link type="text/css" rel="stylesheet" href="../sh_vim-dark.css">
<link rel="alternate" type="application/rss+xml" title="node blog" href="http://feeds.feedburner.com/nodejs/123123123">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Node.js Logos</title>
</head>
<body>
<div id="toc">
<ol>
<li><a href="/#download">Download</a></li>
<li><a href="https://github.com/joyent/node/raw/v0.4/ChangeLog">ChangeLog</a></li>
<li><a href="/#about">About</a></li>
<li><a href="http://nodejs.org/docs/v0.4.9/api">v0.4.9 docs</a></li>
<li><a href="http://nodejs.org/docs/v0.5.0/api/">v0.5.0 docs</a></li>
<br>
<li><a href="https://github.com/joyent/node/wiki">Wiki</a></li>
<li><a href="http://blog.nodejs.org/">Blog</a></li>
<li><a href="https://github.com/joyent/node/wiki/Community">Community</a></li>
<li><a href="http://chat.nodejs.org/">Demo</a></li>
<li>Logos</li>
<li><a href="http://jobs.nodejs.org/">Jobs</a> <!-- JOBS --> </li>
</ol>
</div>
<div id="content">
<!-- <h1><a href="http://nodejs.org/">Node</a></h1> -->
<br />
<br />
<img src="../logo.png" alt="node.js" width="420" height="111" id="logo">
<p>To echo the evolutionary nature of Node, we've added some punch and playfulness to its identity. All it needs now is a good home with you, download and have fun!</p>
<h2>Logo Downloads</h2>
<table border="0" cellspacing="0" cellpadding="10">
<tr>
<td bgcolor="#FFFFFF"><a href="nodejs-light.eps"><img src="nodejs.png" alt="Node.js dark" width="212" height="114" border="0" /></a></td>
<td bgcolor="#46483E"><a href="nodejs-dark.eps"><img src="nodejs-dark.png" alt="Node.js dark" width="212" height="114" border="0" /></a></td>
</tr>
<tr>
<td><a href="nodejs-light.eps">Node.js standard EPS</a></td>
<td><a href="nodejs-dark.eps">Node.js reversed EPS</a></td>
</tr>
<tr>
<td bgcolor="#8BC84B"><a href="nodejs-green.eps"><img src="nodejs-green.png" alt="Node.js dark" width="212" height="114" border="0" /></a><a href="nodejs-dark.eps"></a></td>
<td bgcolor="#ffffff"><a href="nodejs-black.eps"><img src="nodejs-black.png" alt="Node.js dark" width="212" height="114" border="0" /></a></td>
</tr>
<tr>
<td><a href="nodejs-green.eps">Node.js bright EPS</a></td>
<td><a href="nodejs-black.eps">Node.js 1 color EPS</a></td>
</tr>
</table>
<h2>Desktop Background</h2>
<p><img src="monitor.png" width="525" height="398" alt="Screensavers" /></p>
<p>Select your screen resolution:<a href="nodejs-1024x768.png"><br />
<span class="desktops">1024 x 768</span></a><span class="desktops"> | <a href="nodejs-1280x1024.png">1280 x 1024</a> | <a href="nodejs-1440x900.png">1440 x 900</a> | <a href="nodejs-1920x1200.png">1920 x 1200</a> | <a href="nodejs-2560x1440.png">2560 x 1440</a></span></p>
<h2 id="video">&nbsp;</h2>
<p></p>
</div>
<div style="float: right;"></div>
<a href="http://no.de/"><img src="../sponsored.png" height="58" width="120"></a>
<div style="clear: both; font-size: 8pt">
Copyright 2010 Joyent, Inc
<br>
Node.js is a trademark of Joyent, Inc.
See the <a href="http://nodejs.org/trademark-policy.pdf">trademark policy</a>
for more information.
</div>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ?
"https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script><script src="../ga.js" type="text/javascript"></script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-10874194-2");
pageTracker._trackPageview();
} catch(err) {}</script>
<script type="text/javascript">highlight(undefined, undefined, 'pre');</script>
</body></html>

BIN
doc/logos/monitor.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

BIN
doc/logos/node-favicon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
doc/logos/nodejs-1024x768.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 482 KiB

BIN
doc/logos/nodejs-1280x1024.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 798 KiB

BIN
doc/logos/nodejs-1440x900.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 821 KiB

BIN
doc/logos/nodejs-1920x1200.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

BIN
doc/logos/nodejs-2560x1440.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

BIN
doc/logos/nodejs-black.eps

Binary file not shown.

BIN
doc/logos/nodejs-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

BIN
doc/logos/nodejs-dark.eps

Binary file not shown.

BIN
doc/logos/nodejs-dark.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

BIN
doc/logos/nodejs-green.eps

Binary file not shown.

BIN
doc/logos/nodejs-green.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

BIN
doc/logos/nodejs-light.eps

Binary file not shown.

BIN
doc/logos/nodejs.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

56
doc/pipe.css

@ -1,21 +1,25 @@
html {
-webkit-font-smoothing: antialiased;
}
body { body {
background: #22252a; background: #353129;
color: #eee; color: #eee;
font-size: 14pt; font-size: 14pt;
line-height: 150%; line-height: 150%;
font-family: times, Times New Roman, times-roman, georgia, serif; font-family: Georgia, "Times New Roman", Times, serif;
max-width: 30em; max-width: 30em;
margin: 0 0 5em 9em; margin: 0 0 5em 9em;
} }
img { img {
padding: 5em 0; border: 0;
border: 0;
} }
#toc { #toc {
position: absolute; position: absolute;
top: 2em; top: 2em;
left: 0; left: 0;
width: 10em; width: 10em;
font-family: Helvetica, Arial, sans-serif;
font-size: 12pt; font-size: 12pt;
line-height: 150%; line-height: 150%;
} }
@ -35,11 +39,17 @@ img {
margin: 0; margin: 0;
padding: 0; padding: 0;
} }
#toc a { color: #aaa; } #toc a {
color: #8BC84B;
}
h1, h2, h3, h4 { h1, h2, h3, h4 {
color: #B0C4DE; color: #CCD2BC;
margin: 2em 0; font-family: Helvetica, Arial, sans-serif;
margin-top: 2em;
margin-right: 0;
margin-bottom: 10px;
margin-left: 0;
} }
#toc ol ol { #toc ol ol {
@ -56,14 +66,17 @@ h1 a, h2 a, h3 a, h4 a
} }
pre, code { pre, code {
font-family: monospace; font-family: Monaco, 'Andale Mono', 'Lucida Console', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif;
font-size: 13pt; ;
color: #eee0e0; font-size: 11pt;
color: #C3CC88;
} }
pre { pre {
padding-left: 1em; padding-left: 1em;
border-left: 1px solid #444; border-left-width: 1px;
border-left-style: solid;
border-left-color: #8BC84B;
} }
dd { dd {
@ -71,11 +84,16 @@ dd {
margin-left: 1em; margin-left: 1em;
} }
a { color: #cd5; text-decoration: none; } a {
color: #8BC84B;
text-decoration: none;
}
a:hover { text-decoration: underline; } a:hover { text-decoration: underline; }
.highlight { .highlight {
background: #733; background: #733;
padding: 0.2em 0; padding: 0.2em 0;
} }
.desktops {
font-size: 14px;
}

47
doc/sh_vim-dark.css

@ -1,24 +1,23 @@
.sh_sourceCode { .sh_sourceCode {
font-weight: normal; font-weight: normal;
font-style: normal; font-style: normal;
} }
.sh_sourceCode .sh_symbol , .sh_sourceCode .sh_cbracket { .sh_sourceCode .sh_symbol , .sh_sourceCode .sh_cbracket {
color: #fff; color: #fff;
} }
.sh_sourceCode .sh_keyword { .sh_sourceCode .sh_keyword {
font-style: italic; font-style: italic;
} }
.sh_sourceCode .sh_string, .sh_sourceCode .sh_regexp, .sh_sourceCode .sh_number, .sh_sourceCode .sh_string, .sh_sourceCode .sh_regexp, .sh_sourceCode .sh_number,
.sh_sourceCode .sh_specialchar .sh_sourceCode .sh_specialchar
{ {
color: #B0C4DE; color: #B9CCC5;
} }
.sh_sourceCode .sh_comment { .sh_sourceCode .sh_comment {
color: #777; color: #777;
} }

BIN
doc/sponsored.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

BIN
doc/trademark-policy.pdf

Binary file not shown.

2
lib/_debugger.js

@ -998,7 +998,7 @@ Interface.prototype.yesNoQuestion = function(prompt, cb) {
cb(false); cb(false);
} else { } else {
console.log('Please answer y or n.'); console.log('Please answer y or n.');
self.restartQuestion(cb); self.yesNoQuestion(prompt, cb);
} }
}); });
}; };

16
lib/assert.js

@ -56,9 +56,21 @@ assert.AssertionError.prototype.toString = function() {
return [this.name + ':', this.message].join(' '); return [this.name + ':', this.message].join(' ');
} else { } else {
return [this.name + ':', return [this.name + ':',
JSON.stringify(this.expected), JSON.stringify(this.expected, replacer),
this.operator, this.operator,
JSON.stringify(this.actual)].join(' '); JSON.stringify(this.actual, replacer)].join(' ');
}
function replacer(key, value) {
if (value === undefined) {
return '' + value;
}
if (typeof value === 'number' && (isNaN(value) || !isFinite(value))) {
return value.toString();
}
if (typeof value === 'function' || value instanceof RegExp) {
return value.toString();
}
return value;
} }
}; };

5
lib/http.js

@ -1325,7 +1325,10 @@ Agent.prototype._establishNewConnection = function() {
debug('AGENT socket keep-alive'); debug('AGENT socket keep-alive');
} }
req.detachSocket(socket); // The socket may already be detached and destroyed by an abort call
if (socket._httpMessage) {
req.detachSocket(socket);
}
assert(!socket._httpMessage); assert(!socket._httpMessage);

5
lib/tls.js

@ -530,7 +530,10 @@ function SecurePair(credentials, isServer, requestCert, rejectUnauthorized,
this.encrypted = new EncryptedStream(this); this.encrypted = new EncryptedStream(this);
process.nextTick(function() { process.nextTick(function() {
self.ssl.start(); /* The Connection may be destroyed by an abort call */
if (self.ssl) {
self.ssl.start();
}
self.cycle(); self.cycle();
}); });
} }

18
src/node_buffer.cc

@ -470,7 +470,15 @@ Handle<Value> Buffer::Utf8Write(const Arguments &args) {
size_t offset = args[1]->Uint32Value(); size_t offset = args[1]->Uint32Value();
if (s->Length() > 0 && offset >= buffer->length_) { int length = s->Length();
if (length == 0) {
constructor_template->GetFunction()->Set(chars_written_sym,
Integer::New(0));
return scope.Close(Integer::New(0));
}
if (length > 0 && offset >= buffer->length_) {
return ThrowException(Exception::TypeError(String::New( return ThrowException(Exception::TypeError(String::New(
"Offset is out of bounds"))); "Offset is out of bounds")));
} }
@ -491,7 +499,13 @@ Handle<Value> Buffer::Utf8Write(const Arguments &args) {
constructor_template->GetFunction()->Set(chars_written_sym, constructor_template->GetFunction()->Set(chars_written_sym,
Integer::New(char_written)); Integer::New(char_written));
if (written > 0 && p[written-1] == '\0') written--; if (written > 0 && p[written-1] == '\0' && char_written == length) {
uint16_t last_char;
s->Write(&last_char, length - 1, 1, String::NO_HINTS);
if (last_char != 0 || written > s->Utf8Length()) {
written--;
}
}
return scope.Close(Integer::New(written)); return scope.Close(Integer::New(written));
} }

31
test/simple/test-assert.js

@ -229,3 +229,34 @@ try {
console.log('All OK'); console.log('All OK');
assert.ok(gotError); assert.ok(gotError);
// #217
function testAssertionMessage(actual, expected) {
try {
assert.equal(actual, '');
} catch (e) {
assert.equal(e.toString(),
['AssertionError:', '""', '==', expected].join(' '));
}
}
testAssertionMessage(undefined, '"undefined"');
testAssertionMessage(null, 'null');
testAssertionMessage(true, 'true');
testAssertionMessage(false, 'false');
testAssertionMessage(0, '0');
testAssertionMessage(100, '100');
testAssertionMessage(NaN, '"NaN"');
testAssertionMessage(Infinity, '"Infinity"');
testAssertionMessage(-Infinity, '"-Infinity"');
testAssertionMessage('', '""');
testAssertionMessage('foo', '"foo"');
testAssertionMessage([], '[]');
testAssertionMessage([1,2,3], '[1,2,3]');
testAssertionMessage(/a/, '"/a/"');
testAssertionMessage(/abc/gim, '"/abc/gim"');
testAssertionMessage(function f() {}, '"function f() {}"');
testAssertionMessage({}, '{}');
testAssertionMessage({a:undefined, b:null}, '{"a":"undefined","b":null}');
testAssertionMessage({a:NaN, b:Infinity, c:-Infinity},
'{"a":"NaN","b":"Infinity","c":"-Infinity"}');

27
test/simple/test-buffer.js

@ -594,3 +594,30 @@ assert.equal(0xef, b[3]);
assert.throws(function() { assert.throws(function() {
new Buffer('"pong"', 0, 6, 8031, '127.0.0.1') new Buffer('"pong"', 0, 6, 8031, '127.0.0.1')
}); });
// #1210 Test UTF-8 string includes null character
var buf = new Buffer('\0');
assert.equal(buf.length, 1);
buf = new Buffer('\0\0');
assert.equal(buf.length, 2);
buf = new Buffer(2);
var written = buf.write(''); // 0byte
assert.equal(written, 0);
written = buf.write('\0'); // 1byte (v8 adds null terminator)
assert.equal(written, 1);
written = buf.write('a\0'); // 1byte * 2
assert.equal(written, 2);
written = buf.write('あ'); // 3bytes
assert.equal(written, 0);
written = buf.write('\0あ'); // 1byte + 3bytes
assert.equal(written, 1);
written = buf.write('\0\0あ'); // 1byte * 2 + 3bytes
assert.equal(written, 2);
buf = new Buffer(10);
written = buf.write('あいう'); // 3bytes * 3 (v8 adds null terminator)
assert.equal(written, 9);
written = buf.write('あいう\0'); // 3bytes * 3 + 1byte
assert.equal(written, 10);

38
test/simple/test-http-client-abort2.js

@ -0,0 +1,38 @@
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
var common = require('../common');
var assert = require('assert');
var http = require('http');
var server = http.createServer(function(req, res) {
res.end('Hello');
});
server.listen(common.PORT, function() {
var req = http.get({port: common.PORT}, function(res) {
res.on('data', function(data) {
req.abort();
server.close();
});
});
});

52
test/simple/test-tls-client-abort.js

@ -0,0 +1,52 @@
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
if (!process.versions.openssl) {
console.error("Skipping because node compiled without OpenSSL.");
process.exit(0);
}
var common = require('../common');
var assert = require('assert');
var fs = require('fs');
var tls = require('tls');
var path = require('path');
(function() {
var cert = fs.readFileSync(path.join(common.fixturesDir, 'test_cert.pem'));
var key = fs.readFileSync(path.join(common.fixturesDir, 'test_key.pem'));
var errorEmitted = false;
process.on('exit', function() {
assert.ok(!errorEmitted);
});
var conn = tls.connect(common.PORT, {cert:cert, key:key}, function() {
assert.ok(false); // callback should never be executed
});
conn.destroy();
conn.on('error', function() {
errorEmitted = true;
});
})();
Loading…
Cancel
Save