Recognize "--compress lzo" option as legal

This commit is contained in:
Davide De Rosa 2019-03-19 23:08:38 +01:00
parent a06a4fef9b
commit 9a6f3d638c
2 changed files with 19 additions and 10 deletions

View File

@ -315,11 +315,18 @@ public class ConfigurationParser {
isHandled = true isHandled = true
compressionFraming = .compress compressionFraming = .compress
if !LZOIsSupported() {
guard $0.isEmpty else { guard $0.isEmpty else {
compressionAlgorithm = .other
unsupportedError = .unsupportedConfiguration(option: line) unsupportedError = .unsupportedConfiguration(option: line)
return return
} }
} else {
if let arg = $0.first {
compressionAlgorithm = (arg == "lzo") ? .LZO : .other
} else {
compressionAlgorithm = .disabled
}
}
} }
Regex.keyDirection.enumerateArguments(in: line) { Regex.keyDirection.enumerateArguments(in: line) {
isHandled = true isHandled = true

View File

@ -395,18 +395,20 @@ extension SessionProxy {
switch $0[0] { switch $0[0] {
case "comp-lzo": case "comp-lzo":
compressionFraming = .compLZO compressionFraming = .compLZO
if !(($0.count == 2) && ($0[1] == "no")) { if ($0.count == 2) && ($0[1] == "no") {
compressionAlgorithm = .LZO
} else {
compressionAlgorithm = .disabled compressionAlgorithm = .disabled
} else {
compressionAlgorithm = .LZO
} }
case "compress": case "compress":
compressionFraming = .compress compressionFraming = .compress
if $0.count > 1 { if $0.count == 1 {
compressionAlgorithm = .other
} else {
compressionAlgorithm = .disabled compressionAlgorithm = .disabled
} else if ($0.count == 2) && ($0[1] == "lzo") {
compressionAlgorithm = .LZO
} else {
compressionAlgorithm = .other
} }
default: default: