Skip to content

Commit

Permalink
feat(agent): support authenticated proxies when mitm is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
soundofspace committed Jan 20, 2025
1 parent 19de3ad commit 9946794
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions agent/main/interfaces/IProxyConnectionOptions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export default interface IProxyConnectionOptions {
address: string;
username?: string;
password?: string;
}
7 changes: 3 additions & 4 deletions agent/main/lib/Agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,9 @@ export default class Agent extends TypedEventEmitter<{ close: void }> {

private get proxyConnectionInfo(): IProxyConnectionOptions {
if (!this.enableMitm) {
if (this.emulationProfile.upstreamProxyUrl) {
return { address: this.emulationProfile.upstreamProxyUrl };
}
return null;
if (!this.emulationProfile.upstreamProxyUrl) return null;
const url = new URL(this.emulationProfile.upstreamProxyUrl);
return { address: url.origin, username: url.username, password: url.password };
}
if (this.isolatedMitm) {
// don't use password for an isolated mitm proxy
Expand Down

0 comments on commit 9946794

Please sign in to comment.