mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
fix(windows): enable socks5 hostname resolution on WebKit (#20435)
Fixes https://github.com/microsoft/playwright/issues/20451
This commit is contained in:
parent
252b489a7f
commit
71752b4b2a
@ -75,7 +75,9 @@ export class WebKit extends BrowserType {
|
|||||||
if (proxy.bypass)
|
if (proxy.bypass)
|
||||||
webkitArguments.push(...proxy.bypass.split(',').map(t => `--ignore-host=${t}`));
|
webkitArguments.push(...proxy.bypass.split(',').map(t => `--ignore-host=${t}`));
|
||||||
} else if (process.platform === 'win32') {
|
} else if (process.platform === 'win32') {
|
||||||
webkitArguments.push(`--curl-proxy=${proxy.server}`);
|
// Enable socks5 hostname resolution on Windows. Workaround can be removed once fixed upstream.
|
||||||
|
// See https://github.com/microsoft/playwright/issues/20451
|
||||||
|
webkitArguments.push(`--curl-proxy=${proxy.server.replace(/^socks5:\/\//, 'socks5h://')}`);
|
||||||
if (proxy.bypass)
|
if (proxy.bypass)
|
||||||
webkitArguments.push(`--curl-noproxy=${proxy.bypass}`);
|
webkitArguments.push(`--curl-noproxy=${proxy.bypass}`);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -85,7 +85,9 @@ export class WKBrowser extends Browser {
|
|||||||
|
|
||||||
async doCreateNewContext(options: channels.BrowserNewContextParams): Promise<BrowserContext> {
|
async doCreateNewContext(options: channels.BrowserNewContextParams): Promise<BrowserContext> {
|
||||||
const createOptions = options.proxy ? {
|
const createOptions = options.proxy ? {
|
||||||
proxyServer: options.proxy.server,
|
// Enable socks5 hostname resolution on Windows. Workaround can be removed once fixed upstream.
|
||||||
|
// See https://github.com/microsoft/playwright/issues/20451
|
||||||
|
proxyServer: process.platform === 'win32' ? options.proxy.server.replace(/^socks5:\/\//, 'socks5h://') : options.proxy.server,
|
||||||
proxyBypassList: options.proxy.bypass
|
proxyBypassList: options.proxy.bypass
|
||||||
} : undefined;
|
} : undefined;
|
||||||
const { browserContextId } = await this._browserSession.send('Playwright.createContext', createOptions);
|
const { browserContextId } = await this._browserSession.send('Playwright.createContext', createOptions);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user