Explorar o código

Fixed parse host 12345 from 127.0.0.1:12345 issue

Ken M. Hwang %!s(int64=8) %!d(string=hai) anos
pai
achega
69502fa875
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      Sources/HttpParser.swift

+ 1 - 1
Sources/HttpParser.swift

@@ -84,7 +84,7 @@ public class HttpParser {
     private func readHeaders(_ socket: Socket) throws -> [String: String] {
         var headers = [String: String]()
         while case let headerLine = try socket.readLine() , !headerLine.isEmpty {
-            let headerTokens = headerLine.components(separatedBy: ":")
+            let headerTokens = headerLine.split(separator: ":", maxSplits: 1, omittingEmptySubsequences: true).map(String.init)
             if let name = headerTokens.first, let value = headerTokens.last {
                 headers[name.lowercased()] = value.trimmingCharacters(in: .whitespaces)
             }