url参数支持ua为"null",访问时会删除ua

pull/2605/head
kunfei 2 years ago
parent 3199897c05
commit 181209ad59
  1. 4
      app/src/main/java/io/legado/app/help/http/HttpHelper.kt

@ -62,6 +62,8 @@ val okHttpClient: OkHttpClient by lazy {
val builder = request.newBuilder()
if (request.header(AppConst.UA_NAME) == null) {
builder.addHeader(AppConst.UA_NAME, AppConfig.userAgent)
} else if (request.header(AppConst.UA_NAME) == "null") {
builder.removeHeader(AppConst.UA_NAME)
}
builder.addHeader("Keep-Alive", "300")
builder.addHeader("Connection", "Keep-Alive")
@ -96,7 +98,7 @@ fun getProxyClient(proxy: String? = null): OkHttpClient {
username = group.groupValues[4].split("@")[1]
password = group.groupValues[4].split("@")[2]
}
if (type != "direct" && host != "") {
if (host != "") {
val builder = okHttpClient.newBuilder()
if (type == "http") {
builder.proxy(Proxy(Proxy.Type.HTTP, InetSocketAddress(host, port)))

Loading…
Cancel
Save