mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-05-01 06:03:18 +01:00
committed by
Greyson Parrelli
parent
9824cc2cbe
commit
8ba57a2733
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user