Upgrade OkHttp to 4.12.

Addresses #13491
This commit is contained in:
Nicholas Tinsley
2024-06-17 17:51:19 -04:00
committed by Greyson Parrelli
parent 9824cc2cbe
commit 8ba57a2733
11 changed files with 68 additions and 62 deletions

View File

@@ -1,8 +1,8 @@
package org.whispersystems.signalservice.internal.push.http
import okhttp3.MediaType
import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.RequestBody
import okhttp3.internal.http.UnrepeatableRequestBody
import okio.BufferedSink
import org.signal.libsignal.protocol.incrementalmac.ChunkSizeChoice
import org.signal.libsignal.protocol.logging.Log
@@ -26,7 +26,7 @@ class DigestingRequestBody(
private val progressListener: SignalServiceAttachment.ProgressListener?,
private val cancelationSignal: CancelationSignal?,
private val contentStart: Long
) : RequestBody(), UnrepeatableRequestBody {
) : RequestBody() {
var attachmentDigest: AttachmentDigest? = null
init {
@@ -35,7 +35,7 @@ class DigestingRequestBody(
}
override fun contentType(): MediaType? {
return MediaType.parse(contentType)
return contentType.toMediaTypeOrNull()
}
@Throws(IOException::class)
@@ -85,6 +85,10 @@ class DigestingRequestBody(
return if (contentLength > 0) contentLength - contentStart else -1
}
override fun isOneShot(): Boolean {
return true
}
private fun logMessage(actual: Long, expected: Long): String {
val difference = actual - expected
return if (difference > 0) {