Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: fix some mistakes of http-api-doc #14625

Closed
wants to merge 1 commit into from

Conversation

MoonBall
Copy link
Member

@MoonBall MoonBall commented Aug 4, 2017

fix some mistakes of http-api-doc.

Checklist
Affected core subsystem(s)

doc, http

@nodejs-github-bot nodejs-github-bot added doc Issues and PRs related to the documentations. http Issues or PRs related to the http subsystem. labels Aug 4, 2017
@@ -74,9 +74,9 @@ to keep the Node.js process running when there are no outstanding requests.
It is good practice, to [`destroy()`][] an `Agent` instance when it is no
longer in use, because unused sockets consume OS resources.

Sockets are removed from an agent's pool when the socket emits either
Sockets are removed from an agent when the socket emits either
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agent's pool is agent.freeSockets. When a socket is assigned to a request, the socket must not be in agent.freeSockets.

@@ -590,11 +591,17 @@ Example:

```js
const http = require('http');
const server = http.createServer((req, res) => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The req in the code is not http.ClientRequest.

@vsemozhetbyt
Copy link
Contributor

Thank you.
It seems this branch needs to be rebased to include the recent changes for the last eslint-plugin-markdown version (15599cb), otherwise, we may get linter CI fail.

doc/api/http.md Outdated
};
const req = http.get(options);
req.end();
req.once('response', res => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ESLint error:

  599:22  error  Expected parentheses around arrow function argument  arrow-parens

doc/api/http.md Outdated
socket reusability.
connection can be reused. For an HTTP agent, this returns
`host:port:localAddress` or `host:port:localAddress:family`. For an HTTPS agent,
the name includes the CA, cert, ciphers, and other HTTPS/TLS-specific options that
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line exceeds 80 characters and needs to be rewrapped.

@@ -253,8 +255,7 @@ added: v0.3.6
* {number}

By default set to Infinity. Determines how many concurrent sockets the agent
can have open per origin. Origin is either a 'host:port' or
'host:port:localAddress' combination.
can have open per origin. Origin is the returned value of [`agent.getName()`][].
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This link needs a reference at the bottom of the doc.

@@ -285,7 +286,7 @@ This object is created internally and returned from [`http.request()`][]. It
represents an _in-progress_ request whose header has already been queued. The
header is still mutable using the `setHeader(name, value)`, `getHeader(name)`,
`removeHeader(name)` API. The actual header will be sent along with the first
data chunk or when closing the connection.
data chunk or when calling [`request.end()`][].
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This link needs a reference at the bottom of the doc.

@vsemozhetbyt
Copy link
Contributor

cc @nodejs/http

@MoonBall MoonBall force-pushed the modify-http-api-doc branch from 592f69b to 2e05b30 Compare August 6, 2017 05:09
@MoonBall
Copy link
Member Author

MoonBall commented Aug 6, 2017

@vsemozhetbyt what should I do if I want to know these errors in my machine before pushing a new commit.

@vsemozhetbyt
Copy link
Contributor

vsemozhetbyt commented Aug 6, 2017

@MoonBall

  1. 80 characters errors: we plan using markdown linting in the near future; till that time you can try to make your editor somehow signal the edge (some editors can draw a border on 80 characters margin).

  2. Links errors: just open the rendered version of the doc and see how your new links are rendered. You can also use browser's "search on the page" to find markdown source code artifacts in a rendered text (for example ][] fragments for not-rendered links).

  3. ESLint errors in code fragments (we use eslint-plugin-markdown for that): just rebase your branch to update it and run this command from repository root folder:

node tools\eslint\bin\eslint.js --rulesdir tools/eslint-rules/ --ext=.js,.md benchmark doc lib test tools

Feel free to ask any more questions if I am unclear on something)

@MoonBall
Copy link
Member Author

MoonBall commented Aug 6, 2017

@vsemozhetbyt How can I get the rendered version of the doc?

@vsemozhetbyt
Copy link
Contributor

@MoonBall You can click on the "View" button from the diff tab (I've marked it by the red line):
v

@vsemozhetbyt
Copy link
Contributor

Or, if you will want to check errors before creating a PR, you can view a doc from your new pushed branch in your fork:

https://github.com/MoonBall/node/blob/modify-http-api-doc/doc/api/http.md

@MoonBall MoonBall force-pushed the modify-http-api-doc branch from 2e05b30 to ee11a57 Compare August 6, 2017 10:13
@MoonBall
Copy link
Member Author

MoonBall commented Aug 6, 2017

@vsemozhetbyt Thank you. I have fixed these problems.

@vsemozhetbyt
Copy link
Contributor

@MoonBall Thank you!
Formal aspect LGTM.
HTTP semantics changes need to be reviewed by someone from @nodejs/http team.

@vsemozhetbyt
Copy link
Contributor

vsemozhetbyt commented Aug 6, 2017

Linter CI: https://ci.nodejs.org/job/node-test-linter/10974/ (green).

@MoonBall MoonBall force-pushed the modify-http-api-doc branch from ee11a57 to 35fc4f2 Compare August 10, 2017 12:06
@MoonBall
Copy link
Member Author

MoonBall commented Aug 11, 2017

@vsemozhetbyt The linter CI seems like disappering after I push a new commit by using --force. >.<

@MoonBall
Copy link
Member Author

@vsemozhetbyt I find a good way to get the rendered doc from Building Node.js. Just run NODE=/path/to/node make doc-only and open the html file in ./out/doc/api/.

@vsemozhetbyt
Copy link
Contributor

vsemozhetbyt commented Aug 11, 2017

The linter CI seems like disappering after I push a new commit by using --force

This should work this way, it is OK.

For the future: if you add some changes after a review, it is better to do this in an additional commit (it will be squashed later), so the reviewers should not re-review all the diff again.

Could you enumerate the new changes in the amended commit?

Linter CI: https://ci.nodejs.org/job/node-test-linter/11107/ (green).

@MoonBall
Copy link
Member Author

OK. I comment the new changed code in the commit.

const ip = req.socket.remoteAddress;
const port = req.socket.remotePort;
const ip = res.socket.remoteAddress;
const port = res.socket.remotePort;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jasnell @vsemozhetbyt It's changed after you reviewed.

@@ -652,7 +659,7 @@ not be emitted.
added: v5.5.0
-->

* `request` {http.ClientRequest}
* `request` {http.IncomingMessage}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jasnell @vsemozhetbyt It's changed after you reviewed.

@vsemozhetbyt
Copy link
Contributor

@jasnell Do the last changes seem OK for you? Can we land?

vsemozhetbyt pushed a commit that referenced this pull request Aug 18, 2017
PR-URL: #14625
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
@vsemozhetbyt
Copy link
Contributor

Landed in 4d842e3

MylesBorins pushed a commit that referenced this pull request Sep 10, 2017
PR-URL: #14625
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
@MylesBorins MylesBorins mentioned this pull request Sep 10, 2017
MylesBorins pushed a commit that referenced this pull request Sep 12, 2017
PR-URL: #14625
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Issues and PRs related to the documentations. http Issues or PRs related to the http subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants