代理视频的异常捕获
This commit is contained in:
parent
565c92ce63
commit
26d525f436
|
|
@ -11,7 +11,7 @@ import kotlinx.coroutines.runBlocking
|
||||||
|
|
||||||
|
|
||||||
object ProxyServer {
|
object ProxyServer {
|
||||||
private val THREAD_NUM = Runtime.getRuntime().availableProcessors()
|
private val THREAD_NUM = Runtime.getRuntime().availableProcessors()
|
||||||
private val partSize = 1024 * 1024 * 2
|
private val partSize = 1024 * 1024 * 2
|
||||||
private var port = 12345
|
private var port = 12345
|
||||||
private var httpServer: AdvancedHttpServer? = null
|
private var httpServer: AdvancedHttpServer? = null
|
||||||
|
|
@ -37,15 +37,20 @@ object ProxyServer {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
httpServer?.addRoutes("/proxy") { req, response ->
|
httpServer?.addRoutes("/proxy") { req, response ->
|
||||||
run {
|
try {
|
||||||
val key = req.queryParams["key"];
|
run {
|
||||||
val url = urlMap[key]
|
val key = req.queryParams["key"];
|
||||||
val header = headerMap[key]
|
val url = urlMap[key]
|
||||||
|
val header = headerMap[key]
|
||||||
|
|
||||||
if (url != null && header != null) {
|
if (url != null && header != null) {
|
||||||
proxyAsync(url, header, req, response)
|
proxyAsync(url, header, req, response)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
SpiderDebug.log("代理视频出错:" + e.message)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
httpServer?.start()
|
httpServer?.start()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue