1
0
mirror of https://github.com/square/okhttp.git synced 2025-11-29 06:23:09 +03:00

Smattering of Kotlin part 2 (#5087)

* Migrate eventListenerFactory to extension function

* Inline platformTrustManager

* Migrate delimiterOffset to extension functions

Also overhaul these and other string-manipulating functions to have default arguments for start/end indices.

* Migrate hostHeader and toHeaders to extension functions
This commit is contained in:
Jake Wharton
2019-05-21 21:51:18 -04:00
committed by Jesse Wilson
parent 42a41f3857
commit f2187bb6e3
9 changed files with 67 additions and 76 deletions

View File

@@ -79,8 +79,8 @@ class JavaNetCookieJar(private val cookieHandler: CookieHandler) : CookieJar {
val limit = header.length
var pairEnd: Int
while (pos < limit) {
pairEnd = delimiterOffset(header, pos, limit, ";,")
val equalsSign = delimiterOffset(header, pos, pairEnd, '=')
pairEnd = header.delimiterOffset(";,", pos, limit)
val equalsSign = header.delimiterOffset('=', pos, pairEnd)
val name = header.trimSubstring(pos, equalsSign)
if (name.startsWith("$")) {
pos = pairEnd + 1