mirror of
https://github.com/gedoor/legado.git
synced 2024-08-30 09:23:26 +08:00
url参数支持ua为"null",访问时会删除ua
This commit is contained in:
parent
3199897c05
commit
181209ad59
@ -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…
Reference in New Issue
Block a user