mirror of
https://github.com/microsoft/playwright.git
synced 2024-10-27 13:50:25 +03:00
fix(har): do not hang on chunked response in har recorder (#21397)
Fixes #21182
This commit is contained in:
parent
0c5d46bb94
commit
0ebe090b8c
@ -289,6 +289,23 @@ export class HarTracer {
|
||||
return;
|
||||
const page = request.frame()?._page;
|
||||
|
||||
// In WebKit security details and server ip are reported in Network.loadingFinished, so we populate
|
||||
// it here to not hang in case of long chunked responses, see https://github.com/microsoft/playwright/issues/21182.
|
||||
if (!this._options.omitServerIP) {
|
||||
this._addBarrier(page || request.serviceWorker(), response.serverAddr().then(server => {
|
||||
if (server?.ipAddress)
|
||||
harEntry.serverIPAddress = server.ipAddress;
|
||||
if (server?.port)
|
||||
harEntry._serverPort = server.port;
|
||||
}));
|
||||
}
|
||||
if (!this._options.omitSecurityDetails) {
|
||||
this._addBarrier(page || request.serviceWorker(), response.securityDetails().then(details => {
|
||||
if (details)
|
||||
harEntry._securityDetails = details;
|
||||
}));
|
||||
}
|
||||
|
||||
const httpVersion = response.httpVersion();
|
||||
harEntry.request.httpVersion = httpVersion;
|
||||
harEntry.response.httpVersion = httpVersion;
|
||||
@ -435,20 +452,6 @@ export class HarTracer {
|
||||
this._computeHarEntryTotalTime(harEntry);
|
||||
}
|
||||
|
||||
if (!this._options.omitServerIP) {
|
||||
this._addBarrier(page || request.serviceWorker(), response.serverAddr().then(server => {
|
||||
if (server?.ipAddress)
|
||||
harEntry.serverIPAddress = server.ipAddress;
|
||||
if (server?.port)
|
||||
harEntry._serverPort = server.port;
|
||||
}));
|
||||
}
|
||||
if (!this._options.omitSecurityDetails) {
|
||||
this._addBarrier(page || request.serviceWorker(), response.securityDetails().then(details => {
|
||||
if (details)
|
||||
harEntry._securityDetails = details;
|
||||
}));
|
||||
}
|
||||
this._recordRequestOverrides(harEntry, request);
|
||||
this._addBarrier(page || request.serviceWorker(), request.rawRequestHeaders().then(headers => {
|
||||
this._recordRequestHeadersAndCookies(harEntry, headers);
|
||||
|
@ -831,7 +831,6 @@ it('should not hang on resources served from cache', async ({ contextFactory, se
|
||||
|
||||
it('should not hang on slow chunked response', async ({ browserName, browser, contextFactory, server }, testInfo) => {
|
||||
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/21182' });
|
||||
it.fixme(browserName === 'webkit');
|
||||
server.setRoute('/empty.html', (req, res) => {
|
||||
res.writeHead(200, {
|
||||
'Content-Type': 'text/html',
|
||||
|
Loading…
Reference in New Issue
Block a user