Merge branch 'v0.4'
authorRyan Dahl <ry@tinyclouds.org>
Thu, 14 Jul 2011 22:52:08 +0000 (15:52 -0700)
committerRyan Dahl <ry@tinyclouds.org>
Thu, 14 Jul 2011 22:52:08 +0000 (15:52 -0700)
Conflicts:
deps/libev/wscript
doc/api/modules.markdown

1  2 
deps/v8/src/v8natives.js
doc/api/buffers.markdown
doc/api/fs.markdown
doc/api/http.markdown
doc/api/modules.markdown
lib/http.js
lib/tls.js
src/node_buffer.cc
test/simple/test-buffer.js

Simple merge
Simple merge
Simple merge
@@@ -475,15 -478,9 +479,15 @@@ an HTTP server. Normally `Agent` instan
  code, however in certain situations it's useful to check the status of the
  agent. The `http.getAgent()` function allows you to access the agents.
  
 +Options:
 +
 +- `host`: A domain name or IP address of the server to issue the request to.
 +- `port`: Port of remote server.
 +- `socketPath`: Unix Domain Socket (use one of host:port or socketPath)
 +
  ### Event: 'upgrade'
  
- `function (response, socket, head)`
+ `function (response, socket, head) { }`
  
  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
@@@ -318,56 -307,6 +318,55 @@@ Because `module` provides a `filename` 
  `__filename`), the entry point of the current application can be obtained
  by checking `require.main.filename`.
  
 +## AMD Compatibility
 +
 +Node's modules have access to a function named `define`, which may be
 +used to specify the module's return value.  This is not necessary in node
 +programs, but is present in the node API in order to provide
 +compatibility with module loaders that use the Asynchronous Module
 +Definition pattern.
 +
 +The example module above could be structured like so:
 +
 +    define(function (require, exports, module) {
 +      var PI = Math.PI;
 +
 +      exports.area = function (r) {
 +        return PI * r * r;
 +      };
 +
 +      exports.circumference = function (r) {
 +        return 2 * PI * r;
 +      };
 +    });
 +
 +* Only the last argument to `define()` matters.  Other module loaders
 +  sometimes use a `define(id, [deps], cb)` pattern, but since this is
 +  not relevant in node programs, the other arguments are ignored.
 +* If the `define` callback returns a value other than `undefined`, then
 +  that value is assigned to `module.exports`.
 +* **Important**: Despite being called "AMD", the node module loader **is
 +  in fact synchronous**, and using `define()` does not change this fact.
 +  Node executes the callback immediately, so please plan your programs
 +  accordingly.
 +
 +
 +### Accessing the main module
 +
 +When a file is run directly from Node, `require.main` is set to its
 +`module`. That means that you can determine whether a file has been run
 +directly by testing
 +
 +    require.main === module
 +
 +For a file `foo.js`, this will be `true` if run via `node foo.js`, but
 +`false` if run by `require('./foo')`.
 +
 +Because `module` provides a `filename` property (normally equivalent to
 +`__filename`), the entry point of the current application can be obtained
 +by checking `require.main.filename`.
 +
 +
  ## Addenda: Package Manager Tips
  
  The semantics of Node's `require()` function were designed to be general
diff --cc lib/http.js
Simple merge
diff --cc lib/tls.js
Simple merge
Simple merge
Simple merge