0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-29 23:16:30 +01:00
Commit Graph

173 Commits

Author SHA1 Message Date
Steve Mao
0ea3899cab doc: fix markdown links
Fixes: https://github.com/nodejs/node/issues/5322
PR-URL: https://github.com/nodejs/node/pull/5641
Reviewed-By: Robert Lindstädt <robert.lindstaedt@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
2016-03-10 14:09:26 +01:00
Jackson Tian
c6ae7d00c6 doc: improve httpVersionMajor / httpVersionMajor
The description of httpVersionMajor & httpVersionMinor should
have same context like httpVersion.

PR-URL: https://github.com/nodejs/node/pull/5296
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
2016-02-27 14:18:00 +01:00
James M Snell
9b6440a86c doc: add simple http clientError example
The clientError event allows proper http 4xx responses to
be returned when a parse error occurs, but the documentation
did not demonstrate how to use it.

PR-URL: https://github.com/nodejs/node/pull/5248
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
2016-02-17 08:31:19 -08:00
Brian White
9bee03aaf2 http: allow async createConnection()
This commit adds support for async createConnection()
implementations and is still backwards compatible with
synchronous createConnection() implementations.

This commit also makes the http client more friendly with
generic stream objects produced by createConnection() by
checking stream.writable instead of stream.destroyed as the
latter is currently a net.Socket-ism and not set by the core
stream implementations.

PR-URL: https://github.com/nodejs/node/pull/4638
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-02-11 12:52:46 -05:00
James M Snell
7bef1b7907 http: strictly forbid invalid characters from headers
PR-URL: https://github.com/nodejs/node-private/pull/26
Reviewed-By: Rod Vagg <r@va.gg>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-02-09 09:22:09 -08:00
Alejandro Oviedo
3da7d13e59 doc: merging behavior of writeHead vs setHeader
PR-URL: https://github.com/nodejs/node/pull/5081
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
2016-02-09 13:17:38 +01:00
Jeff Harris
f19b9d6b8c doc: undo move http.IncomingMessage.statusMessage
The description for `statusMessage` was accidentally moved under the
heading for `http.IncomingMessage.socket`.  This commit puts it back
in the correct place.

PR-URL: https://github.com/nodejs/node/pull/4822
Fixes: https://github.com/nodejs/node/issues/4558
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Klauke <romaaan.git@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
2016-01-24 14:50:30 +01:00
Robert Jefe Lindstaedt
4e1023d6b4 doc: harmonize $ node command line notation
PR-URL: https://github.com/nodejs/node/pull/4806
Reviewed-By: Stephan Belanger <admin@stephenbelanger.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
2016-01-22 19:57:19 +01:00
José Moreira
5ef9989bd6 net: add net.listening boolean property over a getter
Added a listening property into net.Server.prototype indicating
if the server is listening or not for connections.

Other Server constructors that rely on net.Server should also
gain access to this property.

Also included tests for net and http subsystems.

PR-URL: https://github.com/nodejs/node/pull/4743
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-01-21 16:34:35 -06:00
Robert Jefe Lindstaedt
e436272897 doc: fenced all code blocks, typo fixes
This changes the code blocks from 4-space indentation to ``` fences for
better syntax highlighting and future linting support. Minor On-the-fly
changes for typos and highlight breaking markdown have been made.

JSON-Style objects have been changed so their closing bracket is
on the same line as the opening one.

Known issues:
* Not every JSON / object notation has been improved. Should
  make another run for this.
* Some example functions break hightlighting due to various
  combinations of brackets. However changing them means leaving
  the code style.

Fixes: https://github.com/nodejs/node/issues/4726
PR-URL: https://github.com/nodejs/node/pull/4733
Reviewed-By: Roman Reiss <me@silverwind.io>
2016-01-21 20:55:09 +01:00
cjihrig
212a44df03 doc: clarify protocol default in http.request()
The previously listed default of 'http' is incorrect, and
causes an error to be thrown. This commit changes it to the
correct value of 'http:'

Fixes: https://github.com/nodejs/node/issues/4712
PR-URL: https://github.com/nodejs/node/pull/4714
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-01-15 12:08:49 -05:00
Michael Theriot
666c089e68 doc: fix named anchors in addons.markdown and http.markdown
PR-URL: https://github.com/nodejs/node/pull/4708
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-01-14 22:09:59 -08:00
Daniel Sellers
d755432fa9 http: improves expect header handling
Now returns a 417 error status or allows for an event listener on
the `checkExpectation` event. Before we were ignoring requests that
had misspelled `100-continue` values for expect headers.

This is a quick port of the work done here:
https://github.com/nodejs/node-v0.x-archive/pull/7132 by alFReD-NSH
with surrounding discussion here:
https://github.com/nodejs/node-v0.x-archive/issues/4651

Also updates all the instances of the deprecated
EventEmitter.listenerCount to the current self.listenerCount. Most
of these were in the new code ported over but there was another
legacy instance.

Refs: #2403
PR-URL: https://github.com/nodejs/node/pull/4501
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-01-13 08:05:12 -08:00
Richard Sun
a2e77cedef doc: remove "above" and "below" references
The docs were recently refactored, and some "above" and "below"
references were no longer accurate. This commit removes many
such references, and replaces others with links.

PR-URL: https://github.com/nodejs/node/pull/4499
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-01-11 13:06:00 -05:00
Sequoia McDowell
b40aca1cd5 doc: label http.IncomingMessage as a Class
`Server`, `ServerResponse` etc. were marked as classes, this one class
was overlooked.

PR-URL: https://github.com/nodejs/node/pull/4589
Fixes: https://github.com/nodejs/node/issues/4576
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
2016-01-11 07:17:18 +01:00
Sequoia McDowell
9456f5012d doc: document http's server.listen return value
The server method returns `self` in order to allow chaining.

PR-URL: https://github.com/nodejs/node/pull/4590
Fixes: https://github.com/nodejs/node/issues/4571
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
2016-01-11 07:10:01 +01:00
Fedor Indutny
5f76b24e5e http: overridable clientError
Make default `clientError` behavior (close socket immediately)
overridable. With this APIs it is possible to write a custom error
handler, and to send, for example, a 400 HTTP response.

    http.createServer(...).on('clientError', function(err, socket) {
      socket.end('HTTP/1.1 400 Bad Request\r\n\r\n');
      socket.destroy();
    });

Fix: #4543
PR-URL: https://github.com/nodejs/node/pull/4557
Reviewed-By: Brian White <mscdex@mscdex.net>
2016-01-07 03:39:15 -05:00
Ryan Sobol
4e8a005662 doc: mention that http.Server inherits from net.Server
PR-URL: https://github.com/nodejs/node/pull/4455
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2015-12-30 12:06:25 -08:00
Ben Ripkens
c280596944 doc: explain ClientRequest#setTimeout time unit
State a time unit for the timeout parameter in ClientRequest#setTimeout

PR-URL: https://github.com/nodejs/node/pull/4458
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2015-12-30 12:04:03 -08:00
James M Snell
9b21119e17 doc: fix, modernize examples in docs
* Use single quotes consistently
* Modernize examples to use template strings and arrow funcs
* Fix a few typos
* Example edits for consistency

PR-URL: https://github.com/nodejs/node/pull/4282
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2015-12-17 08:07:29 -08:00
Lenny Markus
9538fd02e5 doc: clarify error events in HTTP module documentation
Make it clear that error with throw if error listener is
not registered.

PR-URL: https://github.com/nodejs/node/pull/4275
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
2015-12-14 15:11:18 -08:00
Hideki Yamamura
c6efd535e4 doc: fix improper http.get sample code
Refs: https://github.com/nodejs/node-v0.x-archive/pull/25471
Refs: https://github.com/nodejs/node-v0.x-archive/issues/8443
PR-URL: https://github.com/nodejs/node/pull/4263
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2015-12-14 14:54:22 -08:00
jpersson
14b3aab7d2 doc: add links and backticks around names
* add backticks around names
* add single quotes around event names
* add parenthesis after function names
* add internal links between different sections
* add external links to MDN for some JavaScript references
* sort the link definitions alphabetically

PR-URL: https://github.com/nodejs/node/pull/4054
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
2015-12-03 13:39:09 -08:00
Bryan English
6f87aa9a12 doc: message.header duplication correction
The old version of the text here was slightly incorrect, so it
just defers the details to the section in which they're fully
described.

PR-URL: https://github.com/nodejs/node/pull/3997
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
2015-11-24 16:16:01 +01:00
Bryan English
cd1123a0fb doc: consistent reference-style links
Moved all the URLs in API docs to the bottom of the files as
reference-style links.

PR-URL: https://github.com/nodejs/node/pull/3845
Reviewed-By: James M Snell <jasnell@gmail.com>
2015-11-16 07:36:59 -08:00
Tristian Flanagan
934149a808 doc: reword message.headers to indicate they are not read-only
message.headers states that the headers are read-only, when in fact they
are not. This change rewords the docs to a more appropriate description,
while not promoting this kind of behavior.

Fixes: #3146
PR-URL: https://github.com/nodejs/node/pull/3814
Reviewed-By: Roman Klauke <romaaan.git@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2015-11-13 12:15:01 -08:00
Bryan English
4008961a07 doc: clarify duplicate header handling
This commit documents how duplicate HTTP headers are handled.

PR-URL: https://github.com/nodejs/node/pull/3810
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
2015-11-13 13:25:39 -05:00
Tristian Flanagan
f4c259ab94 doc: sort http alphabetically
Reorders, with no contextual changes, the http documentation
alphabetically.

PR-URL: https://github.com/nodejs/node/pull/3662
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2015-11-12 17:40:40 -08:00
James M Snell
6192c9892f http: add checkIsHttpToken check for header fields
Ref: https://github.com/nodejs/node-convergence-archive/issues/13

This adds a new check for header and trailer fields names and method
names to ensure that they conform to the HTTP token rule. If they do
not, a `TypeError` is thrown.

Previously this had an additional `strictMode` option that has been
removed in favor of making the strict check the default (and only)
behavior.

Doc and test case are included.

On the client-side
```javascript
var http = require('http');
var url = require('url');
var p = url.parse('http://localhost:8888');
p.headers = {'testing 123': 123};
http.client(p, function(res) { }); // throws
```

On the server-side
```javascript
var http = require('http');
var server = http.createServer(function(req,res) {
  res.setHeader('testing 123', 123); // throws
  res.end('...');
});
```

Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Trevor Norris <trevnorris@nodejs.org>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
PR-URL: https://github.com/nodejs/node/pull/2526
2015-09-25 08:37:57 -07:00
Sakthipriyan Vairamani
5c77031f95 doc: make the deprecations consistent
The deprecation messages in the documentations should be in the format

    Stability: 0 - Deprecated: Use [alternate] instead.

so that they will be consistent.

PR-URL: https://github.com/nodejs/node/pull/2450
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: James M Snell <jasnell@gmail.com>
2015-08-24 13:38:37 +05:30
cjihrig
a69ab27ab4 node: rename from io.js to node
This commit replaces instances of io.js with Node.js, based on the
recent convergence. There are some remaining instances of io.js,
related to build and the installer.

Fixes: https://github.com/nodejs/node/issues/2361
PR-URL: https://github.com/nodejs/node/pull/2367
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: João Reis <reis@janeasystems.com>
2015-08-23 17:59:43 -04:00
hackerjs
3a7be23f98 doc: document response.finished in http.markdown
Adds mention of response.finished to http.markdown
Originally submitted by @hackerjs. The original
commit needed a bit of cleanup on grammar.

Reviewed By: James M Snell <jasnell@gmail.com>
Reviewed By: Michaël Zasso <mic.besace@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/2414
2015-08-23 08:48:44 -07:00
James M Snell
936c9ffb0f doc: multiple documentation updates cherry picked from v0.12
* doc: improve http.abort description
 * doc: mention that mode is ignored if file exists
 * docs: Fix default options for fs.createWriteStream()
 * Documentation update about Buffer initialization
 * doc: add a note about readable in flowing mode
 * doc: Document http.request protocol option
 * doc, comments: Grammar and spelling fixes
 * updated documentation for fs.createReadStream
 * Update child_process.markdown, spelling
 * doc: Clarified read method with specified size argument.
 * docs:events clarify emitter.listener() behavior
 * doc: two minor stream doc improvements
 * doc: clarify Readable._read and Readable.push
 * doc: stream.unshift does not reset reading state
 * doc: readable event clarification
 * doc: additional refinement to readable event

Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noorduis <ben@strongloop.com>
PR-URL: https://github.com/nodejs/io.js/pull/2302
2015-08-05 08:44:55 -07:00
Сковорода Никита Андреевич
89a5b9040e doc: fix http.IncomingMessage.socket documentation
Remove the reference to net.Socket.verifyPeer().
That was removed in ea540c9 and was missed in the 032f80e.

Refer to the net.Socket instance by the .socket property.
This avoids unneeded confusion.
'.socket' is the variant that is used internally.

Add a markdown link to net.Socket.getPeerCertificate().

PR-URL: https://github.com/nodejs/io.js/pull/1867
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-06-02 00:04:21 +02:00
Evan Lucas
d4726cde57 http,net,tls: return this from setTimeout methods
Modifies the setTimeout methods for the following prototypes:

- http.ClientRequest
- http.IncomingMessage
- http.OutgoingMessage
- http.Server
- https.Server
- net.Socket
- tls.TLSSocket

Previously, the above functions returned undefined. They now return
`this`. This is useful for chaining function calls.

PR-URL: https://github.com/nodejs/io.js/pull/1699
Reviewed-By: Roman Reiss <me@silverwind.io>
2015-05-16 07:17:41 +02:00
Alexander Gromnitsky
02388dbf40 doc: fix some cross-references
PR-URL: https://github.com/iojs/io.js/pull/1584
Reviewed-By: Roman Reiss <me@silverwind.io>
2015-05-02 14:07:21 +02:00
Roman Reiss
b4ad5d7050 doc: improve http.request and https.request opts
This adds a few previously undocumented option to both functions.

PR-URL: https://github.com/iojs/io.js/pull/1551
Fixes: https://github.com/iojs/io.js/issues/1082
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2015-05-01 19:55:50 +02:00
Jeremiah Senkpiel
93a1a07ef4 doc: remove keepAlive options from http.request
These can only be specified in the options for http.Agent

Fixes: https://github.com/iojs/io.js/issues/1300
PR-URL: https://github.com/iojs/io.js/pull/1392
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2015-04-11 10:46:17 -04:00
Jeremiah Senkpiel
69bc1382b7 doc: properly indent http.Agent keepAlive options
Fixes: https://github.com/iojs/io.js/issues/1300
PR-URL: https://github.com/iojs/io.js/pull/1384
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2015-04-09 11:23:39 -04:00
Yosuke Furukawa
b2e00e38dc http: add flushHeaders and deprecate flush
PR-URL: https://github.com/iojs/io.js/pull/1156
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Christian Tellnes <christian@tellnes.no>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2015-03-17 00:54:11 +01:00
Chris Dickinson
cf0306cd71 doc: update stability index
This simplifies the stability index to 4 levels:

0 - deprecated
1 - experimental / feature-flagged
2 - stable
3 - locked

Domains has been downgraded to deprecated, assert has been
downgraded to stable. Timers and Module remain locked. All
other APIs are now stable.

PR-URL: https://github.com/iojs/io.js/pull/943
Fixes: https://github.com/iojs/io.js/issues/930
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Vladimir Kurchatkin <vladimir.kurchatkin@gmail.com>
2015-02-27 14:23:01 -08:00
Evan Lucas
2ca22aacbd http: emit abort event from ClientRequest
ClientRequest will now emit an abort event the first time abort()
is called.

Semver: Minor
Fixes: https://github.com/joyent/node/issues/9278
PR-URL: https://github.com/iojs/io.js/pull/945
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
2015-02-25 16:40:31 -05:00
Ben Noordhuis
789bbb91d3 doc: update node.js references in api docs
Fixes: https://github.com/iojs/io.js/issues/740
PR-URL: https://github.com/iojs/io.js/pull/750
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2015-02-07 17:07:15 -05:00
Andres Suarez
5c7ab96b90 doc: fix net.Server.listen bind behavior
PR-URL: https://github.com/iojs/io.js/pull/503
Reviewed-By: Rod Vagg <rod@vagg.org>
2015-01-27 16:31:15 +11:00
Michal Tehnik
753fcaa270 doc: extend example of http.request by end event
Added .on('end', callback) event to http.request example, because
for first sight it's not clear from http documentation, how to
handle end of request.

PR-URL: https://github.com/iojs/io.js/pull/447
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-01-15 17:40:24 +01:00
Jackson Tian
a5532674b0 doc: document callback of http res/req end method
Add documentation for the callback parameter of http.ClientRequest's and
http.ServerResponse's end methods.

PR-URL: https://github.com/iojs/io.js/pull/181
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Brendan Ashworth <squirrelslikeacorns@gmail.com>
2014-12-18 19:39:30 +01:00
Jackson Tian
e96100f052 doc: mention callback for http res/req write & end
Add documentation for the callback parameter of http.ClientRequest's and
http.ServerResponse's write and end methods.
2014-12-09 17:57:18 +01:00
MK Safi
6a6782343c doc: clarify return value of http.createServer
PR-URL: https://github.com/joyent/node/pull/6054
Reviewed-by: Isaac Z. Schlueter <i@izs.me>
Reviewed-by: Chris Dickinson <christopher.s.dickinson@gmail.com>
2014-11-19 14:18:50 -08:00
Artur Cistov
adc0206de9 doc: fix typos in http.markdown
PR-URL: https://github.com/joyent/node/pull/4784
Reviewed-by: Chris Dickinson <christopher.s.dickinson@gmail.com>
2014-11-17 15:35:00 -08:00
Trevor Norris
f2a78de6ec doc: fix optional parameter parsing
The parameter parser specifically looked for the old bracket syntax.
This generated a lot of warnings when building the docs. Those warnings
have been fixed by changing the parsing logic.

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
2014-09-29 16:32:34 -07:00