also add socks proxy

This commit is contained in:
Simon Knott 2024-09-27 14:37:24 +02:00
parent 988da93cc8
commit 6492999506
No known key found for this signature in database
GPG key ID: 8CEDC00028084AEC
2 changed files with 5 additions and 2 deletions

View file

@ -508,6 +508,10 @@ export abstract class APIRequestContext extends SdkObject {
} }
}); });
// when using socks proxy, having the socket means the connection got established
if (agent instanceof SocksProxyAgent)
tcpConnectionAt ??= monotonicTime();
serverIPAddress = socket.remoteAddress; serverIPAddress = socket.remoteAddress;
serverPort = socket.remotePort; serverPort = socket.remotePort;
}); });

View file

@ -868,8 +868,7 @@ it('should include timings when using http proxy', async ({ contextFactory, serv
expect(log.entries[0].timings.connect).toBeGreaterThan(0); expect(log.entries[0].timings.connect).toBeGreaterThan(0);
}); });
// socks proxy library doesnt emit an event to know when the TCP connection starts it('should include timings when using socks proxy', async ({ contextFactory, server, socksPort }, testInfo) => {
it.fail('should include timings when using socks proxy', async ({ contextFactory, server, socksPort }, testInfo) => {
const { page, getLog } = await pageWithHar(contextFactory, testInfo, { proxy: { server: `socks5://localhost:${socksPort}` } }); const { page, getLog } = await pageWithHar(contextFactory, testInfo, { proxy: { server: `socks5://localhost:${socksPort}` } });
const response = await page.request.get(server.EMPTY_PAGE); const response = await page.request.get(server.EMPTY_PAGE);
await response.body(); await response.body();