diff --git a/CHANGELOG.md b/CHANGELOG.md index 242a3ef..c104025 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Override DNS servers client side. [#56](https://github.com/keeshux/tunnelkit/pull/56) +- Shut down if server pushes a compression directive. ### Changed diff --git a/TunnelKit/Sources/Core/SessionError.swift b/TunnelKit/Sources/Core/SessionError.swift index 2198138..32d4dd0 100644 --- a/TunnelKit/Sources/Core/SessionError.swift +++ b/TunnelKit/Sources/Core/SessionError.swift @@ -70,6 +70,9 @@ public enum SessionError: String, Error { /// The session reached a stale state and can't be recovered. case staleSession + + /// Server uses compression. + case serverCompression } extension Error { diff --git a/TunnelKit/Sources/Core/SessionProxy.swift b/TunnelKit/Sources/Core/SessionProxy.swift index 3a45bf3..fa2d5f9 100644 --- a/TunnelKit/Sources/Core/SessionProxy.swift +++ b/TunnelKit/Sources/Core/SessionProxy.swift @@ -905,6 +905,11 @@ public class SessionProxy { } reply = optionalReply log.debug("Received PUSH_REPLY: \"\(reply.maskedDescription)\"") + + if let framing = reply.compressionFraming, reply.usesCompression { + log.error("Server has compression enabled and this is currently unsupported (\(framing))") + throw SessionError.serverCompression + } } catch let e { deferStop(.shutdown, e) return