Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
doc: improve http.connect option descriptions
  • Loading branch information
silverwind committed Apr 28, 2015
commit 3d25dd6285b8e65a838947d1ffd1a4d0f255b6fa
8 changes: 6 additions & 2 deletions doc/api/http.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -460,10 +460,14 @@ Options:

- `host`: A domain name or IP address of the server to issue the request to.
Defaults to `'localhost'`.
- `hostname`: To support `url.parse()` `hostname` is preferred over `host`
- `hostname`: Alias for `host`. To support `url.parse()` `hostname` is
preferred over `host`.
- `family`: IP address family to use when resolving `host` and `hostname`.
Valid values are `4` or `6`. When unspecified, both IP v4 and v6 will be
used.
Copy link
Contributor

Choose a reason for hiding this comment

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

@cjihrig didn't your example in the original issue state that this was required for ipv6?

Copy link
Contributor

Choose a reason for hiding this comment

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

@Fishrock123 TL;DR, I believe @silverwind statement to be correct here.

In that particular example, IPv6 was required, as the server was only listening on '::1'. When dns.lookup() executes, it looks up localhost and returns the results [ '127.0.0.1', '::1', 'fe80::1' ] (on my local machine). The first result is used, and the family is inferred as 4.

Copy link
Contributor

Choose a reason for hiding this comment

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

So basically #708..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I understood #708 as a request to attempt multiple IPs from the same family.

What exactly does a browser on dual stack do if it encounters both v4 and v6? Attempt both in succession? In parallel? Whatever it does, I think that's what we should do if no family is given.

- `port`: Port of remote server. Defaults to 80.
- `localAddress`: Local interface to bind for network connections.
- `socketPath`: Unix Domain Socket (use one of host:port or socketPath)
- `socketPath`: Unix Domain Socket (use one of host:port or socketPath).
- `method`: A string specifying the HTTP request method. Defaults to `'GET'`.
- `path`: Request path. Defaults to `'/'`. Should include query string if any.
E.G. `'/index.html?page=12'`. An exception is thrown when the request path
Expand Down