jeffbski / wait-on

wait-on is a cross-platform command line utility and Node.js API which will wait for files, ports, sockets, and http(s) resources to become available
MIT License
1.87k stars 77 forks source link

Always succeeds with https urls #100

Open DamienCassou opened 3 years ago

DamienCassou commented 3 years ago

Given a non-existing random URL using HTTP:

$ curl -D - http://bla.blu.bli
HTTP/1.1 403 Forbidden
Date: Mon, 14 Jun 2021 20:16:38 GMT
Server: Apache
Content-Length: 202
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>403 Forbidden</title>
</head><body>
...

I correctly get an error message from wait-on:

$ npx wait-on --timeout 2000 http://bla.blu.bli && echo 'foo'
npx: installed 13 in 2.019s
Error: Timed out waiting for: http://bla.blu.bli

This is perfectly fine! Nevertheless, when using HTTPS on the same random URL, I get:

$ curl -D - https://bla.blu.bli
curl: (60) SSL: no alternative certificate subject name matches target host name 'bla.blu.bli'
More details here: https://curl.se/docs/sslcerts.html

$ npx wait-on --timeout 2000 https://bla.blu.bli && echo 'foo'
npx: installed 13 in 2.211s
foo

Why does wait-on succeeds here? I tried with other random HTTPS URLS and wait-on always succeeds.