Skip to content

Commit

Permalink
Do not override sockProtocol from config (#835)
Browse files Browse the repository at this point in the history
* refactor: Do not override sockProtocol from config

* style: Insert missing newline
  • Loading branch information
darkexone authored Apr 25, 2024
1 parent 7adea92 commit 88e1441
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sockets/utils/getSocketUrlParts.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,12 @@ function getSocketUrlParts(resourceQuery, metadata) {
// We only re-assign `protocol` when `protocol` is unavailable,
// or if `hostname` is available and is empty,
// since otherwise we risk creating an invalid URL.
// We also do this when 'https' is used as it mandates the use of secure sockets.
// We also do this when no sockProtocol was passed to the config and 'https' is used,
// as it mandates the use of secure sockets.
if (
!urlParts.protocol ||
(urlParts.hostname && (isEmptyHostname || window.location.protocol === 'https:'))
(urlParts.hostname &&
(isEmptyHostname || (!resourceQuery && window.location.protocol === 'https:')))
) {
urlParts.protocol = window.location.protocol;
}
Expand Down

0 comments on commit 88e1441

Please sign in to comment.