I have this caught in `rr` and have submitted it to pernosco, and I'm hoping maybe :ckerschb can take a look there and reconstruct what's going on. (I can't provide a more direct response to comment 6's request-for-a-testcase, since (a) I don't know websockets particularly well, and (b) the homeassistant JavaScript is minified/obfuscated and has a lot of async hopping around.) From skimming our C++, I suspect the relevant code here is in `WebSocketImpl::Init` which has a section: ```c++ // If the HTTPS-Only mode is enabled, we need to upgrade the websocket // connection from ws:// to wss:// and mark it as secure. ``` I added a bit of logging (included in my rr/pernosco trace) which I confirmed does get triggered -- it's a good signal for when we're converting from `ws` to `wss` for the relevant URIs here. That upgrade seems to be behind a call to `nsHTTPSOnlyUtils::ShouldUpgradeWebSocket`, which is returning `true` here, apparently because this if-check is failing: ```c++ // 3. Check if NoUpgrade-flag is set in LoadInfo uint32_t httpsOnlyStatus = aLoadInfo->GetHttpsOnlyStatus(); if (httpsOnlyStatus & nsILoadInfo::HTTPS_ONLY_EXEMPT) { ```
Bug 1701386 Comment 10 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
I have this caught in `rr` and have submitted it to pernosco, and I'm hoping maybe :ckerschb can take a look there and reconstruct what's going on. (I can't provide a more direct response to comment 6's request-for-a-testcase, since (a) I don't know websockets particularly well, and (b) the homeassistant JavaScript is minified/obfuscated and has a lot of async hopping around.) From skimming our C++, I suspect the relevant code here is in `WebSocketImpl::Init` which has a section: ```c++ // If the HTTPS-Only mode is enabled, we need to upgrade the websocket // connection from ws:// to wss:// and mark it as secure. ``` I added a bit of logging (included in my rr/pernosco trace) which I confirmed does get triggered -- it's a good signal for when we're converting from `ws` to `wss` for the relevant URIs here. That upgrade seems to be behind a call to `nsHTTPSOnlyUtils::ShouldUpgradeWebSocket`, which is returning `true` in this case, apparently because this if-check is failing: ```c++ // 3. Check if NoUpgrade-flag is set in LoadInfo uint32_t httpsOnlyStatus = aLoadInfo->GetHttpsOnlyStatus(); if (httpsOnlyStatus & nsILoadInfo::HTTPS_ONLY_EXEMPT) { ```
I have this caught in `rr` and have submitted it to pernosco, and I'm hoping maybe :ckerschb can take a look there and reconstruct what's going on. (I can't provide a more direct response to comment 6's request-for-a-testcase, since (a) I don't know websockets particularly well, and (b) the homeassistant JavaScript is minified/obfuscated and has a lot of async hopping around.) From skimming our C++, I suspect the relevant code here is in `WebSocketImpl::Init` which has a section: ```c++ // If the HTTPS-Only mode is enabled, we need to upgrade the websocket // connection from ws:// to wss:// and mark it as secure. ``` I added a bit of logging (included in my rr/pernosco trace) which I confirmed does get triggered -- it's a good signal for when we're converting from `ws` to `wss` for the relevant URIs here. That upgrade seems to be behind a call to `nsHTTPSOnlyUtils::ShouldUpgradeWebSocket`, which is returning `true` in this case, apparently because this if-check is failing -- so apparently this load isn't properly tagged as https-only-exempt: ```c++ // 3. Check if NoUpgrade-flag is set in LoadInfo uint32_t httpsOnlyStatus = aLoadInfo->GetHttpsOnlyStatus(); if (httpsOnlyStatus & nsILoadInfo::HTTPS_ONLY_EXEMPT) { ```