Skip to content

Commit 426611c

Browse files
committed
doc/modules/{client,request}: Document .bind option
1 parent 35ce84b commit 426611c

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

doc/modules/http.client.md

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ This function returns a new connection to an HTTP server. Once a connection has
3737
e.g. `"80"` or `80`
3838
- `path` (string): path to connect to (UNIX sockets)
3939
- `v6only` (boolean, optional): if the `IPV6_V6ONLY` flag should be set on the underlying socket.
40+
- `bind` (string, optional): the local outgoing address and optionally port to bind in the form of `"address[:port]"`, IPv6 addresses may be specified via square bracket notation. e.g. `"127.0.0.1"`, `"127.0.0.1:50000"`, `"[::1]:30000"`.
4041
- `timeout` (optional) is the maximum amount of time (in seconds) to allow for connection to be established.
4142
This includes time for DNS lookup, connection, TLS negotiation (if TLS enabled) and in the case of HTTP 2: settings exchange.
4243

doc/modules/http.request.md

+9
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,15 @@ The host this request should be sent to.
2222
The port this request should be sent to.
2323

2424

25+
### `request.bind` <!-- --> {#http.request.bind}
26+
27+
The local outgoing address and optionally port to bind in the form of `"address[:port]"`. Default is to allow the kernel to choose an address+port.
28+
29+
IPv6 addresses may be specified via square bracket notation. e.g. `"127.0.0.1"`, `"127.0.0.1:50000"`, `"[::1]:30000"`.
30+
31+
This option is rarely needed. Supplying an address can be used to manually select the network interface to make the request from, while supplying a port is only really used to interoperate with firewalls or devices that demand use of a certain port.
32+
33+
2534
### `request.tls` <!-- --> {#http.request.tls}
2635

2736
A boolean indicating if TLS should be used.

0 commit comments

Comments
 (0)