fixes
This commit is contained in:
parent
5708baec75
commit
f677959394
|
|
@ -261,6 +261,7 @@ export abstract class APIRequestContext extends SdkObject {
|
||||||
try {
|
try {
|
||||||
return await this._sendRequest(progress, url, options, postData);
|
return await this._sendRequest(progress, url, options, postData);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
e = rewriteOpenSSLErrorIfNeeded(e);
|
||||||
if (maxRetries === 0)
|
if (maxRetries === 0)
|
||||||
throw e;
|
throw e;
|
||||||
if (i === maxRetries || (options.deadline && monotonicTime() + backoff > options.deadline))
|
if (i === maxRetries || (options.deadline && monotonicTime() + backoff > options.deadline))
|
||||||
|
|
@ -469,7 +470,7 @@ export abstract class APIRequestContext extends SdkObject {
|
||||||
body.on('data', chunk => chunks.push(chunk));
|
body.on('data', chunk => chunks.push(chunk));
|
||||||
body.on('end', notifyBodyFinished);
|
body.on('end', notifyBodyFinished);
|
||||||
});
|
});
|
||||||
request.on('error', error => reject(rewriteOpenSSLErrorIfNeeded(error)));
|
request.on('error', reject);
|
||||||
|
|
||||||
const disposeListener = () => {
|
const disposeListener = () => {
|
||||||
reject(new Error('Request context disposed.'));
|
reject(new Error('Request context disposed.'));
|
||||||
|
|
|
||||||
|
|
@ -57,14 +57,14 @@ export class TestProxy {
|
||||||
this._prependHandler('request', (req: IncomingMessage) => {
|
this._prependHandler('request', (req: IncomingMessage) => {
|
||||||
this.requestUrls.push(req.url);
|
this.requestUrls.push(req.url);
|
||||||
const url = new URL(req.url);
|
const url = new URL(req.url);
|
||||||
url.host = `localhost:${port}`;
|
url.host = `127.0.0.1:${port}`;
|
||||||
req.url = url.toString();
|
req.url = url.toString();
|
||||||
});
|
});
|
||||||
this._prependHandler('connect', (req: IncomingMessage) => {
|
this._prependHandler('connect', (req: IncomingMessage) => {
|
||||||
if (!options?.allowConnectRequests)
|
if (!options?.allowConnectRequests)
|
||||||
return;
|
return;
|
||||||
this.connectHosts.push(req.url);
|
this.connectHosts.push(req.url);
|
||||||
req.url = `localhost:${port}`;
|
req.url = `127.0.0.1:${port}`;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -141,7 +141,7 @@ export async function setupSocksForwardingServer({
|
||||||
await socksProxy.listen(port, '127.0.0.1');
|
await socksProxy.listen(port, '127.0.0.1');
|
||||||
return {
|
return {
|
||||||
closeProxyServer: () => socksProxy.close(),
|
closeProxyServer: () => socksProxy.close(),
|
||||||
proxyServerAddr: `socks5://localhost:${port}`,
|
proxyServerAddr: `socks5://127.0.0.1:${port}`,
|
||||||
connectHosts,
|
connectHosts,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ const test = base.extend<TestOptions>({
|
||||||
res.end(parts.map(({ key, value }) => `<div data-testid="${key}">${value}</div>`).join(''));
|
res.end(parts.map(({ key, value }) => `<div data-testid="${key}">${value}</div>`).join(''));
|
||||||
});
|
});
|
||||||
await new Promise<void>(f => server.listen(0, '127.0.0.1', () => f()));
|
await new Promise<void>(f => server.listen(0, '127.0.0.1', () => f()));
|
||||||
const host = options?.useFakeLocalhost ? 'local.playwright' : 'localhost';
|
const host = options?.useFakeLocalhost ? 'local.playwright' : '127.0.0.1';
|
||||||
return `https://${host}:${(server.address() as net.AddressInfo).port}/`;
|
return `https://${host}:${(server.address() as net.AddressInfo).port}/`;
|
||||||
});
|
});
|
||||||
if (server)
|
if (server)
|
||||||
|
|
@ -365,7 +365,7 @@ test.describe('browser', () => {
|
||||||
});
|
});
|
||||||
expect(proxyServer.connectHosts).toEqual([]);
|
expect(proxyServer.connectHosts).toEqual([]);
|
||||||
await page.goto(serverURL);
|
await page.goto(serverURL);
|
||||||
expect([...new Set(proxyServer.connectHosts)]).toEqual([`localhost:${new URL(serverURL).port}`]);
|
expect([...new Set(proxyServer.connectHosts)]).toEqual([`127.0.0.1:${new URL(serverURL).port}`]);
|
||||||
await expect(page.getByTestId('message')).toHaveText('Hello Alice, your certificate was issued by localhost!');
|
await expect(page.getByTestId('message')).toHaveText('Hello Alice, your certificate was issued by localhost!');
|
||||||
await page.close();
|
await page.close();
|
||||||
});
|
});
|
||||||
|
|
@ -389,7 +389,7 @@ test.describe('browser', () => {
|
||||||
});
|
});
|
||||||
expect(connectHosts).toEqual([]);
|
expect(connectHosts).toEqual([]);
|
||||||
await page.goto(serverURL);
|
await page.goto(serverURL);
|
||||||
expect(connectHosts).toEqual([`localhost:${serverPort}`]);
|
expect(connectHosts).toEqual([`127.0.0.1:${serverPort}`]);
|
||||||
await expect(page.getByTestId('message')).toHaveText('Hello Alice, your certificate was issued by localhost!');
|
await expect(page.getByTestId('message')).toHaveText('Hello Alice, your certificate was issued by localhost!');
|
||||||
await page.close();
|
await page.close();
|
||||||
await closeProxyServer();
|
await closeProxyServer();
|
||||||
|
|
@ -687,7 +687,7 @@ test.describe('browser', () => {
|
||||||
}],
|
}],
|
||||||
});
|
});
|
||||||
{
|
{
|
||||||
await page.goto(serverURL.replace('localhost', 'local.playwright'));
|
await page.goto(serverURL.replace('127.0.0.1', 'local.playwright'));
|
||||||
await expect(page.getByTestId('message')).toHaveText('Sorry, but you need to provide a client certificate to continue.');
|
await expect(page.getByTestId('message')).toHaveText('Sorry, but you need to provide a client certificate to continue.');
|
||||||
await expect(page.getByTestId('alpn-protocol')).toHaveText('h2');
|
await expect(page.getByTestId('alpn-protocol')).toHaveText('h2');
|
||||||
await expect(page.getByTestId('servername')).toHaveText('local.playwright');
|
await expect(page.getByTestId('servername')).toHaveText('local.playwright');
|
||||||
|
|
@ -713,7 +713,7 @@ test.describe('browser', () => {
|
||||||
}],
|
}],
|
||||||
});
|
});
|
||||||
{
|
{
|
||||||
await page.goto(serverURL.replace('localhost', 'local.playwright'));
|
await page.goto(serverURL.replace('127.0.0.1', 'local.playwright'));
|
||||||
await expect(page.getByTestId('message')).toHaveText('Sorry, but you need to provide a client certificate to continue.');
|
await expect(page.getByTestId('message')).toHaveText('Sorry, but you need to provide a client certificate to continue.');
|
||||||
await expect(page.getByTestId('alpn-protocol')).toHaveText('http/1.1');
|
await expect(page.getByTestId('alpn-protocol')).toHaveText('http/1.1');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue