@@ -222,7 +222,7 @@ private extension String {
222
222
/// Split a request line into its 3 parts: *Method*, *Request-URI*, and *HTTP-Version*.
223
223
/// - SeeAlso: https://tools.ietf.org/html/rfc2616#section-5.1
224
224
func splitRequestLine( ) -> ( String , String , String ) ? {
225
- let scalars = self . unicodeScalars
225
+ let scalars = self . unicodeScalars [ ... ]
226
226
guard let firstSpace = scalars. rangeOfSpace else { return nil }
227
227
let remainingRange = firstSpace. upperBound..< scalars. endIndex
228
228
let remainder = scalars [ remainingRange]
@@ -285,7 +285,7 @@ private extension _HTTPURLProtocol._HTTPMessage._Header {
285
285
// recipient MAY replace any linear white space with a single SP before
286
286
// interpreting the field value or forwarding the message downstream.
287
287
guard let ( head, tail) = lines. decompose else { return nil }
288
- let headView = head. unicodeScalars
288
+ let headView = head. unicodeScalars [ ... ]
289
289
guard let nameRange = headView. rangeOfTokenPrefix else { return nil }
290
290
guard headView. index ( after: nameRange. upperBound) <= headView. endIndex && headView [ nameRange. upperBound] == _HTTPCharacters. Colon else { return nil }
291
291
let name = String ( headView [ nameRange] )
@@ -302,10 +302,10 @@ private extension _HTTPURLProtocol._HTTPMessage._Header {
302
302
}
303
303
do {
304
304
var t = tail
305
- while t. first? . unicodeScalars. hasSPHTPrefix ?? false {
305
+ while t. first? . unicodeScalars [ ... ] . hasSPHTPrefix ?? false {
306
306
guard let ( h2, t2) = t. decompose else { return nil }
307
307
t = t2
308
- guard let v = h2. unicodeScalars. trimSPHTPrefix else { return nil }
308
+ guard let v = h2. unicodeScalars [ ... ] . trimSPHTPrefix else { return nil }
309
309
let valuePart = String ( v)
310
310
value = value. map { $0 + " " + valuePart } ?? valuePart
311
311
}
@@ -321,7 +321,7 @@ private extension Collection {
321
321
return ( head, tail)
322
322
}
323
323
}
324
- private extension String . UnicodeScalarView {
324
+ private extension String . UnicodeScalarView . SubSequence {
325
325
/// The range of *Token* characters as specified by RFC 2616.
326
326
var rangeOfTokenPrefix : Range < Index > ? {
327
327
var end = startIndex
@@ -344,7 +344,7 @@ private extension String.UnicodeScalarView {
344
344
}
345
345
/// Unicode scalars after removing the leading spaces (SP) and horizontal tabs (HT).
346
346
/// Returns `nil` if the unicode scalars do not start with a SP or HT.
347
- var trimSPHTPrefix : String . UnicodeScalarView ? {
347
+ var trimSPHTPrefix : SubSequence ? {
348
348
guard !isEmpty else { return nil }
349
349
var idx = startIndex
350
350
while idx < endIndex {
0 commit comments