Be sure to keep secure config even if config is changed. Fix #1078
This commit is contained in:
parent
25df8b66fc
commit
520ff72395
@ -137,10 +137,6 @@ open class SocketManager : NSObject, SocketManagerSpec, SocketParsable, SocketDa
|
|||||||
self._config = config
|
self._config = config
|
||||||
self.socketURL = socketURL
|
self.socketURL = socketURL
|
||||||
|
|
||||||
if socketURL.absoluteString.hasPrefix("https://") {
|
|
||||||
self._config.insert(.secure(true))
|
|
||||||
}
|
|
||||||
|
|
||||||
super.init()
|
super.init()
|
||||||
|
|
||||||
setConfigs(_config)
|
setConfigs(_config)
|
||||||
@ -489,12 +485,17 @@ open class SocketManager : NSObject, SocketManagerSpec, SocketParsable, SocketDa
|
|||||||
DefaultSocketLogger.Logger.log = log
|
DefaultSocketLogger.Logger.log = log
|
||||||
case let .logger(logger):
|
case let .logger(logger):
|
||||||
DefaultSocketLogger.Logger = logger
|
DefaultSocketLogger.Logger = logger
|
||||||
default:
|
case _:
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_config = config
|
_config = config
|
||||||
|
|
||||||
|
if socketURL.absoluteString.hasPrefix("https://") {
|
||||||
|
_config.insert(.secure(true))
|
||||||
|
}
|
||||||
|
|
||||||
_config.insert(.path("/socket.io/"), replacing: false)
|
_config.insert(.path("/socket.io/"), replacing: false)
|
||||||
|
|
||||||
// If `ConfigSettable` & `SocketEngineSpec`, update its configs.
|
// If `ConfigSettable` & `SocketEngineSpec`, update its configs.
|
||||||
|
|||||||
@ -18,6 +18,16 @@ class SocketMangerTest : XCTestCase {
|
|||||||
XCTAssertEqual(manager.status, .notConnected)
|
XCTAssertEqual(manager.status, .notConnected)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func testSettingConfig() {
|
||||||
|
let manager = SocketManager(socketURL: URL(string: "https://example.com/")!)
|
||||||
|
|
||||||
|
XCTAssertEqual(manager.config.first!, .secure(true))
|
||||||
|
|
||||||
|
manager.config = []
|
||||||
|
|
||||||
|
XCTAssertEqual(manager.config.first!, .secure(true))
|
||||||
|
}
|
||||||
|
|
||||||
func testManagerCallsConnect() {
|
func testManagerCallsConnect() {
|
||||||
setUpSockets()
|
setUpSockets()
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user