node.js - Nodejs https does not fail on ssl certificate failure -


i using https library nodejs send https request using following code. valid 200 status though certificate of server being tested expired.

https.get(options, this.onresponsecallback.bind(this)); 

the value of options shown below.

{     protocol: 'https: ',     slashes: true,     auth: null,     host: 'xxxxxxxx',     port: '443',     hostname: 'xxxxxxxx',     hash: null,     search: 'xxxxxxxx',     query: 'xxxxxxxx',     pathname: '/xxxxxxxx/xxxxxxxx',     path: '/xxxxxxxx/xxxxxxxx?xxxxxxxx',     href: 'https://xxxxxxxx',     headers: {         'user-agent': 'nodeuptime/3.0(https://github.com/fzaninotto/uptime)'     },     rejectunauthorized: true } 

if hit same url in browser following error.

firefox

how nodejs fail when cert expired?

i think browser security policy bit stricter can in node.

you can access info server's certificate by:

https.request(options, function(response){   var cert = response.client.pair.cleartext.getpeercertificate(); }); 

.valid_to looking for.

more info tls.


Comments

Popular posts from this blog

javascript - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

java - Reading data from multiple zip files and combining them to one -