File tree Expand file tree Collapse file tree 3 files changed +5
-5
lines changed Expand file tree Collapse file tree 3 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ extension HTTPField {
6161 return nil
6262 }
6363 let token : Substring
64- if name. hasPrefix ( " : " ) {
64+ if name. utf8 . first == UInt8 ( ascii : " : " ) {
6565 token = name. dropFirst ( )
6666 } else {
6767 token = Substring ( name)
@@ -90,7 +90,7 @@ extension HTTPField {
9090 }
9191
9292 var isPseudo : Bool {
93- self . rawName. hasPrefix ( " : " )
93+ self . rawName. utf8 . first == UInt8 ( ascii : " : " )
9494 }
9595 }
9696}
@@ -126,7 +126,7 @@ extension HTTPField.Name: Codable {
126126 public init ( from decoder: Decoder ) throws {
127127 let container = try decoder. singleValueContainer ( )
128128 let nameString = try container. decode ( String . self)
129- if nameString. hasPrefix ( " : " ) {
129+ if nameString. utf8 . first == UInt8 ( ascii : " : " ) {
130130 guard nameString. lowercased ( ) == nameString,
131131 HTTPField . isValidToken ( nameString. dropFirst ( ) )
132132 else {
Original file line number Diff line number Diff line change @@ -298,7 +298,7 @@ extension HTTPRequest.PseudoHeaderFields: Codable {
298298 }
299299 extendedConnectProtocol = field
300300 default :
301- guard field. name. rawName. hasPrefix ( " : " ) else {
301+ guard field. name. rawName. utf8 . first == UInt8 ( ascii : " : " ) else {
302302 throw DecodingError . dataCorruptedError (
303303 in: container,
304304 debugDescription: " \" \( field) \" is not a pseudo header field "
Original file line number Diff line number Diff line change @@ -239,7 +239,7 @@ extension HTTPResponse.PseudoHeaderFields: Codable {
239239 }
240240 status = field
241241 default :
242- guard field. name. rawName. hasPrefix ( " : " ) else {
242+ guard field. name. rawName. utf8 . first == UInt8 ( ascii : " : " ) else {
243243 throw DecodingError . dataCorruptedError (
244244 in: container,
245245 debugDescription: " \" \( field) \" is not a pseudo header field "
You can’t perform that action at this time.
0 commit comments