mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00: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;
|
return;
|
||||||
const page = request.frame()?._page;
|
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();
|
const httpVersion = response.httpVersion();
|
||||||
harEntry.request.httpVersion = httpVersion;
|
harEntry.request.httpVersion = httpVersion;
|
||||||
harEntry.response.httpVersion = httpVersion;
|
harEntry.response.httpVersion = httpVersion;
|
||||||
@ -435,20 +452,6 @@ export class HarTracer {
|
|||||||
this._computeHarEntryTotalTime(harEntry);
|
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._recordRequestOverrides(harEntry, request);
|
||||||
this._addBarrier(page || request.serviceWorker(), request.rawRequestHeaders().then(headers => {
|
this._addBarrier(page || request.serviceWorker(), request.rawRequestHeaders().then(headers => {
|
||||||
this._recordRequestHeadersAndCookies(harEntry, 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('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.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/21182' });
|
||||||
it.fixme(browserName === 'webkit');
|
|
||||||
server.setRoute('/empty.html', (req, res) => {
|
server.setRoute('/empty.html', (req, res) => {
|
||||||
res.writeHead(200, {
|
res.writeHead(200, {
|
||||||
'Content-Type': 'text/html',
|
'Content-Type': 'text/html',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user