From 3fb3a0e02424e83d8cb4610b318cc36a162489de Mon Sep 17 00:00:00 2001 From: kunfei Date: Mon, 23 Sep 2019 11:48:54 +0800 Subject: [PATCH] up --- .../java/io/legado/app/lib/webdav/WebDav.kt | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/io/legado/app/lib/webdav/WebDav.kt b/app/src/main/java/io/legado/app/lib/webdav/WebDav.kt index d7aa3c137..904c143db 100644 --- a/app/src/main/java/io/legado/app/lib/webdav/WebDav.kt +++ b/app/src/main/java/io/legado/app/lib/webdav/WebDav.kt @@ -1,10 +1,10 @@ package io.legado.app.lib.webdav -import io.legado.app.help.http.HttpHelper import io.legado.app.lib.webdav.http.Handler import io.legado.app.lib.webdav.http.HttpAuth import okhttp3.Credentials import okhttp3.MediaType.Companion.toMediaTypeOrNull +import okhttp3.OkHttpClient import okhttp3.Request import okhttp3.RequestBody.Companion.asRequestBody import okhttp3.RequestBody.Companion.toRequestBody @@ -21,7 +21,19 @@ import java.util.* class WebDav @Throws(MalformedURLException::class) constructor(urlStr: String) { - private val okHttpClient = HttpHelper.client + companion object { + private val okHttpClient by lazy { + OkHttpClient.Builder().build() + } + // 指定返回哪些属性 + private const val DIR = """\n + \n + \n + \n\n\n\n\n%s + \n + """ + + } private val url: URL = URL(null, urlStr, Handler) private var httpUrl: String? = null @@ -257,15 +269,4 @@ constructor(urlStr: String) { this.exists = exists } - companion object { - - // 指定返回哪些属性 - private const val DIR = """\n - \n - \n - \n\n\n\n\n%s - \n - """ - - } } \ No newline at end of file