From 030dbeae26c173a34a1ffc05096532bc160ed1ee Mon Sep 17 00:00:00 2001 From: Jesse Wilson Date: Wed, 22 May 2019 21:12:55 -0400 Subject: [PATCH] Delete unwanted whitespace. I think the convert-to-Kotlin feature adds these --- .../java/okhttp3/mockwebserver/Dispatcher.kt | 2 +- .../okhttp3/mockwebserver/MockResponse.kt | 20 +++++------ .../okhttp3/mockwebserver/MockWebServer.kt | 4 +-- .../java/okhttp3/mockwebserver/PushPromise.kt | 2 +- .../okhttp3/mockwebserver/RecordedRequest.kt | 6 ++-- .../okhttp3/mockwebserver/SocketPolicy.kt | 6 ++-- .../java/okhttp3/dnsoverhttps/package-info.kt | 2 +- .../okhttp3/logging/HttpLoggingInterceptor.kt | 2 +- .../src/main/java/okhttp3/sse/EventSource.kt | 2 +- .../main/java/okhttp3/tls/HeldCertificate.kt | 2 +- .../main/java/okhttp3/tls/internal/TlsUtil.kt | 4 +-- .../src/main/java/okhttp3/JavaNetCookieJar.kt | 2 +- okhttp/src/main/java/okhttp3/Authenticator.kt | 2 +- okhttp/src/main/java/okhttp3/Cache.kt | 6 ++-- okhttp/src/main/java/okhttp3/CacheControl.kt | 10 +++--- okhttp/src/main/java/okhttp3/Call.kt | 4 +-- .../main/java/okhttp3/CertificatePinner.kt | 12 +++---- .../src/main/java/okhttp3/ConnectionPool.kt | 6 ++-- .../src/main/java/okhttp3/ConnectionSpec.kt | 6 ++-- okhttp/src/main/java/okhttp3/Dispatcher.kt | 18 +++++----- okhttp/src/main/java/okhttp3/FormBody.kt | 2 +- okhttp/src/main/java/okhttp3/Headers.kt | 12 +++---- okhttp/src/main/java/okhttp3/OkHttpClient.kt | 4 +-- okhttp/src/main/java/okhttp3/RealCall.kt | 2 +- okhttp/src/main/java/okhttp3/internal/Util.kt | 10 +++--- .../internal/cache/CacheInterceptor.kt | 4 +-- .../okhttp3/internal/cache/CacheStrategy.kt | 6 ++-- .../okhttp3/internal/cache/DiskLruCache.kt | 34 +++++++++---------- .../internal/connection/ConnectInterceptor.kt | 2 +- .../internal/connection/ExchangeFinder.kt | 4 +-- .../internal/connection/RealConnection.kt | 8 ++--- .../internal/connection/RealConnectionPool.kt | 4 +-- .../internal/connection/RouteSelector.kt | 8 ++--- .../internal/connection/Transmitter.kt | 2 +- .../main/java/okhttp3/internal/hostnames.kt | 6 ++-- .../internal/http/BridgeInterceptor.kt | 2 +- .../internal/http/CallServerInterceptor.kt | 2 +- .../okhttp3/internal/http/ExchangeCode.kt | 14 ++++---- .../java/okhttp3/internal/http/HttpDate.kt | 8 ++--- .../java/okhttp3/internal/http/HttpHeaders.kt | 2 +- .../internal/http1/Http1ExchangeCodec.kt | 18 +++++----- .../main/java/okhttp3/internal/http2/Hpack.kt | 10 +++--- .../main/java/okhttp3/internal/http2/Http2.kt | 4 +-- .../okhttp3/internal/http2/Http2Connection.kt | 24 ++++++------- .../internal/http2/Http2ExchangeCodec.kt | 6 ++-- .../okhttp3/internal/http2/Http2Reader.kt | 4 +-- .../okhttp3/internal/http2/Http2Stream.kt | 22 ++++++------ .../okhttp3/internal/http2/Http2Writer.kt | 8 ++--- .../okhttp3/internal/http2/PushObserver.kt | 2 +- .../java/okhttp3/internal/http2/Settings.kt | 26 +++++++------- .../internal/http2/StreamResetException.kt | 2 +- .../java/okhttp3/internal/io/FileSystem.kt | 12 +++---- .../internal/platform/AndroidPlatform.kt | 2 +- .../platform/Jdk8WithJettyBootPlatform.kt | 8 ++--- .../okhttp3/internal/platform/Jdk9Platform.kt | 2 +- .../okhttp3/internal/platform/Platform.kt | 6 ++-- .../publicsuffix/PublicSuffixDatabase.kt | 6 ++-- .../tls/BasicCertificateChainCleaner.kt | 2 +- .../internal/tls/BasicTrustRootIndex.kt | 2 +- .../internal/tls/OkHostnameVerifier.kt | 4 +-- .../okhttp3/internal/tls/TrustRootIndex.kt | 2 +- .../java/okhttp3/internal/ws/RealWebSocket.kt | 22 ++++++------ .../okhttp3/internal/ws/WebSocketProtocol.kt | 22 ++++++------ .../okhttp3/internal/ws/WebSocketReader.kt | 2 +- .../okhttp3/internal/ws/WebSocketWriter.kt | 2 +- 65 files changed, 237 insertions(+), 237 deletions(-) diff --git a/mockwebserver/src/main/java/okhttp3/mockwebserver/Dispatcher.kt b/mockwebserver/src/main/java/okhttp3/mockwebserver/Dispatcher.kt index a780e70c7..5d2028344 100644 --- a/mockwebserver/src/main/java/okhttp3/mockwebserver/Dispatcher.kt +++ b/mockwebserver/src/main/java/okhttp3/mockwebserver/Dispatcher.kt @@ -15,7 +15,7 @@ */ package okhttp3.mockwebserver -/** Handler for mock server requests. */ +/** Handler for mock server requests. */ abstract class Dispatcher { /** * Returns a response to satisfy `request`. This method may block (for instance, to wait on diff --git a/mockwebserver/src/main/java/okhttp3/mockwebserver/MockResponse.kt b/mockwebserver/src/main/java/okhttp3/mockwebserver/MockResponse.kt index 3bb58a9b7..af815197c 100644 --- a/mockwebserver/src/main/java/okhttp3/mockwebserver/MockResponse.kt +++ b/mockwebserver/src/main/java/okhttp3/mockwebserver/MockResponse.kt @@ -23,7 +23,7 @@ import okhttp3.mockwebserver.internal.duplex.DuplexResponseBody import okio.Buffer import java.util.concurrent.TimeUnit -/** A scripted response to be replayed by the mock web server. */ +/** A scripted response to be replayed by the mock web server. */ class MockResponse : Cloneable { private var status: String = "" private var headers = Headers.Builder() @@ -55,11 +55,11 @@ class MockResponse : Cloneable { val isDuplex: Boolean get() = duplexResponseBody != null - /** Returns the streams the server will push with this response. */ + /** Returns the streams the server will push with this response. */ val pushPromises: List get() = promises - /** Creates a new mock response with an empty body. */ + /** Creates a new mock response with an empty body. */ init { setResponseCode(200) setHeader("Content-Length", 0L) @@ -72,7 +72,7 @@ class MockResponse : Cloneable { return result } - /** Returns the HTTP response line, such as "HTTP/1.1 200 OK". */ + /** Returns the HTTP response line, such as "HTTP/1.1 200 OK". */ fun getStatus(): String = status fun setResponseCode(code: Int): MockResponse { @@ -92,7 +92,7 @@ class MockResponse : Cloneable { return this } - /** Returns the HTTP headers, such as "Content-Length: 0". */ + /** Returns the HTTP headers, such as "Content-Length: 0". */ fun getHeaders(): Headers = headers.build() fun getTrailers(): Headers = trailers.build() @@ -142,25 +142,25 @@ class MockResponse : Cloneable { return addHeader(name, value) } - /** Replaces all headers with those specified. */ + /** Replaces all headers with those specified. */ fun setHeaders(headers: Headers): MockResponse { this.headers = headers.newBuilder() return this } - /** Replaces all trailers with those specified. */ + /** Replaces all trailers with those specified. */ fun setTrailers(trailers: Headers): MockResponse { this.trailers = trailers.newBuilder() return this } - /** Removes all headers named [name]. */ + /** Removes all headers named [name]. */ fun removeHeader(name: String): MockResponse { headers.removeAll(name) return this } - /** Returns a copy of the raw HTTP payload. */ + /** Returns a copy of the raw HTTP payload. */ fun getBody(): Buffer? { return body?.clone() } @@ -171,7 +171,7 @@ class MockResponse : Cloneable { return this } - /** Sets the response body to the UTF-8 encoded bytes of [body]. */ + /** Sets the response body to the UTF-8 encoded bytes of [body]. */ fun setBody(body: String): MockResponse { return setBody(Buffer().writeUtf8(body)) } diff --git a/mockwebserver/src/main/java/okhttp3/mockwebserver/MockWebServer.kt b/mockwebserver/src/main/java/okhttp3/mockwebserver/MockWebServer.kt index f102f802a..e11e694d2 100644 --- a/mockwebserver/src/main/java/okhttp3/mockwebserver/MockWebServer.kt +++ b/mockwebserver/src/main/java/okhttp3/mockwebserver/MockWebServer.kt @@ -836,7 +836,7 @@ class MockWebServer : ExternalResource(), Closeable { @Throws(IOException::class) override fun close() = shutdown() - /** A buffer wrapper that drops data after [bodyLimit] bytes. */ + /** A buffer wrapper that drops data after [bodyLimit] bytes. */ private class TruncatingBuffer internal constructor( private var remainingByteCount: Long ) : Sink { @@ -868,7 +868,7 @@ class MockWebServer : ExternalResource(), Closeable { } } - /** Processes HTTP requests layered over HTTP/2. */ + /** Processes HTTP requests layered over HTTP/2. */ private inner class Http2SocketHandler constructor( private val socket: Socket, private val protocol: Protocol diff --git a/mockwebserver/src/main/java/okhttp3/mockwebserver/PushPromise.kt b/mockwebserver/src/main/java/okhttp3/mockwebserver/PushPromise.kt index 56ef27de1..bb5741050 100644 --- a/mockwebserver/src/main/java/okhttp3/mockwebserver/PushPromise.kt +++ b/mockwebserver/src/main/java/okhttp3/mockwebserver/PushPromise.kt @@ -17,7 +17,7 @@ package okhttp3.mockwebserver import okhttp3.Headers -/** An HTTP request initiated by the server. */ +/** An HTTP request initiated by the server. */ class PushPromise( @get:JvmName("method") val method: String, @get:JvmName("path") val path: String, diff --git a/mockwebserver/src/main/java/okhttp3/mockwebserver/RecordedRequest.kt b/mockwebserver/src/main/java/okhttp3/mockwebserver/RecordedRequest.kt index e33b8e80f..086d018c5 100644 --- a/mockwebserver/src/main/java/okhttp3/mockwebserver/RecordedRequest.kt +++ b/mockwebserver/src/main/java/okhttp3/mockwebserver/RecordedRequest.kt @@ -28,7 +28,7 @@ import java.net.Inet6Address import java.net.Socket import javax.net.ssl.SSLSocket -/** An HTTP request that came into the mock web server. */ +/** An HTTP request that came into the mock web server. */ class RecordedRequest( val requestLine: String, /** All headers. */ @@ -62,7 +62,7 @@ class RecordedRequest( @Deprecated("Use {@link #getBody() getBody().readUtf8()}. ") get() = body.readUtf8() - /** Returns the connection's TLS version or null if the connection doesn't use SSL. */ + /** Returns the connection's TLS version or null if the connection doesn't use SSL. */ val tlsVersion: TlsVersion? get() = handshake?.tlsVersion @@ -105,7 +105,7 @@ class RecordedRequest( } } - /** Returns the first header named [name], or null if no such header exists. */ + /** Returns the first header named [name], or null if no such header exists. */ fun getHeader(name: String): String? { return headers.values(name).firstOrNull() } diff --git a/mockwebserver/src/main/java/okhttp3/mockwebserver/SocketPolicy.kt b/mockwebserver/src/main/java/okhttp3/mockwebserver/SocketPolicy.kt index 4807dcf22..60f26e5fd 100644 --- a/mockwebserver/src/main/java/okhttp3/mockwebserver/SocketPolicy.kt +++ b/mockwebserver/src/main/java/okhttp3/mockwebserver/SocketPolicy.kt @@ -69,13 +69,13 @@ enum class SocketPolicy { */ DISCONNECT_AFTER_REQUEST, - /** Close connection after reading half of the request body (if present). */ + /** Close connection after reading half of the request body (if present). */ DISCONNECT_DURING_REQUEST_BODY, - /** Close connection after writing half of the response body (if present). */ + /** Close connection after writing half of the response body (if present). */ DISCONNECT_DURING_RESPONSE_BODY, - /** Don't trust the client during the SSL handshake. */ + /** Don't trust the client during the SSL handshake. */ FAIL_HANDSHAKE, /** diff --git a/okhttp-dnsoverhttps/src/main/java/okhttp3/dnsoverhttps/package-info.kt b/okhttp-dnsoverhttps/src/main/java/okhttp3/dnsoverhttps/package-info.kt index f0f89d115..b998f5b89 100644 --- a/okhttp-dnsoverhttps/src/main/java/okhttp3/dnsoverhttps/package-info.kt +++ b/okhttp-dnsoverhttps/src/main/java/okhttp3/dnsoverhttps/package-info.kt @@ -1,2 +1,2 @@ -/** A DNS over HTTPS implementation for OkHttp. */ +/** A DNS over HTTPS implementation for OkHttp. */ package okhttp3.dnsoverhttps diff --git a/okhttp-logging-interceptor/src/main/java/okhttp3/logging/HttpLoggingInterceptor.kt b/okhttp-logging-interceptor/src/main/java/okhttp3/logging/HttpLoggingInterceptor.kt index a366f2334..4e607aa08 100644 --- a/okhttp-logging-interceptor/src/main/java/okhttp3/logging/HttpLoggingInterceptor.kt +++ b/okhttp-logging-interceptor/src/main/java/okhttp3/logging/HttpLoggingInterceptor.kt @@ -117,7 +117,7 @@ class HttpLoggingInterceptor @JvmOverloads constructor( override fun log(message: String) = block(message) } - /** A [Logger] defaults output appropriate for the current platform. */ + /** A [Logger] defaults output appropriate for the current platform. */ @JvmField val DEFAULT: Logger = object : Logger { override fun log(message: String) { diff --git a/okhttp-sse/src/main/java/okhttp3/sse/EventSource.kt b/okhttp-sse/src/main/java/okhttp3/sse/EventSource.kt index 93ac828aa..38174e1ab 100644 --- a/okhttp-sse/src/main/java/okhttp3/sse/EventSource.kt +++ b/okhttp-sse/src/main/java/okhttp3/sse/EventSource.kt @@ -18,7 +18,7 @@ package okhttp3.sse import okhttp3.Request interface EventSource { - /** Returns the original request that initiated this event source. */ + /** Returns the original request that initiated this event source. */ fun request(): Request /** diff --git a/okhttp-tls/src/main/java/okhttp3/tls/HeldCertificate.kt b/okhttp-tls/src/main/java/okhttp3/tls/HeldCertificate.kt index 460390c1a..07a30e624 100644 --- a/okhttp-tls/src/main/java/okhttp3/tls/HeldCertificate.kt +++ b/okhttp-tls/src/main/java/okhttp3/tls/HeldCertificate.kt @@ -170,7 +170,7 @@ class HeldCertificate(private val keyPair: KeyPair, private val certificate: X50 } } - /** Build a held certificate with reasonable defaults. */ + /** Build a held certificate with reasonable defaults. */ class Builder { private var notBefore = -1L private var notAfter = -1L diff --git a/okhttp-tls/src/main/java/okhttp3/tls/internal/TlsUtil.kt b/okhttp-tls/src/main/java/okhttp3/tls/internal/TlsUtil.kt index 32b41832f..44ac4da84 100644 --- a/okhttp-tls/src/main/java/okhttp3/tls/internal/TlsUtil.kt +++ b/okhttp-tls/src/main/java/okhttp3/tls/internal/TlsUtil.kt @@ -42,11 +42,11 @@ object TlsUtil { .build() } - /** Returns an SSL client for this host's localhost address. */ + /** Returns an SSL client for this host's localhost address. */ @JvmStatic fun localhost(): HandshakeCertificates = localhost - /** Returns a trust manager that trusts `trustedCertificates`. */ + /** Returns a trust manager that trusts `trustedCertificates`. */ @JvmStatic fun newTrustManager( keyStoreType: String?, diff --git a/okhttp-urlconnection/src/main/java/okhttp3/JavaNetCookieJar.kt b/okhttp-urlconnection/src/main/java/okhttp3/JavaNetCookieJar.kt index 4eb4fe8ee..3f35813ea 100644 --- a/okhttp-urlconnection/src/main/java/okhttp3/JavaNetCookieJar.kt +++ b/okhttp-urlconnection/src/main/java/okhttp3/JavaNetCookieJar.kt @@ -26,7 +26,7 @@ import java.net.HttpCookie import java.util.ArrayList import java.util.Collections -/** A cookie jar that delegates to a [java.net.CookieHandler]. */ +/** A cookie jar that delegates to a [java.net.CookieHandler]. */ class JavaNetCookieJar(private val cookieHandler: CookieHandler) : CookieJar { override fun saveFromResponse(url: HttpUrl, cookies: List) { diff --git a/okhttp/src/main/java/okhttp3/Authenticator.kt b/okhttp/src/main/java/okhttp3/Authenticator.kt index 835c01b34..e4a8369c4 100644 --- a/okhttp/src/main/java/okhttp3/Authenticator.kt +++ b/okhttp/src/main/java/okhttp3/Authenticator.kt @@ -108,7 +108,7 @@ interface Authenticator { fun authenticate(route: Route?, response: Response): Request? companion object { - /** An authenticator that knows no credentials and makes no attempt to authenticate. */ + /** An authenticator that knows no credentials and makes no attempt to authenticate. */ @JvmField val NONE = object : Authenticator { override fun authenticate(route: Route?, response: Response): Request? = null diff --git a/okhttp/src/main/java/okhttp3/Cache.kt b/okhttp/src/main/java/okhttp3/Cache.kt index c15c2c74a..675665f43 100644 --- a/okhttp/src/main/java/okhttp3/Cache.kt +++ b/okhttp/src/main/java/okhttp3/Cache.kt @@ -365,7 +365,7 @@ class Cache internal constructor( @Throws(IOException::class) fun size(): Long = cache.size() - /** Max size of the cache (in bytes). */ + /** Max size of the cache (in bytes). */ fun maxSize(): Long = cache.maxSize @Throws(IOException::class) @@ -673,10 +673,10 @@ class Cache internal constructor( } companion object { - /** Synthetic response header: the local time when the request was sent. */ + /** Synthetic response header: the local time when the request was sent. */ private val SENT_MILLIS = Platform.get().getPrefix() + "-Sent-Millis" - /** Synthetic response header: the local time when the response was received. */ + /** Synthetic response header: the local time when the response was received. */ private val RECEIVED_MILLIS = Platform.get().getPrefix() + "-Received-Millis" } } diff --git a/okhttp/src/main/java/okhttp3/CacheControl.kt b/okhttp/src/main/java/okhttp3/CacheControl.kt index 7a16baa33..27a9ddd6d 100644 --- a/okhttp/src/main/java/okhttp3/CacheControl.kt +++ b/okhttp/src/main/java/okhttp3/CacheControl.kt @@ -35,7 +35,7 @@ class CacheControl private constructor( */ @get:JvmName("noCache") val noCache: Boolean, - /** If true, this response should not be cached. */ + /** If true, this response should not be cached. */ @get:JvmName("noStore") val noStore: Boolean, /** The duration past the response's served date that it can be served without validation. */ @@ -164,7 +164,7 @@ class CacheControl private constructor( return result } - /** Builds a `Cache-Control` request header. */ + /** Builds a `Cache-Control` request header. */ class Builder { private var noCache: Boolean = false private var noStore: Boolean = false @@ -175,12 +175,12 @@ class CacheControl private constructor( private var noTransform: Boolean = false private var immutable: Boolean = false - /** Don't accept an unvalidated cached response. */ + /** Don't accept an unvalidated cached response. */ fun noCache() = apply { this.noCache = true } - /** Don't store the server's response in any cache. */ + /** Don't store the server's response in any cache. */ fun noStore() = apply { this.noStore = true } @@ -233,7 +233,7 @@ class CacheControl private constructor( this.onlyIfCached = true } - /** Don't accept a transformed response. */ + /** Don't accept a transformed response. */ fun noTransform() = apply { this.noTransform = true } diff --git a/okhttp/src/main/java/okhttp3/Call.kt b/okhttp/src/main/java/okhttp3/Call.kt index cc36ccef9..51a99130b 100644 --- a/okhttp/src/main/java/okhttp3/Call.kt +++ b/okhttp/src/main/java/okhttp3/Call.kt @@ -23,7 +23,7 @@ import java.io.IOException * represents a single request/response pair (stream), it cannot be executed twice. */ interface Call : Cloneable { - /** Returns the original request that initiated this call. */ + /** Returns the original request that initiated this call. */ fun request(): Request /** @@ -67,7 +67,7 @@ interface Call : Cloneable { */ fun enqueue(responseCallback: Callback) - /** Cancels the request, if possible. Requests that are already complete cannot be canceled. */ + /** Cancels the request, if possible. Requests that are already complete cannot be canceled. */ fun cancel() /** diff --git a/okhttp/src/main/java/okhttp3/CertificatePinner.kt b/okhttp/src/main/java/okhttp3/CertificatePinner.kt index a9bf84fe2..08498e538 100644 --- a/okhttp/src/main/java/okhttp3/CertificatePinner.kt +++ b/okhttp/src/main/java/okhttp3/CertificatePinner.kt @@ -213,7 +213,7 @@ data class CertificatePinner internal constructor( return result } - /** Returns a certificate pinner that uses `certificateChainCleaner`. */ + /** Returns a certificate pinner that uses `certificateChainCleaner`. */ internal fun withCertificateChainCleaner( certificateChainCleaner: CertificateChainCleaner? ): CertificatePinner { @@ -225,13 +225,13 @@ data class CertificatePinner internal constructor( } internal data class Pin( - /** A hostname like `example.com` or a pattern like `*.example.com`. */ + /** A hostname like `example.com` or a pattern like `*.example.com`. */ val pattern: String, - /** The canonical hostname, i.e. `EXAMPLE.com` becomes `example.com`. */ + /** The canonical hostname, i.e. `EXAMPLE.com` becomes `example.com`. */ private val canonicalHostname: String, - /** Either `sha1/` or `sha256/`. */ + /** Either `sha1/` or `sha256/`. */ val hashAlgorithm: String, - /** The hash of the pinned certificate using [hashAlgorithm]. */ + /** The hash of the pinned certificate using [hashAlgorithm]. */ val hash: ByteString ) { fun matches(hostname: String): Boolean { @@ -246,7 +246,7 @@ data class CertificatePinner internal constructor( override fun toString(): String = hashAlgorithm + hash.base64() } - /** Builds a configured certificate pinner. */ + /** Builds a configured certificate pinner. */ class Builder { private val pins = mutableListOf() diff --git a/okhttp/src/main/java/okhttp3/ConnectionPool.kt b/okhttp/src/main/java/okhttp3/ConnectionPool.kt index 0a85d8084..77de4dba5 100644 --- a/okhttp/src/main/java/okhttp3/ConnectionPool.kt +++ b/okhttp/src/main/java/okhttp3/ConnectionPool.kt @@ -40,13 +40,13 @@ class ConnectionPool( constructor() : this(5, 5, TimeUnit.MINUTES) - /** Returns the number of idle connections in the pool. */ + /** Returns the number of idle connections in the pool. */ fun idleConnectionCount(): Int = delegate.idleConnectionCount() - /** Returns total number of connections in the pool. */ + /** Returns total number of connections in the pool. */ fun connectionCount(): Int = delegate.connectionCount() - /** Close and remove all idle connections in the pool. */ + /** Close and remove all idle connections in the pool. */ fun evictAll() { delegate.evictAll() } diff --git a/okhttp/src/main/java/okhttp3/ConnectionSpec.kt b/okhttp/src/main/java/okhttp3/ConnectionSpec.kt index d154fca31..1dd132285 100644 --- a/okhttp/src/main/java/okhttp3/ConnectionSpec.kt +++ b/okhttp/src/main/java/okhttp3/ConnectionSpec.kt @@ -63,7 +63,7 @@ class ConnectionSpec internal constructor(builder: Builder) { fun supportsTlsExtensions(): Boolean = supportsTlsExtensions - /** Applies this spec to `sslSocket`. */ + /** Applies this spec to `sslSocket`. */ internal fun apply(sslSocket: SSLSocket, isFallback: Boolean) { val specToApply = supportedSpec(sslSocket, isFallback) @@ -280,7 +280,7 @@ class ConnectionSpec internal constructor(builder: Builder) { CipherSuite.TLS_RSA_WITH_AES_256_CBC_SHA, CipherSuite.TLS_RSA_WITH_3DES_EDE_CBC_SHA) - /** A secure TLS connection that requires a recent client platform and a recent server. */ + /** A secure TLS connection that requires a recent client platform and a recent server. */ @JvmField val RESTRICTED_TLS = Builder(true) .cipherSuites(*RESTRICTED_CIPHER_SUITES) @@ -311,7 +311,7 @@ class ConnectionSpec internal constructor(builder: Builder) { .supportsTlsExtensions(true) .build() - /** Unencrypted, unauthenticated connections for `http:` URLs. */ + /** Unencrypted, unauthenticated connections for `http:` URLs. */ @JvmField val CLEARTEXT = Builder(false).build() } diff --git a/okhttp/src/main/java/okhttp3/Dispatcher.kt b/okhttp/src/main/java/okhttp3/Dispatcher.kt index 8be9399af..f75cb417b 100644 --- a/okhttp/src/main/java/okhttp3/Dispatcher.kt +++ b/okhttp/src/main/java/okhttp3/Dispatcher.kt @@ -73,16 +73,16 @@ class Dispatcher constructor() { private var idleCallback: Runnable? = null - /** Executes calls. Created lazily. */ + /** Executes calls. Created lazily. */ private var executorService: ExecutorService? = null - /** Ready async calls in the order they'll be run. */ + /** Ready async calls in the order they'll be run. */ private val readyAsyncCalls = ArrayDeque() - /** Running asynchronous calls. Includes canceled calls that haven't finished yet. */ + /** Running asynchronous calls. Includes canceled calls that haven't finished yet. */ private val runningAsyncCalls = ArrayDeque() - /** Running synchronous calls. Includes canceled calls that haven't finished yet. */ + /** Running synchronous calls. Includes canceled calls that haven't finished yet. */ private val runningSyncCalls = ArrayDeque() constructor(executorService: ExecutorService) : this() { @@ -193,18 +193,18 @@ class Dispatcher constructor() { return isRunning } - /** Used by `Call#execute` to signal it is in-flight. */ + /** Used by `Call#execute` to signal it is in-flight. */ @Synchronized internal fun executed(call: RealCall) { runningSyncCalls.add(call) } - /** Used by `AsyncCall#run` to signal completion. */ + /** Used by `AsyncCall#run` to signal completion. */ internal fun finished(call: AsyncCall) { call.callsPerHost().decrementAndGet() finished(runningAsyncCalls, call) } - /** Used by `Call#execute` to signal completion. */ + /** Used by `Call#execute` to signal completion. */ internal fun finished(call: RealCall) { finished(runningSyncCalls, call) } @@ -223,12 +223,12 @@ class Dispatcher constructor() { } } - /** Returns a snapshot of the calls currently awaiting execution. */ + /** Returns a snapshot of the calls currently awaiting execution. */ @Synchronized fun queuedCalls(): List { return Collections.unmodifiableList(readyAsyncCalls.map { it.get() }) } - /** Returns a snapshot of the calls currently being executed. */ + /** Returns a snapshot of the calls currently being executed. */ @Synchronized fun runningCalls(): List { return Collections.unmodifiableList(runningSyncCalls + runningAsyncCalls.map { it.get() }) } diff --git a/okhttp/src/main/java/okhttp3/FormBody.kt b/okhttp/src/main/java/okhttp3/FormBody.kt index 885a01d09..943ad2b99 100644 --- a/okhttp/src/main/java/okhttp3/FormBody.kt +++ b/okhttp/src/main/java/okhttp3/FormBody.kt @@ -31,7 +31,7 @@ class FormBody internal constructor( private val encodedNames: List = encodedNames.toImmutableList() private val encodedValues: List = encodedValues.toImmutableList() - /** The number of key-value pairs in this form-encoded body. */ + /** The number of key-value pairs in this form-encoded body. */ @get:JvmName("size") val size: Int get() = encodedNames.size diff --git a/okhttp/src/main/java/okhttp3/Headers.kt b/okhttp/src/main/java/okhttp3/Headers.kt index 146e2d46e..0fe5f2e90 100644 --- a/okhttp/src/main/java/okhttp3/Headers.kt +++ b/okhttp/src/main/java/okhttp3/Headers.kt @@ -71,7 +71,7 @@ class Headers private constructor( return value?.toInstant() } - /** Returns the number of field values. */ + /** Returns the number of field values. */ @get:JvmName("size") val size: Int get() = namesAndValues.size / 2 @@ -82,13 +82,13 @@ class Headers private constructor( level = DeprecationLevel.WARNING) fun size(): Int = size - /** Returns the field at `position`. */ + /** Returns the field at `position`. */ fun name(index: Int): String = namesAndValues[index * 2] - /** Returns the value at `index`. */ + /** Returns the value at `index`. */ fun value(index: Int): String = namesAndValues[index * 2 + 1] - /** Returns an immutable case-insensitive set of header names. */ + /** Returns an immutable case-insensitive set of header names. */ fun names(): Set { val result = TreeSet(String.CASE_INSENSITIVE_ORDER) for (i in 0 until size) { @@ -97,7 +97,7 @@ class Headers private constructor( return Collections.unmodifiableSet(result) } - /** Returns an immutable list of the header values for `name`. */ + /** Returns an immutable list of the header values for `name`. */ fun values(name: String): List { var result: MutableList? = null for (i in 0 until size) { @@ -332,7 +332,7 @@ class Headers private constructor( addLenient(name, value) } - /** Equivalent to `build().get(name)`, but potentially faster. */ + /** Equivalent to `build().get(name)`, but potentially faster. */ operator fun get(name: String): String? { for (i in namesAndValues.size - 2 downTo 0 step 2) { if (name.equals(namesAndValues[i], ignoreCase = true)) { diff --git a/okhttp/src/main/java/okhttp3/OkHttpClient.kt b/okhttp/src/main/java/okhttp3/OkHttpClient.kt index d746b0d64..bdde82f04 100644 --- a/okhttp/src/main/java/okhttp3/OkHttpClient.kt +++ b/okhttp/src/main/java/okhttp3/OkHttpClient.kt @@ -242,7 +242,7 @@ open class OkHttpClient internal constructor( */ fun callTimeoutMillis(): Int = callTimeout - /** Default connect timeout (in milliseconds). The default is 10 seconds. */ + /** Default connect timeout (in milliseconds). The default is 10 seconds. */ fun connectTimeoutMillis(): Int = connectTimeout /** Default read timeout (in milliseconds). The default is 10 seconds. */ @@ -506,7 +506,7 @@ open class OkHttpClient internal constructor( this.cookieJar = cookieJar } - /** Sets the response cache to be used to read and write cached responses. */ + /** Sets the response cache to be used to read and write cached responses. */ fun cache(cache: Cache?) = apply { this.cache = cache this.internalCache = null diff --git a/okhttp/src/main/java/okhttp3/RealCall.kt b/okhttp/src/main/java/okhttp3/RealCall.kt index cb2e0af0d..41e24d09a 100644 --- a/okhttp/src/main/java/okhttp3/RealCall.kt +++ b/okhttp/src/main/java/okhttp3/RealCall.kt @@ -36,7 +36,7 @@ import java.util.concurrent.atomic.AtomicInteger internal class RealCall private constructor( val client: OkHttpClient, - /** The application's original request unadulterated by redirects or auth headers. */ + /** The application's original request unadulterated by redirects or auth headers. */ val originalRequest: Request, val forWebSocket: Boolean ) : Call { diff --git a/okhttp/src/main/java/okhttp3/internal/Util.kt b/okhttp/src/main/java/okhttp3/internal/Util.kt index 43b554baa..9f2f1efe7 100644 --- a/okhttp/src/main/java/okhttp3/internal/Util.kt +++ b/okhttp/src/main/java/okhttp3/internal/Util.kt @@ -50,7 +50,7 @@ val EMPTY_RESPONSE = ResponseBody.create(null, EMPTY_BYTE_ARRAY) @JvmField val EMPTY_REQUEST = RequestBody.create(null, EMPTY_BYTE_ARRAY) -/** Byte order marks. */ +/** Byte order marks. */ private val UNICODE_BOMS = Options.of( "efbbbf".decodeHex(), // UTF-8 "feff".decodeHex(), // UTF-16BE @@ -59,7 +59,7 @@ private val UNICODE_BOMS = Options.of( "ffff0000".decodeHex() // UTF-32LE ) -/** GMT and UTC are equivalent for our purposes. */ +/** GMT and UTC are equivalent for our purposes. */ @JvmField val UTC = TimeZone.getTimeZone("GMT")!! @@ -185,7 +185,7 @@ fun String.indexOfLastNonAsciiWhitespace(startIndex: Int = 0, endIndex: Int = le return startIndex } -/** Equivalent to `string.substring(startIndex, endIndex).trim()`. */ +/** Equivalent to `string.substring(startIndex, endIndex).trim()`. */ fun String.trimSubstring(startIndex: Int = 0, endIndex: Int = length): String { val start = indexOfFirstNonAsciiWhitespace(startIndex, endIndex) val end = indexOfLastNonAsciiWhitespace(start, endIndex) @@ -229,12 +229,12 @@ fun String.indexOfControlOrNonAscii(): Int { return -1 } -/** Returns true if [this] is not a host name and might be an IP address. */ +/** Returns true if [this] is not a host name and might be an IP address. */ fun String.canParseAsIpAddress(): Boolean { return VERIFY_AS_IP_ADDRESS.matches(this) } -/** Returns a [Locale.US] formatted [String]. */ +/** Returns a [Locale.US] formatted [String]. */ fun format(format: String, vararg args: Any): String { return String.format(Locale.US, format, *args) } diff --git a/okhttp/src/main/java/okhttp3/internal/cache/CacheInterceptor.kt b/okhttp/src/main/java/okhttp3/internal/cache/CacheInterceptor.kt index 149ce456a..95d17046c 100644 --- a/okhttp/src/main/java/okhttp3/internal/cache/CacheInterceptor.kt +++ b/okhttp/src/main/java/okhttp3/internal/cache/CacheInterceptor.kt @@ -37,7 +37,7 @@ import java.net.HttpURLConnection.HTTP_GATEWAY_TIMEOUT import java.net.HttpURLConnection.HTTP_NOT_MODIFIED import java.util.concurrent.TimeUnit.MILLISECONDS -/** Serves requests from the cache and writes responses to the cache. */ +/** Serves requests from the cache and writes responses to the cache. */ class CacheInterceptor(internal val cache: InternalCache?) : Interceptor { @Throws(IOException::class) @@ -209,7 +209,7 @@ class CacheInterceptor(internal val cache: InternalCache?) : Interceptor { } } - /** Combines cached headers with a network headers as defined by RFC 7234, 4.3.4. */ + /** Combines cached headers with a network headers as defined by RFC 7234, 4.3.4. */ private fun combine(cachedHeaders: Headers, networkHeaders: Headers): Headers { val result = Headers.Builder() diff --git a/okhttp/src/main/java/okhttp3/internal/cache/CacheStrategy.kt b/okhttp/src/main/java/okhttp3/internal/cache/CacheStrategy.kt index 290fa7a0a..90903e04a 100644 --- a/okhttp/src/main/java/okhttp3/internal/cache/CacheStrategy.kt +++ b/okhttp/src/main/java/okhttp3/internal/cache/CacheStrategy.kt @@ -44,9 +44,9 @@ import java.util.concurrent.TimeUnit.SECONDS * stale). */ class CacheStrategy internal constructor( - /** The request to send on the network, or null if this call doesn't use the network. */ + /** The request to send on the network, or null if this call doesn't use the network. */ val networkRequest: Request?, - /** The cached response to return or validate; or null if this call doesn't use a cache. */ + /** The cached response to return or validate; or null if this call doesn't use a cache. */ val cacheResponse: Response? ) { @@ -287,7 +287,7 @@ class CacheStrategy internal constructor( } companion object { - /** Returns true if `response` can be stored to later serve another request. */ + /** Returns true if `response` can be stored to later serve another request. */ fun isCacheable(response: Response, request: Request): Boolean { // Always go to network for uncacheable response codes (RFC 7231 section 6.1), This // implementation doesn't support caching partial content. diff --git a/okhttp/src/main/java/okhttp3/internal/cache/DiskLruCache.kt b/okhttp/src/main/java/okhttp3/internal/cache/DiskLruCache.kt index 8ee2cc5a5..af12f907c 100644 --- a/okhttp/src/main/java/okhttp3/internal/cache/DiskLruCache.kt +++ b/okhttp/src/main/java/okhttp3/internal/cache/DiskLruCache.kt @@ -80,7 +80,7 @@ import java.util.concurrent.TimeUnit class DiskLruCache internal constructor( internal val fileSystem: FileSystem, - /** Returns the directory where this cache stores its data. */ + /** Returns the directory where this cache stores its data. */ val directory: File, private val appVersion: Int, @@ -90,7 +90,7 @@ class DiskLruCache internal constructor( /** Returns the maximum number of bytes that this cache should use to store its data. */ maxSize: Long, - /** Used to run 'cleanupRunnable' for journal rebuilds. */ + /** Used to run 'cleanupRunnable' for journal rebuilds. */ private val executor: Executor ) : Closeable, Flushable { @@ -601,7 +601,7 @@ class DiskLruCache internal constructor( check(!closed) { "cache is closed" } } - /** Force buffered operations to the filesystem. */ + /** Force buffered operations to the filesystem. */ @Synchronized @Throws(IOException::class) override fun flush() { if (!initialized) return @@ -613,7 +613,7 @@ class DiskLruCache internal constructor( @Synchronized fun isClosed(): Boolean = closed - /** Closes this cache. Stored values will remain on the filesystem. */ + /** Closes this cache. Stored values will remain on the filesystem. */ @Synchronized @Throws(IOException::class) override fun close() { if (!initialized || closed) { @@ -688,13 +688,13 @@ class DiskLruCache internal constructor( fun snapshots(): MutableIterator { initialize() return object : MutableIterator { - /** Iterate a copy of the entries to defend against concurrent modification errors. */ + /** Iterate a copy of the entries to defend against concurrent modification errors. */ val delegate = ArrayList(lruEntries.values).iterator() - /** The snapshot to return from [next]. Null if we haven't computed that yet. */ + /** The snapshot to return from [next]. Null if we haven't computed that yet. */ var nextSnapshot: Snapshot? = null - /** The snapshot to remove with [remove]. Null if removal is illegal. */ + /** The snapshot to remove with [remove]. Null if removal is illegal. */ var removeSnapshot: Snapshot? = null override fun hasNext(): Boolean { @@ -738,7 +738,7 @@ class DiskLruCache internal constructor( } } - /** A snapshot of the values for an entry. */ + /** A snapshot of the values for an entry. */ inner class Snapshot internal constructor( private val key: String, private val sequenceNumber: Long, @@ -754,10 +754,10 @@ class DiskLruCache internal constructor( @Throws(IOException::class) fun edit(): Editor? = this@DiskLruCache.edit(key, sequenceNumber) - /** Returns the unbuffered stream with the value for `index`. */ + /** Returns the unbuffered stream with the value for `index`. */ fun getSource(index: Int): Source = sources[index] - /** Returns the byte length of the value for `index`. */ + /** Returns the byte length of the value for `index`. */ fun getLength(index: Int): Long = lengths[index] override fun close() { @@ -767,7 +767,7 @@ class DiskLruCache internal constructor( } } - /** Edits the values for an entry. */ + /** Edits the values for an entry. */ inner class Editor internal constructor(internal val entry: Entry) { internal val written: BooleanArray? = if (entry.readable) null else BooleanArray(valueCount) private var done: Boolean = false @@ -873,18 +873,18 @@ class DiskLruCache internal constructor( internal val key: String ) { - /** Lengths of this entry's files. */ + /** Lengths of this entry's files. */ internal val lengths: LongArray = LongArray(valueCount) internal val cleanFiles = mutableListOf() internal val dirtyFiles = mutableListOf() - /** True if this entry has ever been published. */ + /** True if this entry has ever been published. */ internal var readable: Boolean = false - /** The ongoing edit or null if this entry is not being edited. */ + /** The ongoing edit or null if this entry is not being edited. */ internal var currentEditor: Editor? = null - /** The sequence number of the most recently committed edit to this entry. */ + /** The sequence number of the most recently committed edit to this entry. */ internal var sequenceNumber: Long = 0 init { @@ -900,7 +900,7 @@ class DiskLruCache internal constructor( } } - /** Set lengths using decimal numbers like "10123". */ + /** Set lengths using decimal numbers like "10123". */ @Throws(IOException::class) internal fun setLengths(strings: List) { if (strings.size != valueCount) { @@ -916,7 +916,7 @@ class DiskLruCache internal constructor( } } - /** Append space-prefixed lengths to `writer`. */ + /** Append space-prefixed lengths to `writer`. */ @Throws(IOException::class) internal fun writeLengths(writer: BufferedSink) { for (length in lengths) { diff --git a/okhttp/src/main/java/okhttp3/internal/connection/ConnectInterceptor.kt b/okhttp/src/main/java/okhttp3/internal/connection/ConnectInterceptor.kt index 93a6b8ee3..7bd5b0d94 100644 --- a/okhttp/src/main/java/okhttp3/internal/connection/ConnectInterceptor.kt +++ b/okhttp/src/main/java/okhttp3/internal/connection/ConnectInterceptor.kt @@ -22,7 +22,7 @@ import okhttp3.OkHttpClient import okhttp3.Response import okhttp3.internal.http.RealInterceptorChain -/** Opens a connection to the target server and proceeds to the next interceptor. */ +/** Opens a connection to the target server and proceeds to the next interceptor. */ class ConnectInterceptor(val client: OkHttpClient) : Interceptor { @Throws(IOException::class) diff --git a/okhttp/src/main/java/okhttp3/internal/connection/ExchangeFinder.kt b/okhttp/src/main/java/okhttp3/internal/connection/ExchangeFinder.kt index 938fc0a1c..a2f2f473b 100644 --- a/okhttp/src/main/java/okhttp3/internal/connection/ExchangeFinder.kt +++ b/okhttp/src/main/java/okhttp3/internal/connection/ExchangeFinder.kt @@ -277,14 +277,14 @@ class ExchangeFinder( } } - /** Returns true if there is a failure that retrying might fix. */ + /** Returns true if there is a failure that retrying might fix. */ fun hasStreamFailure(): Boolean { synchronized(connectionPool) { return hasStreamFailure } } - /** Returns true if a current route is still good or if there are routes we haven't tried yet. */ + /** Returns true if a current route is still good or if there are routes we haven't tried yet. */ fun hasRouteToTry(): Boolean { synchronized(connectionPool) { if (nextRouteToTry != null) { diff --git a/okhttp/src/main/java/okhttp3/internal/connection/RealConnection.kt b/okhttp/src/main/java/okhttp3/internal/connection/RealConnection.kt index 095dc844f..203577219 100644 --- a/okhttp/src/main/java/okhttp3/internal/connection/RealConnection.kt +++ b/okhttp/src/main/java/okhttp3/internal/connection/RealConnection.kt @@ -74,7 +74,7 @@ class RealConnection( // The fields below are initialized by connect() and never reassigned. - /** The low-level TCP socket. */ + /** The low-level TCP socket. */ private var rawSocket: Socket? = null /** @@ -597,7 +597,7 @@ class RealConnection( override fun socket(): Socket = socket!! - /** Returns true if this connection is ready to host new streams. */ + /** Returns true if this connection is ready to host new streams. */ fun isHealthy(doExtensiveChecks: Boolean): Boolean { val socket = this.socket!! val source = this.source!! @@ -629,13 +629,13 @@ class RealConnection( return true } - /** Refuse incoming streams. */ + /** Refuse incoming streams. */ @Throws(IOException::class) override fun onStream(stream: Http2Stream) { stream.close(ErrorCode.REFUSED_STREAM, null) } - /** When settings are received, adjust the allocation limit. */ + /** When settings are received, adjust the allocation limit. */ override fun onSettings(connection: Http2Connection) { synchronized(connectionPool) { allocationLimit = connection.maxConcurrentStreams() diff --git a/okhttp/src/main/java/okhttp3/internal/connection/RealConnectionPool.kt b/okhttp/src/main/java/okhttp3/internal/connection/RealConnectionPool.kt index 3804c12b8..5fbafa66f 100644 --- a/okhttp/src/main/java/okhttp3/internal/connection/RealConnectionPool.kt +++ b/okhttp/src/main/java/okhttp3/internal/connection/RealConnectionPool.kt @@ -32,7 +32,7 @@ import java.util.concurrent.ThreadPoolExecutor import java.util.concurrent.TimeUnit class RealConnectionPool( - /** The maximum number of idle connections for each address. */ + /** The maximum number of idle connections for each address. */ private val maxIdleConnections: Int, keepAliveDuration: Long, timeUnit: TimeUnit @@ -234,7 +234,7 @@ class RealConnectionPool( return references.size } - /** Track a bad route in the route database. Other routes will be attempted first. */ + /** Track a bad route in the route database. Other routes will be attempted first. */ fun connectFailed(failedRoute: Route, failure: IOException) { // Tell the proxy selector when we fail to connect on a fresh connection. if (failedRoute.proxy().type() != Proxy.Type.DIRECT) { diff --git a/okhttp/src/main/java/okhttp3/internal/connection/RouteSelector.kt b/okhttp/src/main/java/okhttp3/internal/connection/RouteSelector.kt index 461a149b2..395951364 100644 --- a/okhttp/src/main/java/okhttp3/internal/connection/RouteSelector.kt +++ b/okhttp/src/main/java/okhttp3/internal/connection/RouteSelector.kt @@ -92,7 +92,7 @@ class RouteSelector( return Selection(routes) } - /** Prepares the proxy servers to try. */ + /** Prepares the proxy servers to try. */ private fun resetNextProxy(url: HttpUrl, proxy: Proxy?) { proxies = if (proxy != null) { // If the user specifies a proxy, try that and only that. @@ -109,10 +109,10 @@ class RouteSelector( nextProxyIndex = 0 } - /** Returns true if there's another proxy to try. */ + /** Returns true if there's another proxy to try. */ private fun hasNextProxy(): Boolean = nextProxyIndex < proxies.size - /** Returns the next proxy to try. May be PROXY.NO_PROXY but never null. */ + /** Returns the next proxy to try. May be PROXY.NO_PROXY but never null. */ @Throws(IOException::class) private fun nextProxy(): Proxy { if (!hasNextProxy()) { @@ -124,7 +124,7 @@ class RouteSelector( return result } - /** Prepares the socket addresses to attempt for the current proxy or host. */ + /** Prepares the socket addresses to attempt for the current proxy or host. */ @Throws(IOException::class) private fun resetNextInetSocketAddress(proxy: Proxy) { // Clear the addresses. Necessary if getAllByName() below throws! diff --git a/okhttp/src/main/java/okhttp3/internal/connection/Transmitter.kt b/okhttp/src/main/java/okhttp3/internal/connection/Transmitter.kt index 560b43218..0a024e1b8 100644 --- a/okhttp/src/main/java/okhttp3/internal/connection/Transmitter.kt +++ b/okhttp/src/main/java/okhttp3/internal/connection/Transmitter.kt @@ -149,7 +149,7 @@ class Transmitter( client.proxy(), client.protocols(), client.connectionSpecs(), client.proxySelector()) } - /** Returns a new exchange to carry a new request and response. */ + /** Returns a new exchange to carry a new request and response. */ internal fun newExchange(chain: Interceptor.Chain, doExtensiveHealthChecks: Boolean): Exchange { synchronized(connectionPool) { check(!noMoreExchanges) { "released" } diff --git a/okhttp/src/main/java/okhttp3/internal/hostnames.kt b/okhttp/src/main/java/okhttp3/internal/hostnames.kt index 1f96e8f0b..37f15cda0 100644 --- a/okhttp/src/main/java/okhttp3/internal/hostnames.kt +++ b/okhttp/src/main/java/okhttp3/internal/hostnames.kt @@ -80,7 +80,7 @@ private fun String.containsInvalidHostnameAsciiCodes(): Boolean { return false } -/** Decodes an IPv6 address like 1111:2222:3333:4444:5555:6666:7777:8888 or ::1. */ +/** Decodes an IPv6 address like 1111:2222:3333:4444:5555:6666:7777:8888 or ::1. */ private fun decodeIpv6(input: String, pos: Int, limit: Int): InetAddress? { val address = ByteArray(16) var b = 0 @@ -149,7 +149,7 @@ private fun decodeIpv6(input: String, pos: Int, limit: Int): InetAddress? { return InetAddress.getByAddress(address) } -/** Decodes an IPv4 address suffix of an IPv6 address, like 1111::5555:6666:192.168.0.1. */ +/** Decodes an IPv4 address suffix of an IPv6 address, like 1111::5555:6666:192.168.0.1. */ private fun decodeIpv4Suffix( input: String, pos: Int, @@ -191,7 +191,7 @@ private fun decodeIpv4Suffix( return b == addressOffset + 4 } -/** Encodes an IPv6 address in canonical form according to RFC 5952. */ +/** Encodes an IPv6 address in canonical form according to RFC 5952. */ private fun inet6AddressToAscii(address: ByteArray): String { // Go through the address looking for the longest run of 0s. Each group is 2-bytes. // A run must be longer than one group (section 4.2.2). diff --git a/okhttp/src/main/java/okhttp3/internal/http/BridgeInterceptor.kt b/okhttp/src/main/java/okhttp3/internal/http/BridgeInterceptor.kt index 932a3a591..df3a1dadd 100644 --- a/okhttp/src/main/java/okhttp3/internal/http/BridgeInterceptor.kt +++ b/okhttp/src/main/java/okhttp3/internal/http/BridgeInterceptor.kt @@ -107,7 +107,7 @@ class BridgeInterceptor(private val cookieJar: CookieJar) : Interceptor { return responseBuilder.build() } - /** Returns a 'Cookie' HTTP request header with all cookies, like `a=b; c=d`. */ + /** Returns a 'Cookie' HTTP request header with all cookies, like `a=b; c=d`. */ private fun cookieHeader(cookies: List): String = buildString { cookies.forEachIndexed { index, cookie -> if (index > 0) append("; ") diff --git a/okhttp/src/main/java/okhttp3/internal/http/CallServerInterceptor.kt b/okhttp/src/main/java/okhttp3/internal/http/CallServerInterceptor.kt index af1e6e67c..fe1caba39 100644 --- a/okhttp/src/main/java/okhttp3/internal/http/CallServerInterceptor.kt +++ b/okhttp/src/main/java/okhttp3/internal/http/CallServerInterceptor.kt @@ -22,7 +22,7 @@ import okio.buffer import java.io.IOException import java.net.ProtocolException -/** This is the last interceptor in the chain. It makes a network call to the server. */ +/** This is the last interceptor in the chain. It makes a network call to the server. */ class CallServerInterceptor(private val forWebSocket: Boolean) : Interceptor { @Throws(IOException::class) diff --git a/okhttp/src/main/java/okhttp3/internal/http/ExchangeCode.kt b/okhttp/src/main/java/okhttp3/internal/http/ExchangeCode.kt index b0c3e2e77..30bca16e8 100644 --- a/okhttp/src/main/java/okhttp3/internal/http/ExchangeCode.kt +++ b/okhttp/src/main/java/okhttp3/internal/http/ExchangeCode.kt @@ -23,25 +23,25 @@ import okhttp3.internal.connection.RealConnection import okio.Sink import okio.Source -/** Encodes HTTP requests and decodes HTTP responses. */ +/** Encodes HTTP requests and decodes HTTP responses. */ interface ExchangeCodec { - /** Returns the connection that carries this codec. */ + /** Returns the connection that carries this codec. */ fun connection(): RealConnection? - /** Returns an output stream where the request body can be streamed. */ + /** Returns an output stream where the request body can be streamed. */ @Throws(IOException::class) fun createRequestBody(request: Request, contentLength: Long): Sink - /** This should update the HTTP engine's sentRequestMillis field. */ + /** This should update the HTTP engine's sentRequestMillis field. */ @Throws(IOException::class) fun writeRequestHeaders(request: Request) - /** Flush the request to the underlying socket. */ + /** Flush the request to the underlying socket. */ @Throws(IOException::class) fun flushRequest() - /** Flush the request to the underlying socket and signal no more bytes will be transmitted. */ + /** Flush the request to the underlying socket and signal no more bytes will be transmitted. */ @Throws(IOException::class) fun finishRequest() @@ -60,7 +60,7 @@ interface ExchangeCodec { @Throws(IOException::class) fun openResponseBodySource(response: Response): Source - /** Returns the trailers after the HTTP response. May be empty. */ + /** Returns the trailers after the HTTP response. May be empty. */ @Throws(IOException::class) fun trailers(): Headers diff --git a/okhttp/src/main/java/okhttp3/internal/http/HttpDate.kt b/okhttp/src/main/java/okhttp3/internal/http/HttpDate.kt index 940026e03..f360e49b2 100644 --- a/okhttp/src/main/java/okhttp3/internal/http/HttpDate.kt +++ b/okhttp/src/main/java/okhttp3/internal/http/HttpDate.kt @@ -26,7 +26,7 @@ import java.util.Locale * Best-effort parser for HTTP dates. */ object HttpDate { - /** The last four-digit year: "Fri, 31 Dec 9999 23:59:59 GMT". */ + /** The last four-digit year: "Fri, 31 Dec 9999 23:59:59 GMT". */ const val MAX_DATE = 253402300799999L /** @@ -43,7 +43,7 @@ object HttpDate { } } - /** If we fail to parse a date in a non-standard format, try each of these formats in sequence. */ + /** If we fail to parse a date in a non-standard format, try each of these formats in sequence. */ private val BROWSER_COMPATIBLE_DATE_FORMAT_STRINGS = arrayOf( // HTTP formats required by RFC2616 but with any timezone. "EEE, dd MMM yyyy HH:mm:ss zzz", // RFC 822, updated by RFC 1123 with any TZ @@ -68,7 +68,7 @@ object HttpDate { private val BROWSER_COMPATIBLE_DATE_FORMATS = arrayOfNulls(BROWSER_COMPATIBLE_DATE_FORMAT_STRINGS.size) - /** Returns the date for [value]. Returns null if the value couldn't be parsed. */ + /** Returns the date for [value]. Returns null if the value couldn't be parsed. */ fun parse(value: String): Date? { if (value.isEmpty()) { return null @@ -107,7 +107,7 @@ object HttpDate { return null } - /** Returns the string for [value]. */ + /** Returns the string for [value]. */ fun format(value: Date): String { return STANDARD_DATE_FORMAT.get().format(value) } diff --git a/okhttp/src/main/java/okhttp3/internal/http/HttpHeaders.kt b/okhttp/src/main/java/okhttp3/internal/http/HttpHeaders.kt index 42af11b12..b15f8ed44 100644 --- a/okhttp/src/main/java/okhttp3/internal/http/HttpHeaders.kt +++ b/okhttp/src/main/java/okhttp3/internal/http/HttpHeaders.kt @@ -131,7 +131,7 @@ private fun Buffer.readChallengeHeader(result: MutableList) { } } -/** Returns true if any commas were skipped. */ +/** Returns true if any commas were skipped. */ private fun Buffer.skipCommasAndWhitespace(): Boolean { var commaFound = false loop@ while (!exhausted()) { diff --git a/okhttp/src/main/java/okhttp3/internal/http1/Http1ExchangeCodec.kt b/okhttp/src/main/java/okhttp3/internal/http1/Http1ExchangeCodec.kt index 6d3125fe3..6c1ad9f10 100644 --- a/okhttp/src/main/java/okhttp3/internal/http1/Http1ExchangeCodec.kt +++ b/okhttp/src/main/java/okhttp3/internal/http1/Http1ExchangeCodec.kt @@ -63,9 +63,9 @@ import java.util.concurrent.TimeUnit.MILLISECONDS * [newFixedLengthSource(0)][newFixedLengthSource] and may skip reading and closing that source. */ class Http1ExchangeCodec( - /** The client that configures this stream. May be null for HTTPS proxy tunnels. */ + /** The client that configures this stream. May be null for HTTPS proxy tunnels. */ private val client: OkHttpClient?, - /** The connection that carries this stream. */ + /** The connection that carries this stream. */ private val realConnection: RealConnection?, private val source: BufferedSource, private val sink: BufferedSink @@ -85,7 +85,7 @@ class Http1ExchangeCodec( */ private var trailers: Headers? = null - /** Returns true if this connection is closed. */ + /** Returns true if this connection is closed. */ val isClosed: Boolean get() = state == STATE_CLOSED @@ -159,7 +159,7 @@ class Http1ExchangeCodec( sink.flush() } - /** Returns bytes of a request header for sending on an HTTP transport. */ + /** Returns bytes of a request header for sending on an HTTP transport. */ fun writeRequest(headers: Headers, requestLine: String) { check(state == STATE_IDLE) { "state: $state" } sink.writeUtf8(requestLine).writeUtf8("\r\n") @@ -213,7 +213,7 @@ class Http1ExchangeCodec( return line } - /** Reads headers or trailers. */ + /** Reads headers or trailers. */ private fun readHeaders(): Headers { val headers = Headers.Builder() // parse the result headers until the first blank line @@ -280,7 +280,7 @@ class Http1ExchangeCodec( body.close() } - /** An HTTP request body. */ + /** An HTTP request body. */ private inner class KnownLengthSink : Sink { private val timeout = ForwardingTimeout(sink.timeout()) private var closed: Boolean = false @@ -372,7 +372,7 @@ class Http1ExchangeCodec( } } - /** An HTTP body with a fixed length specified in advance. */ + /** An HTTP body with a fixed length specified in advance. */ private inner class FixedLengthSource internal constructor(private var bytesRemaining: Long) : AbstractSource() { @@ -415,7 +415,7 @@ class Http1ExchangeCodec( } } - /** An HTTP body with alternating chunk sizes and chunk bodies. */ + /** An HTTP body with alternating chunk sizes and chunk bodies. */ private inner class ChunkedSource internal constructor(private val url: HttpUrl) : AbstractSource() { private var bytesRemainingInChunk = NO_CHUNK_YET @@ -477,7 +477,7 @@ class Http1ExchangeCodec( } } - /** An HTTP message body terminated by the end of the underlying stream. */ + /** An HTTP message body terminated by the end of the underlying stream. */ private inner class UnknownLengthSource : AbstractSource() { private var inputExhausted: Boolean = false diff --git a/okhttp/src/main/java/okhttp3/internal/http2/Hpack.kt b/okhttp/src/main/java/okhttp3/internal/http2/Hpack.kt index 0126ef358..c56a2156f 100644 --- a/okhttp/src/main/java/okhttp3/internal/http2/Hpack.kt +++ b/okhttp/src/main/java/okhttp3/internal/http2/Hpack.kt @@ -161,7 +161,7 @@ object Hpack { dynamicTableByteCount = 0 } - /** Returns the count of entries evicted. */ + /** Returns the count of entries evicted. */ private fun evictToRecoverBytes(bytesToRecover: Int): Int { var bytesToRecover = bytesToRecover var entriesToEvict = 0 @@ -296,7 +296,7 @@ object Hpack { return index >= 0 && index <= STATIC_HEADER_TABLE.size - 1 } - /** index == -1 when new. */ + /** index == -1 when new. */ private fun insertIntoDynamicTable(index: Int, entry: Header) { var index = index headerList.add(entry) @@ -361,7 +361,7 @@ object Hpack { return result } - /** Reads a potentially Huffman encoded byte string. */ + /** Reads a potentially Huffman encoded byte string. */ @Throws(IOException::class) fun readByteString(): ByteString { val firstByte = readByte() @@ -415,7 +415,7 @@ object Hpack { dynamicTableByteCount = 0 } - /** Returns the count of entries evicted. */ + /** Returns the count of entries evicted. */ private fun evictToRecoverBytes(bytesToRecover: Int): Int { var bytesToRecover = bytesToRecover var entriesToEvict = 0 @@ -462,7 +462,7 @@ object Hpack { dynamicTableByteCount += delta } - /** This does not use "never indexed" semantics for sensitive headers. */ + /** This does not use "never indexed" semantics for sensitive headers. */ // http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-12#section-6.2.3 @Throws(IOException::class) fun writeHeaders(headerBlock: List
) { diff --git a/okhttp/src/main/java/okhttp3/internal/http2/Http2.kt b/okhttp/src/main/java/okhttp3/internal/http2/Http2.kt index 3e33f6959..941d167eb 100644 --- a/okhttp/src/main/java/okhttp3/internal/http2/Http2.kt +++ b/okhttp/src/main/java/okhttp3/internal/http2/Http2.kt @@ -22,7 +22,7 @@ object Http2 { @JvmField val CONNECTION_PREFACE = "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n".encodeUtf8() - /** The initial max frame size, applied independently writing to, or reading from the peer. */ + /** The initial max frame size, applied independently writing to, or reading from the peer. */ const val INITIAL_MAX_FRAME_SIZE = 0x4000 // 16384 const val TYPE_DATA = 0x0 @@ -45,7 +45,7 @@ object Http2 { const val FLAG_PRIORITY = 0x20 // Used for headers. const val FLAG_COMPRESSED = 0x20 // Used for data. - /** Lookup table for valid frame types. */ + /** Lookup table for valid frame types. */ private val FRAME_NAMES = arrayOf( "DATA", "HEADERS", "PRIORITY", "RST_STREAM", "SETTINGS", "PUSH_PROMISE", "PING", "GOAWAY", "WINDOW_UPDATE", "CONTINUATION" diff --git a/okhttp/src/main/java/okhttp3/internal/http2/Http2Connection.kt b/okhttp/src/main/java/okhttp3/internal/http2/Http2Connection.kt index 890b159ca..7ac013a7b 100644 --- a/okhttp/src/main/java/okhttp3/internal/http2/Http2Connection.kt +++ b/okhttp/src/main/java/okhttp3/internal/http2/Http2Connection.kt @@ -69,7 +69,7 @@ class Http2Connection internal constructor(builder: Builder) : Closeable { // blocking I/O) and this (to create streams). Such operations must synchronize on 'this' last. // This ensures that we never wait for a blocking operation while holding 'this'. - /** True if this peer initiated the connection. */ + /** True if this peer initiated the connection. */ internal val client: Boolean = builder.client /** @@ -87,22 +87,22 @@ class Http2Connection internal constructor(builder: Builder) : Closeable { @get:Synchronized var isShutdown = false internal set - /** Asynchronously writes frames to the outgoing socket. */ + /** Asynchronously writes frames to the outgoing socket. */ private val writerExecutor = ScheduledThreadPoolExecutor(1, threadFactory(format("OkHttp %s Writer", connectionName), false)) - /** Ensures push promise callbacks events are sent in order per stream. */ + /** Ensures push promise callbacks events are sent in order per stream. */ // Like newSingleThreadExecutor, except lazy creates the thread. private val pushExecutor = ThreadPoolExecutor(0, 1, 60L, TimeUnit.SECONDS, LinkedBlockingQueue(), threadFactory(format("OkHttp %s Push Observer", connectionName), true)) - /** User code to run in response to push promise events. */ + /** User code to run in response to push promise events. */ private val pushObserver: PushObserver = builder.pushObserver - /** True if we have sent a ping that is still awaiting a reply. */ + /** True if we have sent a ping that is still awaiting a reply. */ private var awaitingPong = false - /** Settings we communicate to the peer. */ + /** Settings we communicate to the peer. */ val okHttpSettings = Settings().apply { // Flow control was designed more for servers, or proxies than edge clients. If we are a client, // set the flow control window to 16MiB. This avoids thrashing window updates every 64KiB, yet @@ -112,7 +112,7 @@ class Http2Connection internal constructor(builder: Builder) : Closeable { } } - /** Settings we receive from the peer. */ + /** Settings we receive from the peer. */ // TODO: MWS will need to guard on this setting before attempting to push. val peerSettings = Settings().apply { set(Settings.INITIAL_WINDOW_SIZE, DEFAULT_INITIAL_WINDOW_SIZE) @@ -376,14 +376,14 @@ class Http2Connection internal constructor(builder: Builder) : Closeable { } } - /** For testing: sends a ping and waits for a pong. */ + /** For testing: sends a ping and waits for a pong. */ @Throws(InterruptedException::class) fun writePingAndAwaitPong() { writePing(false, 0x4f4b6f6b /* "OKok" */, -0xf607257 /* donut */) awaitPong() } - /** For testing: waits until `requiredPongCount` pings have been received from the peer. */ + /** For testing: waits until `requiredPongCount` pings have been received from the peer. */ @Synchronized @Throws(InterruptedException::class) fun awaitPong() { while (awaitingPong) { @@ -489,7 +489,7 @@ class Http2Connection internal constructor(builder: Builder) : Closeable { Thread(readerRunnable, "OkHttp $connectionName").start() // Not a daemon thread. } - /** Merges [settings] into this peer's settings and sends them to the remote peer. */ + /** Merges [settings] into this peer's settings and sends them to the remote peer. */ @Throws(IOException::class) fun setSettings(settings: Settings) { synchronized(writer) { @@ -785,7 +785,7 @@ class Http2Connection internal constructor(builder: Builder) : Closeable { } } - /** Even, positive numbered streams are pushed streams in HTTP/2. */ + /** Even, positive numbered streams are pushed streams in HTTP/2. */ internal fun pushedStream(streamId: Int): Boolean = streamId != 0 && streamId and 1 == 0 internal fun pushRequestLater(streamId: Int, requestHeaders: List
) { @@ -871,7 +871,7 @@ class Http2Connection internal constructor(builder: Builder) : Closeable { } } - /** Listener of streams and settings initiated by the peer. */ + /** Listener of streams and settings initiated by the peer. */ abstract class Listener { /** * Handle a new stream from this connection's peer. Implementations should respond by either diff --git a/okhttp/src/main/java/okhttp3/internal/http2/Http2ExchangeCodec.kt b/okhttp/src/main/java/okhttp3/internal/http2/Http2ExchangeCodec.kt index 51538a6da..79e220361 100644 --- a/okhttp/src/main/java/okhttp3/internal/http2/Http2ExchangeCodec.kt +++ b/okhttp/src/main/java/okhttp3/internal/http2/Http2ExchangeCodec.kt @@ -46,7 +46,7 @@ import java.util.ArrayList import java.util.Locale import java.util.concurrent.TimeUnit -/** Encode requests and responses using HTTP/2 frames. */ +/** Encode requests and responses using HTTP/2 frames. */ class Http2ExchangeCodec( client: OkHttpClient, private val realConnection: RealConnection, @@ -133,7 +133,7 @@ class Http2ExchangeCodec( private const val ENCODING = "encoding" private const val UPGRADE = "upgrade" - /** See http://tools.ietf.org/html/draft-ietf-httpbis-http2-09#section-8.1.3. */ + /** See http://tools.ietf.org/html/draft-ietf-httpbis-http2-09#section-8.1.3. */ private val HTTP_2_SKIPPED_REQUEST_HEADERS = immutableListOf( CONNECTION, HOST, @@ -179,7 +179,7 @@ class Http2ExchangeCodec( return result } - /** Returns headers for a name value block containing an HTTP/2 response. */ + /** Returns headers for a name value block containing an HTTP/2 response. */ fun readHttp2HeadersList(headerBlock: Headers, protocol: Protocol): Response.Builder { var statusLine: StatusLine? = null val headersBuilder = Headers.Builder() diff --git a/okhttp/src/main/java/okhttp3/internal/http2/Http2Reader.kt b/okhttp/src/main/java/okhttp3/internal/http2/Http2Reader.kt index 2f53a1079..cb7ee5735 100644 --- a/okhttp/src/main/java/okhttp3/internal/http2/Http2Reader.kt +++ b/okhttp/src/main/java/okhttp3/internal/http2/Http2Reader.kt @@ -55,7 +55,7 @@ import java.util.logging.Logger * peer. Hence, we expect all frames to have a max length of [Http2.INITIAL_MAX_FRAME_SIZE]. */ class Http2Reader( - /** Creates a frame reader with max header table size of 4096. */ + /** Creates a frame reader with max header table size of 4096. */ private val source: BufferedSource, private val client: Boolean ) : Closeable { @@ -389,7 +389,7 @@ class Http2Reader( fun settings(clearPrevious: Boolean, settings: Settings) - /** HTTP/2 only. */ + /** HTTP/2 only. */ fun ackSettings() /** diff --git a/okhttp/src/main/java/okhttp3/internal/http2/Http2Stream.kt b/okhttp/src/main/java/okhttp3/internal/http2/Http2Stream.kt index dfb1bce4a..805f519e5 100644 --- a/okhttp/src/main/java/okhttp3/internal/http2/Http2Stream.kt +++ b/okhttp/src/main/java/okhttp3/internal/http2/Http2Stream.kt @@ -31,7 +31,7 @@ import java.io.InterruptedIOException import java.net.SocketTimeoutException import java.util.ArrayDeque -/** A logical bidirectional stream. */ +/** A logical bidirectional stream. */ class Http2Stream internal constructor( val id: Int, val connection: Http2Connection, @@ -61,7 +61,7 @@ class Http2Stream internal constructor( /** Received headers yet to be [taken][takeHeaders], or [read][FramingSource.read]. */ private val headersQueue = ArrayDeque() - /** True if response headers have been sent or received. */ + /** True if response headers have been sent or received. */ private var hasResponseHeaders: Boolean = false internal val source = FramingSource( @@ -117,7 +117,7 @@ class Http2Stream internal constructor( return true } - /** Returns true if this stream was created by this peer. */ + /** Returns true if this stream was created by this peer. */ val isLocallyInitiated: Boolean get() { val streamIsClient = (id and 1) == 1 @@ -206,7 +206,7 @@ class Http2Stream internal constructor( fun writeTimeout(): Timeout = writeTimeout - /** Returns a source that reads data from the peer. */ + /** Returns a source that reads data from the peer. */ fun getSource(): Source = source /** @@ -246,7 +246,7 @@ class Http2Stream internal constructor( connection.writeSynResetLater(id, errorCode) } - /** Returns true if this stream was closed. */ + /** Returns true if this stream was closed. */ private fun closeInternal(errorCode: ErrorCode, errorException: IOException?): Boolean { assert(!Thread.holdsLock(this)) synchronized(this) { @@ -308,7 +308,7 @@ class Http2Stream internal constructor( * readers. */ inner class FramingSource internal constructor( - /** Maximum number of bytes to buffer before reporting a flow control error. */ + /** Maximum number of bytes to buffer before reporting a flow control error. */ private val maxByteCount: Long, /** @@ -317,10 +317,10 @@ class Http2Stream internal constructor( */ internal var finished: Boolean ) : Source { - /** Buffer to receive data from the network into. Only accessed by the reader thread. */ + /** Buffer to receive data from the network into. Only accessed by the reader thread. */ val receiveBuffer = Buffer() - /** Buffer with readable data. Guarded by Http2Stream.this. */ + /** Buffer with readable data. Guarded by Http2Stream.this. */ val readBuffer = Buffer() /** @@ -329,7 +329,7 @@ class Http2Stream internal constructor( */ var trailers: Headers? = null - /** True if the caller has closed this stream. */ + /** True if the caller has closed this stream. */ internal var closed: Boolean = false @Throws(IOException::class) @@ -483,7 +483,7 @@ class Http2Stream internal constructor( } } - /** A sink that writes outgoing data frames of a stream. This class is not thread safe. */ + /** A sink that writes outgoing data frames of a stream. This class is not thread safe. */ internal inner class FramingSink( /** True if either side has cleanly shut down this stream. We shall send no more bytes. */ var finished: Boolean = false @@ -495,7 +495,7 @@ class Http2Stream internal constructor( */ private val sendBuffer = Buffer() - /** Trailers to send at the end of the stream. */ + /** Trailers to send at the end of the stream. */ var trailers: Headers? = null var closed: Boolean = false diff --git a/okhttp/src/main/java/okhttp3/internal/http2/Http2Writer.kt b/okhttp/src/main/java/okhttp3/internal/http2/Http2Writer.kt index ce71e02b1..1b636e986 100644 --- a/okhttp/src/main/java/okhttp3/internal/http2/Http2Writer.kt +++ b/okhttp/src/main/java/okhttp3/internal/http2/Http2Writer.kt @@ -40,7 +40,7 @@ import java.io.IOException import java.util.logging.Level.FINE import java.util.logging.Logger -/** Writes HTTP/2 transport frames. */ +/** Writes HTTP/2 transport frames. */ class Http2Writer( private val sink: BufferedSink, private val client: Boolean @@ -61,7 +61,7 @@ class Http2Writer( sink.flush() } - /** Applies `peerSettings` and then sends a settings ACK. */ + /** Applies `peerSettings` and then sends a settings ACK. */ @Synchronized @Throws(IOException::class) fun applyAndAckSettings(peerSettings: Settings) { if (closed) throw IOException("closed") @@ -134,7 +134,7 @@ class Http2Writer( sink.flush() } - /** The maximum size of bytes that may be sent in a single call to [data]. */ + /** The maximum size of bytes that may be sent in a single call to [data]. */ fun maxDataLength(): Int = maxFrameSize /** @@ -165,7 +165,7 @@ class Http2Writer( } } - /** Write okhttp's settings to the peer. */ + /** Write okhttp's settings to the peer. */ @Synchronized @Throws(IOException::class) fun settings(settings: Settings) { if (closed) throw IOException("closed") diff --git a/okhttp/src/main/java/okhttp3/internal/http2/PushObserver.kt b/okhttp/src/main/java/okhttp3/internal/http2/PushObserver.kt index ff7cff275..c4b5f6438 100644 --- a/okhttp/src/main/java/okhttp3/internal/http2/PushObserver.kt +++ b/okhttp/src/main/java/okhttp3/internal/http2/PushObserver.kt @@ -68,7 +68,7 @@ interface PushObserver { @Throws(IOException::class) fun onData(streamId: Int, source: BufferedSource, byteCount: Int, last: Boolean): Boolean - /** Indicates the reason why this stream was canceled. */ + /** Indicates the reason why this stream was canceled. */ fun onReset(streamId: Int, errorCode: ErrorCode) companion object { diff --git a/okhttp/src/main/java/okhttp3/internal/http2/Settings.kt b/okhttp/src/main/java/okhttp3/internal/http2/Settings.kt index b60ab386b..91315d357 100644 --- a/okhttp/src/main/java/okhttp3/internal/http2/Settings.kt +++ b/okhttp/src/main/java/okhttp3/internal/http2/Settings.kt @@ -21,13 +21,13 @@ package okhttp3.internal.http2 */ class Settings { - /** Bitfield of which flags that values. */ + /** Bitfield of which flags that values. */ private var set: Int = 0 - /** Flag values. */ + /** Flag values. */ private val values = IntArray(COUNT) - /** Returns -1 if unset. */ + /** Returns -1 if unset. */ val headerTableSize: Int get() { val bit = 1 shl HEADER_TABLE_SIZE @@ -56,16 +56,16 @@ class Settings { return this } - /** Returns true if a value has been assigned for the setting `id`. */ + /** Returns true if a value has been assigned for the setting `id`. */ fun isSet(id: Int): Boolean { val bit = 1 shl id return set and bit != 0 } - /** Returns the value for the setting `id`, or 0 if unset. */ + /** Returns the value for the setting `id`, or 0 if unset. */ operator fun get(id: Int): Int = values[id] - /** Returns the number of settings that have values assigned. */ + /** Returns the number of settings that have values assigned. */ fun size(): Int = Integer.bitCount(set) // TODO: honor this setting. @@ -107,20 +107,20 @@ class Settings { */ const val DEFAULT_INITIAL_WINDOW_SIZE = 65535 - /** HTTP/2: Size in bytes of the table used to decode the sender's header blocks. */ + /** HTTP/2: Size in bytes of the table used to decode the sender's header blocks. */ const val HEADER_TABLE_SIZE = 1 - /** HTTP/2: The peer must not send a PUSH_PROMISE frame when this is 0. */ + /** HTTP/2: The peer must not send a PUSH_PROMISE frame when this is 0. */ const val ENABLE_PUSH = 2 - /** Sender's maximum number of concurrent streams. */ + /** Sender's maximum number of concurrent streams. */ const val MAX_CONCURRENT_STREAMS = 4 - /** HTTP/2: Size in bytes of the largest frame payload the sender will accept. */ + /** HTTP/2: Size in bytes of the largest frame payload the sender will accept. */ const val MAX_FRAME_SIZE = 5 - /** HTTP/2: Advisory only. Size in bytes of the largest header list the sender will accept. */ + /** HTTP/2: Advisory only. Size in bytes of the largest header list the sender will accept. */ const val MAX_HEADER_LIST_SIZE = 6 - /** Window size in bytes. */ + /** Window size in bytes. */ const val INITIAL_WINDOW_SIZE = 7 - /** Total number of settings. */ + /** Total number of settings. */ const val COUNT = 10 } } diff --git a/okhttp/src/main/java/okhttp3/internal/http2/StreamResetException.kt b/okhttp/src/main/java/okhttp3/internal/http2/StreamResetException.kt index 814c2add0..54ae7d8c0 100644 --- a/okhttp/src/main/java/okhttp3/internal/http2/StreamResetException.kt +++ b/okhttp/src/main/java/okhttp3/internal/http2/StreamResetException.kt @@ -17,5 +17,5 @@ package okhttp3.internal.http2 import java.io.IOException -/** Thrown when an HTTP/2 stream is canceled without damage to the socket that carries it. */ +/** Thrown when an HTTP/2 stream is canceled without damage to the socket that carries it. */ class StreamResetException(@JvmField val errorCode: ErrorCode) : IOException("stream was reset: $errorCode") diff --git a/okhttp/src/main/java/okhttp3/internal/io/FileSystem.kt b/okhttp/src/main/java/okhttp3/internal/io/FileSystem.kt index c888f9404..f97ab68ea 100644 --- a/okhttp/src/main/java/okhttp3/internal/io/FileSystem.kt +++ b/okhttp/src/main/java/okhttp3/internal/io/FileSystem.kt @@ -42,7 +42,7 @@ import java.io.IOException interface FileSystem { companion object { - /** The host machine's local file system. */ + /** The host machine's local file system. */ @JvmField val SYSTEM: FileSystem = object : FileSystem { @Throws(FileNotFoundException::class) @@ -105,7 +105,7 @@ interface FileSystem { } } - /** Reads from [file]. */ + /** Reads from [file]. */ @Throws(FileNotFoundException::class) fun source(file: File): Source @@ -123,17 +123,17 @@ interface FileSystem { @Throws(FileNotFoundException::class) fun appendingSink(file: File): Sink - /** Deletes [file] if it exists. Throws if the file exists and cannot be deleted. */ + /** Deletes [file] if it exists. Throws if the file exists and cannot be deleted. */ @Throws(IOException::class) fun delete(file: File) - /** Returns true if [file] exists on the file system. */ + /** Returns true if [file] exists on the file system. */ fun exists(file: File): Boolean - /** Returns the number of bytes stored in [file], or 0 if it does not exist. */ + /** Returns the number of bytes stored in [file], or 0 if it does not exist. */ fun size(file: File): Long - /** Renames [from] to [to]. Throws if the file cannot be renamed. */ + /** Renames [from] to [to]. Throws if the file cannot be renamed. */ @Throws(IOException::class) fun rename(from: File, to: File) diff --git a/okhttp/src/main/java/okhttp3/internal/platform/AndroidPlatform.kt b/okhttp/src/main/java/okhttp3/internal/platform/AndroidPlatform.kt index 38184aef8..88463202b 100644 --- a/okhttp/src/main/java/okhttp3/internal/platform/AndroidPlatform.kt +++ b/okhttp/src/main/java/okhttp3/internal/platform/AndroidPlatform.kt @@ -37,7 +37,7 @@ import javax.net.ssl.SSLSocket import javax.net.ssl.SSLSocketFactory import javax.net.ssl.X509TrustManager -/** Android 5+. */ +/** Android 5+. */ class AndroidPlatform( private val sslParametersClass: Class<*>, private val sslSocketClass: Class<*>, diff --git a/okhttp/src/main/java/okhttp3/internal/platform/Jdk8WithJettyBootPlatform.kt b/okhttp/src/main/java/okhttp3/internal/platform/Jdk8WithJettyBootPlatform.kt index c5ac89a0d..b022127ee 100644 --- a/okhttp/src/main/java/okhttp3/internal/platform/Jdk8WithJettyBootPlatform.kt +++ b/okhttp/src/main/java/okhttp3/internal/platform/Jdk8WithJettyBootPlatform.kt @@ -22,7 +22,7 @@ import java.lang.reflect.Method import java.lang.reflect.Proxy import javax.net.ssl.SSLSocket -/** OpenJDK 8 with `org.mortbay.jetty.alpn:alpn-boot` in the boot class path. */ +/** OpenJDK 8 with `org.mortbay.jetty.alpn:alpn-boot` in the boot class path. */ class Jdk8WithJettyBootPlatform( private val putMethod: Method, private val getMethod: Method, @@ -80,12 +80,12 @@ class Jdk8WithJettyBootPlatform( * dependency on those interfaces. */ private class AlpnProvider internal constructor( - /** This peer's supported protocols. */ + /** This peer's supported protocols. */ private val protocols: List ) : InvocationHandler { - /** Set when remote peer notifies ALPN is unsupported. */ + /** Set when remote peer notifies ALPN is unsupported. */ internal var unsupported: Boolean = false - /** The protocol the server selected. */ + /** The protocol the server selected. */ internal var selected: String? = null @Throws(Throwable::class) diff --git a/okhttp/src/main/java/okhttp3/internal/platform/Jdk9Platform.kt b/okhttp/src/main/java/okhttp3/internal/platform/Jdk9Platform.kt index 49987fa19..f372ed69f 100644 --- a/okhttp/src/main/java/okhttp3/internal/platform/Jdk9Platform.kt +++ b/okhttp/src/main/java/okhttp3/internal/platform/Jdk9Platform.kt @@ -23,7 +23,7 @@ import javax.net.ssl.SSLSocketFactory import javax.net.ssl.X509TrustManager import okhttp3.Protocol -/** OpenJDK 9+. */ +/** OpenJDK 9+. */ class Jdk9Platform( @JvmField val setProtocolMethod: Method, @JvmField val getProtocolMethod: Method diff --git a/okhttp/src/main/java/okhttp3/internal/platform/Platform.kt b/okhttp/src/main/java/okhttp3/internal/platform/Platform.kt index 1aec23db8..3f5b100f3 100644 --- a/okhttp/src/main/java/okhttp3/internal/platform/Platform.kt +++ b/okhttp/src/main/java/okhttp3/internal/platform/Platform.kt @@ -73,7 +73,7 @@ import javax.net.ssl.X509TrustManager */ open class Platform { - /** Prefix used on custom headers. */ + /** Prefix used on custom headers. */ fun getPrefix() = "OkHttp" open fun newSSLContext(): SSLContext = SSLContext.getInstance("TLS") @@ -118,7 +118,7 @@ open class Platform { open fun afterHandshake(sslSocket: SSLSocket) { } - /** Returns the negotiated protocol, or null if no protocol was negotiated. */ + /** Returns the negotiated protocol, or null if no protocol was negotiated. */ open fun getSelectedProtocol(socket: SSLSocket): String? = null @Throws(IOException::class) @@ -199,7 +199,7 @@ open class Platform { return "Conscrypt" == preferredProvider } - /** Attempt to match the host runtime to a capable Platform implementation. */ + /** Attempt to match the host runtime to a capable Platform implementation. */ private fun findPlatform(): Platform { val android = AndroidPlatform.buildIfSupported() diff --git a/okhttp/src/main/java/okhttp3/internal/publicsuffix/PublicSuffixDatabase.kt b/okhttp/src/main/java/okhttp3/internal/publicsuffix/PublicSuffixDatabase.kt index a8ed671dc..902106606 100644 --- a/okhttp/src/main/java/okhttp3/internal/publicsuffix/PublicSuffixDatabase.kt +++ b/okhttp/src/main/java/okhttp3/internal/publicsuffix/PublicSuffixDatabase.kt @@ -34,10 +34,10 @@ import java.util.concurrent.atomic.AtomicBoolean */ class PublicSuffixDatabase { - /** True after we've attempted to read the list for the first time. */ + /** True after we've attempted to read the list for the first time. */ private val listRead = AtomicBoolean(false) - /** Used for concurrent threads reading the list for the first time. */ + /** Used for concurrent threads reading the list for the first time. */ private val readCompleteLatch = CountDownLatch(1) // The lists are held as a large array of UTF-8 bytes. This is to avoid allocating lots of strings @@ -213,7 +213,7 @@ class PublicSuffixDatabase { readCompleteLatch.countDown() } - /** Visible for testing. */ + /** Visible for testing. */ fun setListBytes( publicSuffixListBytes: ByteArray, publicSuffixExceptionListBytes: ByteArray diff --git a/okhttp/src/main/java/okhttp3/internal/tls/BasicCertificateChainCleaner.kt b/okhttp/src/main/java/okhttp3/internal/tls/BasicCertificateChainCleaner.kt index 3ebe3551f..c0d432c19 100644 --- a/okhttp/src/main/java/okhttp3/internal/tls/BasicCertificateChainCleaner.kt +++ b/okhttp/src/main/java/okhttp3/internal/tls/BasicCertificateChainCleaner.kt @@ -93,7 +93,7 @@ class BasicCertificateChainCleaner( throw SSLPeerUnverifiedException("Certificate chain too long: $result") } - /** Returns true if [toVerify] was signed by [signingCert]'s public key. */ + /** Returns true if [toVerify] was signed by [signingCert]'s public key. */ private fun verifySignature(toVerify: X509Certificate, signingCert: X509Certificate): Boolean { if (toVerify.issuerDN != signingCert.subjectDN) { return false diff --git a/okhttp/src/main/java/okhttp3/internal/tls/BasicTrustRootIndex.kt b/okhttp/src/main/java/okhttp3/internal/tls/BasicTrustRootIndex.kt index 2b93613b8..4730e78d4 100644 --- a/okhttp/src/main/java/okhttp3/internal/tls/BasicTrustRootIndex.kt +++ b/okhttp/src/main/java/okhttp3/internal/tls/BasicTrustRootIndex.kt @@ -18,7 +18,7 @@ package okhttp3.internal.tls import java.security.cert.X509Certificate import javax.security.auth.x500.X500Principal -/** A simple index that of trusted root certificates that have been loaded into memory. */ +/** A simple index that of trusted root certificates that have been loaded into memory. */ class BasicTrustRootIndex(vararg caCerts: X509Certificate) : TrustRootIndex { private val subjectToCaCerts: Map> diff --git a/okhttp/src/main/java/okhttp3/internal/tls/OkHostnameVerifier.kt b/okhttp/src/main/java/okhttp3/internal/tls/OkHostnameVerifier.kt index f5d857f13..7d824937c 100644 --- a/okhttp/src/main/java/okhttp3/internal/tls/OkHostnameVerifier.kt +++ b/okhttp/src/main/java/okhttp3/internal/tls/OkHostnameVerifier.kt @@ -48,14 +48,14 @@ object OkHostnameVerifier : HostnameVerifier { } } - /** Returns true if `certificate` matches `ipAddress`. */ + /** Returns true if `certificate` matches `ipAddress`. */ private fun verifyIpAddress(ipAddress: String, certificate: X509Certificate): Boolean { return getSubjectAltNames(certificate, ALT_IPA_NAME).any { ipAddress.equals(it, ignoreCase = true) } } - /** Returns true if `certificate` matches `hostname`. */ + /** Returns true if `certificate` matches `hostname`. */ private fun verifyHostname(hostname: String, certificate: X509Certificate): Boolean { val hostname = hostname.toLowerCase(Locale.US) return getSubjectAltNames(certificate, ALT_DNS_NAME).any { diff --git a/okhttp/src/main/java/okhttp3/internal/tls/TrustRootIndex.kt b/okhttp/src/main/java/okhttp3/internal/tls/TrustRootIndex.kt index 3586029bb..8331d2cf4 100644 --- a/okhttp/src/main/java/okhttp3/internal/tls/TrustRootIndex.kt +++ b/okhttp/src/main/java/okhttp3/internal/tls/TrustRootIndex.kt @@ -18,6 +18,6 @@ package okhttp3.internal.tls import java.security.cert.X509Certificate interface TrustRootIndex { - /** Returns the trusted CA certificate that signed [cert]. */ + /** Returns the trusted CA certificate that signed [cert]. */ fun findByIssuerAndSignature(cert: X509Certificate): X509Certificate? } diff --git a/okhttp/src/main/java/okhttp3/internal/ws/RealWebSocket.kt b/okhttp/src/main/java/okhttp3/internal/ws/RealWebSocket.kt index 55b0c6ca5..5730485b3 100644 --- a/okhttp/src/main/java/okhttp3/internal/ws/RealWebSocket.kt +++ b/okhttp/src/main/java/okhttp3/internal/ws/RealWebSocket.kt @@ -84,16 +84,16 @@ class RealWebSocket( */ private var streams: Streams? = null - /** Outgoing pongs in the order they should be written. */ + /** Outgoing pongs in the order they should be written. */ private val pongQueue = ArrayDeque() - /** Outgoing messages and close frames in the order they should be written. */ + /** Outgoing messages and close frames in the order they should be written. */ private val messageAndCloseQueue = ArrayDeque() - /** The total size in bytes of enqueued but not yet transmitted messages. */ + /** The total size in bytes of enqueued but not yet transmitted messages. */ private var queueSize = 0L - /** True if we've enqueued a close frame. No further message frames will be enqueued. */ + /** True if we've enqueued a close frame. No further message frames will be enqueued. */ private var enqueuedClose = false /** @@ -102,25 +102,25 @@ class RealWebSocket( */ private var cancelFuture: ScheduledFuture<*>? = null - /** The close code from the peer, or -1 if this web socket has not yet read a close frame. */ + /** The close code from the peer, or -1 if this web socket has not yet read a close frame. */ private var receivedCloseCode = -1 - /** The close reason from the peer, or null if this web socket has not yet read a close frame. */ + /** The close reason from the peer, or null if this web socket has not yet read a close frame. */ private var receivedCloseReason: String? = null - /** True if this web socket failed and the listener has been notified. */ + /** True if this web socket failed and the listener has been notified. */ private var failed = false - /** Total number of pings sent by this web socket. */ + /** Total number of pings sent by this web socket. */ private var sentPingCount = 0 - /** Total number of pings received by this web socket. */ + /** Total number of pings received by this web socket. */ private var receivedPingCount = 0 - /** Total number of pongs received by this web socket. */ + /** Total number of pongs received by this web socket. */ private var receivedPongCount = 0 - /** True if we have sent a ping that is still awaiting a reply. */ + /** True if we have sent a ping that is still awaiting a reply. */ private var awaitingPong = false init { diff --git a/okhttp/src/main/java/okhttp3/internal/ws/WebSocketProtocol.kt b/okhttp/src/main/java/okhttp3/internal/ws/WebSocketProtocol.kt index 171c44e44..5da8abcc5 100644 --- a/okhttp/src/main/java/okhttp3/internal/ws/WebSocketProtocol.kt +++ b/okhttp/src/main/java/okhttp3/internal/ws/WebSocketProtocol.kt @@ -19,7 +19,7 @@ import okio.Buffer import okio.ByteString.Companion.encodeUtf8 object WebSocketProtocol { - /** Magic value which must be appended to the key in a response header. */ + /** Magic value which must be appended to the key in a response header. */ internal const val ACCEPT_MAGIC = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11" /* @@ -34,17 +34,17 @@ object WebSocketProtocol { +-+-+-+-+-------+ +-+-------------+ */ - /** Byte 0 flag for whether this is the final fragment in a message. */ + /** Byte 0 flag for whether this is the final fragment in a message. */ internal const val B0_FLAG_FIN = 128 - /** Byte 0 reserved flag 1. Must be 0 unless negotiated otherwise. */ + /** Byte 0 reserved flag 1. Must be 0 unless negotiated otherwise. */ internal const val B0_FLAG_RSV1 = 64 - /** Byte 0 reserved flag 2. Must be 0 unless negotiated otherwise. */ + /** Byte 0 reserved flag 2. Must be 0 unless negotiated otherwise. */ internal const val B0_FLAG_RSV2 = 32 - /** Byte 0 reserved flag 3. Must be 0 unless negotiated otherwise. */ + /** Byte 0 reserved flag 3. Must be 0 unless negotiated otherwise. */ internal const val B0_FLAG_RSV3 = 16 - /** Byte 0 mask for the frame opcode. */ + /** Byte 0 mask for the frame opcode. */ internal const val B0_MASK_OPCODE = 15 - /** Flag in the opcode which indicates a control frame. */ + /** Flag in the opcode which indicates a control frame. */ internal const val OPCODE_FLAG_CONTROL = 8 /** @@ -76,13 +76,13 @@ object WebSocketProtocol { * special values [PAYLOAD_SHORT] or [PAYLOAD_LONG]. */ internal const val PAYLOAD_BYTE_MAX = 125L - /** Maximum length of close message in bytes. */ + /** Maximum length of close message in bytes. */ internal const val CLOSE_MESSAGE_MAX = PAYLOAD_BYTE_MAX - 2 /** * Value for [B1_MASK_LENGTH] which indicates the next two bytes are the unsigned length. */ internal const val PAYLOAD_SHORT = 126 - /** Maximum length of a frame payload to be denoted as [PAYLOAD_SHORT]. */ + /** Maximum length of a frame payload to be denoted as [PAYLOAD_SHORT]. */ internal const val PAYLOAD_SHORT_MAX = 0xffffL /** * Value for [B1_MASK_LENGTH] which indicates the next eight bytes are the unsigned @@ -90,9 +90,9 @@ object WebSocketProtocol { */ internal const val PAYLOAD_LONG = 127 - /** Used when an unchecked exception was thrown in a listener. */ + /** Used when an unchecked exception was thrown in a listener. */ internal const val CLOSE_CLIENT_GOING_AWAY = 1001 - /** Used when an empty close frame was received (i.e., without a status code). */ + /** Used when an empty close frame was received (i.e., without a status code). */ internal const val CLOSE_NO_STATUS_CODE = 1005 fun toggleMask(cursor: Buffer.UnsafeCursor, key: ByteArray) { diff --git a/okhttp/src/main/java/okhttp3/internal/ws/WebSocketReader.kt b/okhttp/src/main/java/okhttp3/internal/ws/WebSocketReader.kt index 629eaa684..17abe3dcd 100644 --- a/okhttp/src/main/java/okhttp3/internal/ws/WebSocketReader.kt +++ b/okhttp/src/main/java/okhttp3/internal/ws/WebSocketReader.kt @@ -223,7 +223,7 @@ internal class WebSocketReader( } } - /** Read headers and process any control frames until we reach a non-control frame. */ + /** Read headers and process any control frames until we reach a non-control frame. */ @Throws(IOException::class) private fun readUntilNonControlFrame() { while (!closed) { diff --git a/okhttp/src/main/java/okhttp3/internal/ws/WebSocketWriter.kt b/okhttp/src/main/java/okhttp3/internal/ws/WebSocketWriter.kt index 5b908367e..60d88210d 100644 --- a/okhttp/src/main/java/okhttp3/internal/ws/WebSocketWriter.kt +++ b/okhttp/src/main/java/okhttp3/internal/ws/WebSocketWriter.kt @@ -48,7 +48,7 @@ internal class WebSocketWriter( val random: Random ) { - /** The [Buffer] of [sink]. Write to this and then flush/emit [sink]. */ + /** The [Buffer] of [sink]. Write to this and then flush/emit [sink]. */ private val sinkBuffer: Buffer = sink.buffer private var writerClosed = false