Network.setRequestInterception causes invalid SSL pages to hangup instead of triggerring error.

210 views
Skip to first unread message

Lee McCall

unread,
Mar 17, 2018, 10:16:31 AM3/17/18
to chrome-debugging-protocol

I need to use Network.setRequestInterception while taking a screenshot of webpages

but notice that when I attempt to take a screenshot of a webpage which has a wrong host SSL certificate the script hangs up and times out.


If I remove Network.setRequestInterception the script does not hang up and displays the error below.
Error: net::ERR_CERT_COMMON_NAME_INVALID at https://wrong.host.badssl.com/


Is this a bug? I need to use Network.setRequestInterception to abort some scripts.


Simplified code to illustrate the issue:


const puppeteer = require('puppeteer');
(async () => {
 
const browser = await puppeteer.launch();
 
const page = await browser.newPage();


  const client = await page.target().createCDPSession();
  await client
.send('Network.enable');
  await client
.send('Network.setRequestInterception', {
    patterns
: [{ urlPattern: '*' }],
 
});


  await page.goto('https://wrong.host.badssl.com/', {timeout: 0, waitUntil: 'load'});
  await page
.screenshot({path: 'screenshot/site.png'});
  await browser
.close();
})();


If you comment out await Network.setRequestInterception the script will run and display an error which is what I want.

Lee McCall

unread,
Mar 17, 2018, 11:35:04 AM3/17/18
to chrome-debugging-protocol
EDIT: The hang is not specific to a wrong host error. Basically the script will hang up when using Network.setRequestInterception for any URL which contains an invalid or non-existant ssl certificate.
Reply all
Reply to author
Forward
0 new messages