Shut down when server pushes compression enabled

This commit is contained in:
Davide De Rosa 2019-02-23 20:07:32 +01:00
parent 367e8b7e08
commit 3aadaf0186
3 changed files with 9 additions and 0 deletions

View File

@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added ### Added
- Override DNS servers client side. [#56](https://github.com/keeshux/tunnelkit/pull/56) - Override DNS servers client side. [#56](https://github.com/keeshux/tunnelkit/pull/56)
- Shut down if server pushes a compression directive.
### Changed ### Changed

View File

@ -70,6 +70,9 @@ public enum SessionError: String, Error {
/// The session reached a stale state and can't be recovered. /// The session reached a stale state and can't be recovered.
case staleSession case staleSession
/// Server uses compression.
case serverCompression
} }
extension Error { extension Error {

View File

@ -905,6 +905,11 @@ public class SessionProxy {
} }
reply = optionalReply reply = optionalReply
log.debug("Received PUSH_REPLY: \"\(reply.maskedDescription)\"") 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 { } catch let e {
deferStop(.shutdown, e) deferStop(.shutdown, e)
return return