Skip to content

Commit 1d52f65

Browse files
author
Dave Abrahams
authored
Merge pull request #1129 from apple/swift-PR-11088
More adjustments in support of Swift PR 11088
2 parents eac1d9b + 99899e3 commit 1d52f65

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Foundation/NSURLSession/http/HTTPMessage.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ private extension String {
222222
/// Split a request line into its 3 parts: *Method*, *Request-URI*, and *HTTP-Version*.
223223
/// - SeeAlso: https://tools.ietf.org/html/rfc2616#section-5.1
224224
func splitRequestLine() -> (String, String, String)? {
225-
let scalars = self.unicodeScalars
225+
let scalars = self.unicodeScalars[...]
226226
guard let firstSpace = scalars.rangeOfSpace else { return nil }
227227
let remainingRange = firstSpace.upperBound..<scalars.endIndex
228228
let remainder = scalars[remainingRange]
@@ -285,7 +285,7 @@ private extension _HTTPURLProtocol._HTTPMessage._Header {
285285
// recipient MAY replace any linear white space with a single SP before
286286
// interpreting the field value or forwarding the message downstream.
287287
guard let (head, tail) = lines.decompose else { return nil }
288-
let headView = head.unicodeScalars
288+
let headView = head.unicodeScalars[...]
289289
guard let nameRange = headView.rangeOfTokenPrefix else { return nil }
290290
guard headView.index(after: nameRange.upperBound) <= headView.endIndex && headView[nameRange.upperBound] == _HTTPCharacters.Colon else { return nil }
291291
let name = String(headView[nameRange])
@@ -302,10 +302,10 @@ private extension _HTTPURLProtocol._HTTPMessage._Header {
302302
}
303303
do {
304304
var t = tail
305-
while t.first?.unicodeScalars.hasSPHTPrefix ?? false {
305+
while t.first?.unicodeScalars[...].hasSPHTPrefix ?? false {
306306
guard let (h2, t2) = t.decompose else { return nil }
307307
t = t2
308-
guard let v = h2.unicodeScalars.trimSPHTPrefix else { return nil }
308+
guard let v = h2.unicodeScalars[...].trimSPHTPrefix else { return nil }
309309
let valuePart = String(v)
310310
value = value.map { $0 + " " + valuePart } ?? valuePart
311311
}
@@ -321,7 +321,7 @@ private extension Collection {
321321
return (head, tail)
322322
}
323323
}
324-
private extension String.UnicodeScalarView {
324+
private extension String.UnicodeScalarView.SubSequence {
325325
/// The range of *Token* characters as specified by RFC 2616.
326326
var rangeOfTokenPrefix: Range<Index>? {
327327
var end = startIndex
@@ -344,7 +344,7 @@ private extension String.UnicodeScalarView {
344344
}
345345
/// Unicode scalars after removing the leading spaces (SP) and horizontal tabs (HT).
346346
/// Returns `nil` if the unicode scalars do not start with a SP or HT.
347-
var trimSPHTPrefix: String.UnicodeScalarView? {
347+
var trimSPHTPrefix: SubSequence? {
348348
guard !isEmpty else { return nil }
349349
var idx = startIndex
350350
while idx < endIndex {

0 commit comments

Comments
 (0)