Conversation

Imagine a JavaScript in a web page A has permission to access domain B (that is, CORS is not an issue) A makes an insecure/http query (websockets, XHR, whatever) to B. It fails. Is there a way to ascertain, at that point, whether it failed *because HSTS is set on that domain?*
2
5
Replying to
if it had bc HSTS enabled, wouldn’t the request be automatically upgraded to HTTPS? I have never heard of such an API
1
Replying to
1. The resource being requested is not HTTPS. It is HTTP. 2. If you "upgrade" a port 80 request to HTTPS, you do so by switching to port 443. How exactly does one upgrade an HTTP request on port 9033 to HTTPS? Request again as HTTPS on 9033?
2
1
Replying to and
You can also stick either block-all-mixed-content or upgrade-insecure-requests (forced redirect) in the Content-Security-Policy for the top-level site and it will prevent using non-TLS connections for sub-requests regardless of whether HSTS is used for the other domains, etc.
1
2
They have an example there of hosting SSH and HTTPS on the same port (empty "" protocol version means "no TLS"). Could happily host SSH, HTTPS and XMPP on one port with the same domain name using ALPN to distinguish XMPP like their example, or any number of other weird things.
1
2
select is one of those really awful legacy APIs. It hard-wires the highest possible fd to FD_SETSIZE and needs an array of that size. It breaks it any fd integer is higher. It's why Linux, etc. still have 1024 as the default soft limit on open files for every process... sigh.
2