fixes
This commit is contained in:
parent
5708baec75
commit
f677959394
|
|
@ -261,6 +261,7 @@ export abstract class APIRequestContext extends SdkObject {
|
|||
try {
|
||||
return await this._sendRequest(progress, url, options, postData);
|
||||
} catch (e) {
|
||||
e = rewriteOpenSSLErrorIfNeeded(e);
|
||||
if (maxRetries === 0)
|
||||
throw e;
|
||||
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('end', notifyBodyFinished);
|
||||
});
|
||||
request.on('error', error => reject(rewriteOpenSSLErrorIfNeeded(error)));
|
||||
request.on('error', reject);
|
||||
|
||||
const disposeListener = () => {
|
||||
reject(new Error('Request context disposed.'));
|
||||
|
|
|
|||
|
|
@ -57,14 +57,14 @@ export class TestProxy {
|
|||
this._prependHandler('request', (req: IncomingMessage) => {
|
||||
this.requestUrls.push(req.url);
|
||||
const url = new URL(req.url);
|
||||
url.host = `localhost:${port}`;
|
||||
url.host = `127.0.0.1:${port}`;
|
||||
req.url = url.toString();
|
||||
});
|
||||
this._prependHandler('connect', (req: IncomingMessage) => {
|
||||
if (!options?.allowConnectRequests)
|
||||
return;
|
||||
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');
|
||||
return {
|
||||
closeProxyServer: () => socksProxy.close(),
|
||||
proxyServerAddr: `socks5://localhost:${port}`,
|
||||
proxyServerAddr: `socks5://127.0.0.1:${port}`,
|
||||
connectHosts,
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ const test = base.extend<TestOptions>({
|
|||
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()));
|
||||
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}/`;
|
||||
});
|
||||
if (server)
|
||||
|
|
@ -365,7 +365,7 @@ test.describe('browser', () => {
|
|||
});
|
||||
expect(proxyServer.connectHosts).toEqual([]);
|
||||
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 page.close();
|
||||
});
|
||||
|
|
@ -389,7 +389,7 @@ test.describe('browser', () => {
|
|||
});
|
||||
expect(connectHosts).toEqual([]);
|
||||
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 page.close();
|
||||
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('alpn-protocol')).toHaveText('h2');
|
||||
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('alpn-protocol')).toHaveText('http/1.1');
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue