Throw to exit PUSH_REPLY parsing on continuation
This commit is contained in:
parent
23b6e3b98e
commit
380ac2beac
@ -106,6 +106,10 @@ public class ConfigurationParser {
|
||||
static let externalFiles = NSRegularExpression("^(ca|cert|key|tls-auth|tls-crypt) ")
|
||||
|
||||
static let connection = NSRegularExpression("^<connection>")
|
||||
|
||||
// MARK: Continuation
|
||||
|
||||
static let continuation = NSRegularExpression("^push-continuation [12]")
|
||||
}
|
||||
|
||||
private enum Topology: String {
|
||||
@ -232,6 +236,16 @@ public class ConfigurationParser {
|
||||
isHandled = true
|
||||
}
|
||||
|
||||
// MARK: Continuation
|
||||
|
||||
var isContinuation = false
|
||||
Regex.continuation.enumerateArguments(in: line) {
|
||||
isContinuation = ($0.first == "2")
|
||||
}
|
||||
guard !isContinuation else {
|
||||
throw SessionError.continuationPushReply
|
||||
}
|
||||
|
||||
// MARK: Inline content
|
||||
|
||||
if unsupportedError == nil {
|
||||
|
@ -59,6 +59,12 @@ public enum SessionError: String, Error {
|
||||
/// The provided credentials failed authentication.
|
||||
case badCredentials
|
||||
|
||||
/// The PUSH_REPLY is multipart.
|
||||
case continuationPushReply
|
||||
|
||||
/// The reply to PUSH_REQUEST is malformed.
|
||||
case malformedPushReply
|
||||
|
||||
/// A write operation failed at the link layer (e.g. network unreachable).
|
||||
case failedLinkWrite
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user