doc: Improve cross-linking in API docs markdown

Cross-link EventEmitter references in API docs to events.html

Fix broken cross-reference links with wrong anchor names in API docs.
This commit is contained in:
Ben Kelly 2012-06-06 15:05:18 -04:00 committed by isaacs
parent a111390c56
commit c6185c8484
11 changed files with 171 additions and 131 deletions

View File

@ -14,7 +14,7 @@ different, and explained below.
## Class: ChildProcess
`ChildProcess` is an `EventEmitter`.
`ChildProcess` is an [EventEmitter][].
Child processes always have three streams associated with them. `child.stdin`,
`child.stdout`, and `child.stderr`. These may be shared with the stdio
@ -496,7 +496,7 @@ the child process is killed.
* `env` {Object} Environment key-value pairs
* `encoding` {String} (Default: 'utf8')
* `timeout` {Number} (Default: 0)
* `maxBuffer` {Number} (Default: 200*1024)
* `maxBuffer` {Number} (Default: 200\*1024)
* `killSignal` {String} (Default: 'SIGTERM')
* `callback` {Function} called with the output when process terminates
* `error` {Error}
@ -509,7 +509,7 @@ subshell but rather the specified file directly. This makes it slightly
leaner than `child_process.exec`. It has the same options.
## child_process.fork(modulePath, [args], [options])
## child\_process.fork(modulePath, [args], [options])
* `modulePath` {String} The module to run in the child
* `args` {Array} List of string arguments
@ -532,3 +532,5 @@ with the parent's. To change this behavior set the `silent` property in the
These child Nodes are still whole new instances of V8. Assume at least 30ms
startup and 10mb memory for each new Node. That is, you cannot create many
thousands of them.
[EventEmitter]: events.html#events_class_events_eventemitter

View File

@ -159,12 +159,12 @@ Useful for non-standard padding, e.g. using `0x0` instead of PKCS padding. You m
## crypto.createDecipher(algorithm, password)
Creates and returns a decipher object, with the given algorithm and key.
This is the mirror of the [createCipher()](#crypto.createCipher) above.
This is the mirror of the [createCipher()][] above.
## crypto.createDecipheriv(algorithm, key, iv)
Creates and returns a decipher object, with the given algorithm, key and iv.
This is the mirror of the [createCipheriv()](#crypto.createCipheriv) above.
This is the mirror of the [createCipheriv()][] above.
## Class: Decipher
@ -316,13 +316,13 @@ or `'base64'`. Defaults to `'binary'`.
Creates a predefined Diffie-Hellman key exchange object.
The supported groups are: `'modp1'`, `'modp2'`, `'modp5'`
(defined in [RFC 2412](http://www.rfc-editor.org/rfc/rfc2412.txt ))
(defined in [RFC 2412][])
and `'modp14'`, `'modp15'`, `'modp16'`, `'modp17'`, `'modp18'`
(defined in [RFC 3526](http://www.rfc-editor.org/rfc/rfc3526.txt )).
(defined in [RFC 3526][]).
The returned object mimics the interface of objects created by
[crypto.createDiffieHellman()](#crypto.createDiffieHellman) above, but
[crypto.createDiffieHellman()][] above, but
will not allow to change the keys (with
[diffieHellman.setPublicKey()](#diffieHellman.setPublicKey) for example).
[diffieHellman.setPublicKey()][] for example).
The advantage of using this routine is that the parties don't have to
generate nor exchange group modulus beforehand, saving both processor and
communication time.
@ -365,3 +365,10 @@ Generates cryptographically strong pseudo-random data. Usage:
} catch (ex) {
// handle error
}
[createCipher()]: #crypto_crypto_createcipher_algorithm_password
[createCipheriv()]: #crypto_crypto_createcipheriv_algorithm_key_iv
[crypto.createDiffieHellman()]: #crypto_crypto_creatediffiehellman_prime_encoding
[diffieHellman.setPublicKey()]: #crypto_diffiehellman_setpublickey_public_key_encoding
[RFC 2412]: http://www.rfc-editor.org/rfc/rfc2412.txt
[RFC 3526]: http://www.rfc-editor.org/rfc/rfc3526.txt

View File

@ -119,7 +119,7 @@ Returns a new Domain object.
The Domain class encapsulates the functionality of routing errors and
uncaught exceptions to the active Domain object.
Domain is a child class of EventEmitter. To handle the errors that it
Domain is a child class of [EventEmitter][]. To handle the errors that it
catches, listen to its `error` event.
### domain.run(fn)
@ -264,3 +264,5 @@ Note that IO might still be performed. However, to the highest degree
possible, once a domain is disposed, further errors from the emitters in
that set will be ignored. So, even if some remaining actions are still
in flight, Node.js will not communicate further about them.
[EventEmitter]: events.html#events_class_events_eventemitter

View File

@ -22,7 +22,7 @@ scope; `var something` inside a Node module will be local to that module.
* {Object}
The process object. See the [process object](process.html#process) section.
The process object. See the [process object][] section.
## console
@ -30,7 +30,7 @@ The process object. See the [process object](process.html#process) section.
* {Object}
Used to print to stdout and stderr. See the [stdio](stdio.html) section.
Used to print to stdout and stderr. See the [stdio][] section.
## Class: Buffer
@ -38,7 +38,7 @@ Used to print to stdout and stderr. See the [stdio](stdio.html) section.
* {Function}
Used to handle binary data. See the [buffer section](buffer.html).
Used to handle binary data. See the [buffer section][]
## require()
@ -46,8 +46,8 @@ Used to handle binary data. See the [buffer section](buffer.html).
* {Function}
To require modules. See the [Modules](modules.html#modules) section.
`require` isn't actually a global but rather local to each module.
To require modules. See the [Modules][] section. `require` isn't actually a
global but rather local to each module.
### require.resolve()
@ -123,8 +123,7 @@ A reference to the current module. In particular
`module.exports` is the same as the `exports` object.
`module` isn't actually a global but rather local to each module.
See the [module system documentation](modules.html) for more
information.
See the [module system documentation][] for more information.
## exports
@ -135,10 +134,9 @@ made accessible through `require()`.
`exports` is the same as the `module.exports` object.
`exports` isn't actually a global but rather local to each module.
See the [module system documentation](modules.html) for more
information.
See the [module system documentation][] for more information.
See the [module section](modules.html) for more information.
See the [module section][] for more information.
## setTimeout(cb, ms)
## clearTimeout(t)
@ -147,4 +145,12 @@ See the [module section](modules.html) for more information.
<!--type=global-->
The timer functions are global variables. See the [timers](timers.html) section.
The timer functions are global variables. See the [timers][] section.
[buffer section]: buffer.html
[module section]: modules.html
[module system documentation]: modules.html
[Modules]: modules.html#modules_modules
[process object]: process.html#process_process
[stdio]: stdio.html
[timers]: timers.html

View File

@ -42,13 +42,13 @@ added to the `'request'` event.
## http.createClient([port], [host])
This function is **deprecated**; please use
[http.request()](#http_http_request_options_callback) instead. Constructs a new
HTTP client. `port` and `host` refer to the server to be connected to.
This function is **deprecated**; please use [http.request()][] instead.
Constructs a new HTTP client. `port` and `host` refer to the server to be
connected to.
## Class: http.Server
This is an `EventEmitter` with the following events:
This is an [EventEmitter][] with the following events:
### Event: 'request'
@ -145,8 +145,7 @@ The actual length will be determined by your OS through sysctl settings such as
parameter is 511 (not 512).
This function is asynchronous. The last parameter `callback` will be added as
a listener for the ['listening'](net.html#event_listening_) event.
See also [net.Server.listen()](net.html#server.listen).
a listener for the ['listening'][] event. See also [net.Server.listen(port)][].
### server.listen(path, [callback])
@ -154,8 +153,7 @@ See also [net.Server.listen()](net.html#server.listen).
Start a UNIX socket server listening for connections on the given `path`.
This function is asynchronous. The last parameter `callback` will be added as
a listener for the ['listening'](net.html#event_listening_) event.
See also [net.Server.listen()](net.html#server.listen).
a listener for the ['listening'][] event. See also [net.Server.listen(path)][].
### server.listen(handle, [listeningListener])
@ -178,8 +176,7 @@ See also [net.Server.listen()](net.html#server.listen).
### server.close([cb])
Stops the server from accepting new connections.
See [net.Server.close()](net.html#server.close).
Stops the server from accepting new connections. See [net.Server.close()][].
### server.maxHeadersCount
@ -193,8 +190,8 @@ no limit will be applied.
This object is created internally by a HTTP server -- not by
the user -- and passed as the first argument to a `'request'` listener.
The request implements the [Readable Stream](stream.html#readable_stream)
interface. This is an `EventEmitter` with the following events:
The request implements the [Readable Stream][] interface. This is an
[EventEmitter][] with the following events:
### Event: 'data'
@ -202,7 +199,7 @@ interface. This is an `EventEmitter` with the following events:
Emitted when a piece of the message body is received. The chunk is a string if
an encoding has been set with `request.setEncoding()`, otherwise it's a
[Buffer](buffer.html).
[Buffer][].
Note that the __data will be lost__ if there is no listener when a
`ServerRequest` emits a `'data'` event.
@ -284,9 +281,8 @@ Also `request.httpVersionMajor` is the first integer and
### request.setEncoding([encoding])
Set the encoding for the request body. See
[stream.setEncoding()](stream.html#stream_stream_setencoding_encoding)
for more information.
Set the encoding for the request body. See [stream.setEncoding()][] for more
information.
### request.pause()
@ -313,8 +309,8 @@ authentication details.
This object is created internally by a HTTP server--not by the user. It is
passed as the second parameter to the `'request'` event.
The response implements the [Writable Stream](stream.html#writable_stream)
interface. This is an `EventEmitter` with the following events:
The response implements the [Writable Stream][] interface. This is an
[EventEmitter][] with the following events:
### Event: 'close'
@ -326,8 +322,7 @@ Indicates that the underlaying connection was terminated before
### response.writeContinue()
Sends a HTTP/1.1 100 Continue message to the client, indicating that
the request body should be sent. See the [checkContinue](#event_checkContinue_) event on
`Server`.
the request body should be sent. See the ['checkContinue'][] event on `Server`.
### response.writeHead(statusCode, [reasonPhrase], [headers])
@ -467,7 +462,7 @@ Node maintains several connections per server to make HTTP requests.
This function allows one to transparently issue requests.
`options` can be an object or a string. If `options` is a string, it is
automatically parsed with [url.parse()](url.html#url.parse).
automatically parsed with [url.parse()][].
Options:
@ -483,10 +478,9 @@ Options:
- `headers`: An object containing request headers.
- `auth`: Basic authentication i.e. `'user:password'` to compute an
Authorization header.
- `agent`: Controls [Agent](#http.Agent) behavior. When an Agent is used
request will default to `Connection: keep-alive`. Possible values:
- `undefined` (default): use [global Agent](#http.globalAgent) for this host
and port.
- `agent`: Controls [Agent][] behavior. When an Agent is used request will
default to `Connection: keep-alive`. Possible values:
- `undefined` (default): use [global Agent][] for this host and port.
- `Agent` object: explicitly use the passed in `Agent`.
- `false`: opts out of connection pooling with an Agent, defaults request to
`Connection: close`.
@ -652,15 +646,15 @@ event, the entire body will be caught.
Note: Node does not check whether Content-Length and the length of the body
which has been transmitted are equal or not.
The request implements the [Writable Stream](stream.html#writable_stream)
interface. This is an `EventEmitter` with the following events:
The request implements the [Writable Stream][] interface. This is an
[EventEmitter][] with the following events:
### Event 'response'
`function (response) { }`
Emitted when a response is received to this request. This event is emitted only once. The
`response` argument will be an instance of `http.ClientResponse`.
Emitted when a response is received to this request. This event is emitted only
once. The `response` argument will be an instance of `http.ClientResponse`.
Options:
@ -802,7 +796,7 @@ server--in that case it is suggested to use the
`['Transfer-Encoding', 'chunked']` header line when
creating the request.
The `chunk` argument should be a [buffer](buffer.html) or a string.
The `chunk` argument should be a [Buffer][] or a string.
The `encoding` argument is optional and only applies when `chunk` is a string.
Defaults to `'utf8'`.
@ -823,29 +817,26 @@ Aborts a request. (New since v0.3.8.)
### request.setTimeout(timeout, [callback])
Once a socket is assigned to this request and is connected
[socket.setTimeout(timeout, [callback])](net.html#socket.setTimeout)
will be called.
Once a socket is assigned to this request and is connected
[socket.setTimeout()][] will be called.
### request.setNoDelay([noDelay])
Once a socket is assigned to this request and is connected
[socket.setNoDelay(noDelay)](net.html#socket.setNoDelay)
will be called.
Once a socket is assigned to this request and is connected
[socket.setNoDelay()][] will be called.
### request.setSocketKeepAlive([enable], [initialDelay])
Once a socket is assigned to this request and is connected
[socket.setKeepAlive(enable, [initialDelay])](net.html#socket.setKeepAlive)
will be called.
Once a socket is assigned to this request and is connected
[socket.setKeepAlive()][] will be called.
## http.ClientResponse
This object is created when making a request with `http.request()`. It is
passed to the `'response'` event of the request object.
The response implements the [Readable Stream](stream.html#readable_stream)
interface. This is an `EventEmitter` with the following events:
The response implements the [Readable Stream][] interface. This is an
[EventEmitter][] with the following events:
### Event: 'data'
@ -871,8 +862,7 @@ emitted no other events will be emitted on the response.
Indicates that the underlaying connection was terminated before
`end` event was emitted.
See [http.ServerRequest](#http.ServerRequest)'s `'close'` event for more
information.
See [http.ServerRequest][]'s `'close'` event for more information.
### response.statusCode
@ -895,9 +885,8 @@ The response trailers object. Only populated after the 'end' event.
### response.setEncoding([encoding])
Set the encoding for the response body. See
[stream.setEncoding()](stream.html#stream_stream_setencoding_encoding)
for more information.
Set the encoding for the response body. See [stream.setEncoding()][] for more
information.
### response.pause()
@ -906,3 +895,22 @@ Pauses response from emitting events. Useful to throttle back a download.
### response.resume()
Resumes a paused response.
[Agent]: #http_class_http_agent
['checkContinue']: #http_event_checkcontinue
[Buffer]: buffer.html#buffer_buffer
[EventEmitter]: events.html#events_class_events_eventemitter
[global Agent]: #http_http_globalagent
[http.request()]: #http_http_request_options_callback
[http.ServerRequest]: #http_class_http_serverrequest
['listening']: net.html#net_event_listening
[net.Server.close()]: net.html#net_server_close_cb
[net.Server.listen(path)]: net.html#net_server_listen_path_listeninglistener
[net.Server.listen(port)]: net.html#net_server_listen_port_host_backlog_listeninglistener
[Readable Stream]: stream.html#stream_readable_stream
[socket.setKeepAlive()]: net.html#net_socket_setkeepalive_enable_initialdelay
[socket.setNoDelay()]: net.html#net_socket_setnodelay_nodelay
[socket.setTimeout()]: net.html#net_socket_settimeout_timeout_callback
[stream.setEncoding()]: stream.html#stream_stream_setencoding_encoding
[url.parse()]: url.html#url_url_parse_urlstr_parsequerystring_slashesdenotehost
[Writable Stream]: stream.html#stream_writable_stream

View File

@ -13,8 +13,8 @@ This class is a subclass of `tls.Server` and emits events same as
## https.createServer(options, [requestListener])
Returns a new HTTPS web server object. The `options` is similar to
[tls.createServer()](tls.html#tls.createServer). The `requestListener` is
a function which is automatically added to the `'request'` event.
[tls.createServer()][]. The `requestListener` is a function which is
automatically added to the `'request'` event.
Example:
@ -48,8 +48,8 @@ Or
## https.request(options, callback)
Makes a request to a secure web server.
All options from [http.request()](http.html#http.request) are valid.
Makes a request to a secure web server. All options from [http.request()][]
are valid.
Example:
@ -93,16 +93,15 @@ The options argument has the following options
- `headers`: An object containing request headers.
- `auth`: Basic authentication i.e. `'user:password'` to compute an
Authorization header.
- `agent`: Controls [Agent](#https.Agent) behavior. When an Agent is
used request will default to `Connection: keep-alive`. Possible values:
- `undefined` (default): use [globalAgent](#https.globalAgent) for this
host and port.
- `agent`: Controls [Agent][] behavior. When an Agent is used request will
default to `Connection: keep-alive`. Possible values:
- `undefined` (default): use [globalAgent][] for this host and port.
- `Agent` object: explicitly use the passed in `Agent`.
- `false`: opts out of connection pooling with an Agent, defaults request to
`Connection: close`.
The following options from [tls.connect()](tls.html#tls.connect) can also be
specified. However, a [globalAgent](#https.globalAgent) silently ignores these.
The following options from [tls.connect()][] can also be specified. However, a
[globalAgent][] silently ignores these.
- `pfx`: Certificate, Private key and CA certificates to use for SSL. Default `null`.
- `key`: Private key to use for SSL. Default `null`.
@ -177,11 +176,18 @@ Example:
## Class: https.Agent
An Agent object for HTTPS similar to [http.Agent](http.html#http.Agent).
See [https.request()](#https.request) for more information.
An Agent object for HTTPS similar to [http.Agent][]. See [https.request()][]
for more information.
## https.globalAgent
Global instance of [https.Agent](#https.Agent) which is used as the default
for all HTTPS client requests.
Global instance of [https.Agent][] for all HTTPS client requests.
[Agent]: #https_class_https_agent
[globalAgent]: #https_https_globalagent
[http.Agent]: http.html#http_class_http_agent
[http.request()]: http.html#http_http_request_options_callback
[https.Agent]: #https_class_https_agent
[tls.connect()]: tls.html#tls_tls_connect_options_secureconnectlistener
[tls.createServer()]: tls.html#tls_tls_createserver_options_secureconnectionlistener

View File

@ -9,8 +9,7 @@ this module with `require('net');`
## net.createServer([options], [connectionListener])
Creates a new TCP server. The `connectionListener` argument is
automatically set as a listener for the ['connection'](#event_connection_)
event.
automatically set as a listener for the ['connection'][] event.
`options` is an object with the following defaults:
@ -20,7 +19,7 @@ event.
If `allowHalfOpen` is `true`, then the socket won't automatically send a FIN
packet when the other end of the socket sends a FIN packet. The socket becomes
non-readable, but still writable. You should call the `end()` method explicitly.
See ['end'](#event_end_) event for more information.
See ['end'][] event for more information.
Here is an example of a echo server which listens for connections
on port 8124:
@ -55,8 +54,7 @@ Use `nc` to connect to a UNIX domain socket server:
## net.createConnection(options, [connectionListener])
Constructs a new socket object and opens the socket to the given location.
When the socket is established, the ['connect'](#event_connect_) event will be
emitted.
When the socket is established, the ['connect'][] event will be emitted.
For TCP sockets, `options` argument should be an object which specifies:
@ -74,11 +72,10 @@ Common options are:
- `allowHalfOpen`: if `true`, the socket won't automatically send
a FIN packet when the other end of the socket sends a FIN packet.
Defaults to `false`.
See ['end'](#event_end_) event for more information.
Defaults to `false`. See ['end'][] event for more information.
The `connectListener` parameter will be added as an listener for the
['connect'](#event_connect_) event.
['connect'][] event.
Here is an example of a client of echo server as described previously:
@ -107,14 +104,14 @@ changed to
Creates a TCP connection to `port` on `host`. If `host` is omitted,
`'localhost'` will be assumed.
The `connectListener` parameter will be added as an listener for the
['connect'](#event_connect_) event.
['connect'][] event.
## net.connect(path, [connectListener])
## net.createConnection(path, [connectListener])
Creates unix socket connection to `path`.
The `connectListener` parameter will be added as an listener for the
['connect'](#event_connect_) event.
['connect'][] event.
## Class: net.Server
@ -133,9 +130,8 @@ The actual length will be determined by your OS through sysctl settings such as
parameter is 511 (not 512).
This function is asynchronous. When the server has been bound,
['listening'](#event_listening_) event will be emitted.
the last parameter `listeningListener` will be added as an listener for the
['listening'](#event_listening_) event.
['listening'][] event will be emitted. The last parameter `listeningListener`
will be added as an listener for the ['listening'][] event.
One issue some users run into is getting `EADDRINUSE` errors. This means that
another server is already running on the requested port. One way of handling this
@ -159,9 +155,8 @@ would be to wait a second and then try again. This can be done with
Start a UNIX socket server listening for connections on the given `path`.
This function is asynchronous. When the server has been bound,
['listening'](#event_listening_) event will be emitted.
the last parameter `listeningListener` will be added as an listener for the
['listening'](#event_listening_) event.
['listening'][] event will be emitted. The last parameter `listeningListener`
will be added as an listener for the ['listening'][] event.
### server.listen(handle, [listeningListener])
@ -226,7 +221,7 @@ The number of concurrent connections on the server.
This becomes `null` when sending a socket to a child with `child_process.fork()`.
`net.Server` is an `EventEmitter` with the following events:
`net.Server` is an [EventEmitter][] with the following events:
### Event: 'listening'
@ -285,13 +280,12 @@ Normally this method is not needed, as `net.createConnection` opens the
socket. Use this only if you are implementing a custom Socket or if a
Socket is closed and you want to reuse it to connect to another server.
This function is asynchronous. When the ['connect'](#event_connect_) event is
emitted the socket is established. If there is a problem connecting, the
`'connect'` event will not be emitted, the `'error'` event will be emitted with
the exception.
This function is asynchronous. When the ['connect'][] event is emitted the
socket is established. If there is a problem connecting, the `'connect'` event
will not be emitted, the `'error'` event will be emitted with the exception.
The `connectListener` parameter will be added as an listener for the
['connect'](#event_connect_) event.
['connect'][] event.
### socket.bufferSize
@ -316,8 +310,7 @@ Users who experience large or growing `bufferSize` should attempt to
### socket.setEncoding([encoding])
Set the encoding for the socket as a Readable Stream. See
[stream.setEncoding()](stream.html#stream_stream_setencoding_encoding)
for more information.
[stream.setEncoding()][] for more information.
### socket.write(data, [encoding], [callback])
@ -411,7 +404,7 @@ The amount of received bytes.
The amount of bytes sent.
`net.Socket` instances are EventEmitters with the following events:
`net.Socket` instances are [EventEmitter][] with the following events:
### Event: 'connect'
@ -424,8 +417,7 @@ See `connect()`.
Emitted when data is received. The argument `data` will be a `Buffer` or
`String`. Encoding of data is set by `socket.setEncoding()`.
(See the [Readable Stream](stream.html#readable_stream) section for more
information.)
(See the [Readable Stream][] section for more information.)
Note that the __data will be lost__ if there is no listener when a `Socket`
emits a `'data'` event.
@ -484,3 +476,10 @@ Returns true if input is a version 4 IP address, otherwise returns false.
Returns true if input is a version 6 IP address, otherwise returns false.
['connect']: #net_event_connect
['connection']: #net_event_connection
['end']: #net_event_end
[EventEmitter]: events.html#events_class_events_eventemitter
['listening']: #net_event_listening
[Readable Stream]: stream.html#stream_readable_stream
[stream.setEncoding()]: stream.html#stream_stream_setencoding_encoding

View File

@ -3,7 +3,7 @@
<!-- type=global -->
The `process` object is a global object and can be accessed from anywhere.
It is an instance of `EventEmitter`.
It is an instance of [EventEmitter][].
## Event: 'exit'
@ -425,3 +425,5 @@ a diff reading, useful for benchmarks and measuring intervals:
console.log('benchmark took %d seconds and %d nanoseconds', t[0], t[1]);
// benchmark took 1 seconds and 6962306 nanoseconds
}, 1000);
[EventEmitter]: events.html#events_class_events_eventemitter

View File

@ -17,8 +17,7 @@ Prints to stdout with newline. This function can take multiple arguments in a
console.log('count: %d', count);
If formatting elements are not found in the first string then `util.inspect`
is used on each argument.
See [util.format()](util.html#util.format) for more information.
is used on each argument. See [util.format()][] for more information.
## console.info([data], [...])
@ -56,6 +55,8 @@ Print a stack trace to stderr of the current position.
## console.assert(expression, [message])
Same as [assert.ok()](assert.html#assert_assert_value_message_assert_ok_value_message)
where if the `expression` evaluates as `false` throw an AssertionError with `message`.
Same as [assert.ok()][] where if the `expression` evaluates as `false` throw an
AssertionError with `message`.
[assert.ok()]: assert.html#assert_assert_value_message_assert_ok_value_message
[util.format()]: util.html#util_util_format_format

View File

@ -4,7 +4,7 @@
A stream is an abstract interface implemented by various objects in Node.
For example a request to an HTTP server is a stream, as is stdout. Streams
are readable, writable, or both. All streams are instances of `EventEmitter`.
are readable, writable, or both. All streams are instances of [EventEmitter][]
You can load up the Stream base class by doing `require('stream')`.
@ -182,3 +182,5 @@ Any queued write data will not be sent.
After the write queue is drained, close the file descriptor. `destroySoon()`
can still destroy straight away, as long as there is no data left in the queue
for writes.
[EventEmitter]: events.html#events_class_events_eventemitter

View File

@ -49,8 +49,8 @@ server-side resources, which makes it a potential vector for denial-of-service
attacks.
To mitigate this, renegotiations are limited to three times every 10 minutes. An
error is emitted on the [CleartextStream](#tls.CleartextStream) instance when
the threshold is exceeded. The limits are configurable:
error is emitted on the [CleartextStream][] instance when the threshold is
exceeded. The limits are configurable:
- `tls.CLIENT_RENEG_LIMIT`: renegotiation limit, default is 3.
@ -78,10 +78,9 @@ handshake extensions allowing you:
## tls.createServer(options, [secureConnectionListener])
Creates a new [tls.Server](#tls.Server).
The `connectionListener` argument is automatically set as a listener for the
[secureConnection](#event_secureConnection_) event.
The `options` object has these possibilities:
Creates a new [tls.Server][]. The `connectionListener` argument is
automatically set as a listener for the [secureConnection][] event. The
`options` object has these possibilities:
- `pfx`: A string or `Buffer` containing the private key, certificate and
CA certs of the server in PFX or PKCS12 format. (Mutually exclusive with
@ -241,9 +240,9 @@ Creates a new client connection to the given `port` and `host` (old API) or
- `servername`: Servername for SNI (Server Name Indication) TLS extension.
The `secureConnectListener` parameter will be added as a listener for the
['secureConnect'](#event_secureConnect_) event.
['secureConnect'][] event.
`tls.connect()` returns a [CleartextStream](#tls.CleartextStream) object.
`tls.connect()` returns a [CleartextStream][] object.
Here is an example of a client of echo server as described previously:
@ -315,8 +314,8 @@ and the cleartext one is used as a replacement for the initial encrypted stream.
automatically reject clients with invalid certificates. Only applies to
servers with `requestCert` enabled.
`tls.createSecurePair()` returns a SecurePair object with
[cleartext](#tls.CleartextStream) and `encrypted` stream properties.
`tls.createSecurePair()` returns a SecurePair object with [cleartext][] and
`encrypted` stream properties.
## Class: SecurePair
@ -342,9 +341,8 @@ connections using TLS or SSL.
`function (cleartextStream) {}`
This event is emitted after a new connection has been successfully
handshaked. The argument is a instance of
[CleartextStream](#tls.CleartextStream). It has all the common stream methods
and events.
handshaked. The argument is a instance of [CleartextStream][]. It has all the
common stream methods and events.
`cleartextStream.authorized` is a boolean value which indicates if the
client has verified by one of the supplied certificate authorities for the
@ -386,8 +384,8 @@ event.
### server.address()
Returns the bound address, the address family name and port of the
server as reported by the operating system.
See [net.Server.address()](net.html#server.address) for more information.
server as reported by the operating system. See [net.Server.address()][] for
more information.
### server.addContext(hostname, credentials)
@ -410,8 +408,8 @@ The number of concurrent connections on the server.
This is a stream on top of the *Encrypted* stream that makes it possible to
read/write an encrypted data as a cleartext data.
This instance implements a duplex [Stream](stream.html) interfaces.
It has all the common stream methods and events.
This instance implements a duplex [Stream][] interfaces. It has all the
common stream methods and events.
A ClearTextStream is the `clear` member of a SecurePair object.
@ -489,3 +487,10 @@ The string representation of the remote IP address. For example,
### cleartextStream.remotePort
The numeric representation of the remote port. For example, `443`.
[CleartextStream]: #tls_class_tls_cleartextstream
[net.Server.address()]: net.html#net_server_address
['secureConnect']: #tls_event_secureconnect
[secureConnection]: #tls_event_secureconnection
[Stream]: stream.html#stream_stream
[tls.Server]: #tls_class_tls_server