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

View File

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