Skip to content

Commit

Permalink
Respect bind setting for all outgoing requests
Browse files Browse the repository at this point in the history
So far the bind config only impacted the IRC connections.
However, nothing in our doc comment says that this is intentional.

bind
Set the local IP to bind to for outgoing connections.

This commit fixes the leak and uses it for all outgoing requests
as described by the docstring.
  • Loading branch information
brunnre8 committed Jul 16, 2023
2 parents 447a237 + 3af4ad1 commit 2878f87
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 153 deletions.
2 changes: 2 additions & 0 deletions server/plugins/changelog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import colors from "chalk";
import log from "../log";
import pkg from "../../package.json";
import ClientManager from "../clientManager";
import Config from "../config";

const TIME_TO_LIVE = 15 * 60 * 1000; // 15 minutes, in milliseconds

Expand Down Expand Up @@ -51,6 +52,7 @@ async function fetch() {
Accept: "application/vnd.github.v3.html", // Request rendered markdown
"User-Agent": pkg.name + "; +" + pkg.repository.url, // Identify the client
},
localAddress: Config.values.bind,
});

if (response.statusCode !== 200) {
Expand Down
1 change: 1 addition & 0 deletions server/plugins/irc-events/link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@ function fetch(uri: string, headers: Record<string, string>) {
retry: 0,
timeout: prefetchTimeout || 5000, // milliseconds
headers: getRequestHeaders(headers),
localAddress: Config.values.bind,
});

gotStream
Expand Down

0 comments on commit 2878f87

Please sign in to comment.