httpserver
This commit is contained in:
parent
9e61895f05
commit
226f41d386
|
|
@ -37,9 +37,13 @@ object ProxyServer {
|
||||||
};
|
};
|
||||||
httpServer?.addRoutes("/proxy") { req, response ->
|
httpServer?.addRoutes("/proxy") { req, response ->
|
||||||
run {
|
run {
|
||||||
val url = Util.base64Decode(req.queryParams["url"])
|
var url = req.queryParams["url"];
|
||||||
|
val headers = req.queryParams["headers"];
|
||||||
|
SpiderDebug.log("url: $url")
|
||||||
|
SpiderDebug.log("headers: $headers")
|
||||||
|
url = Util.base64Decode(url)
|
||||||
val header: Map<String, String> = Gson().fromJson<Map<String, String>>(
|
val header: Map<String, String> = Gson().fromJson<Map<String, String>>(
|
||||||
Util.base64Decode(req.queryParams["headers"]), MutableMap::class.java
|
Util.base64Decode(headers), MutableMap::class.java
|
||||||
)
|
)
|
||||||
proxyAsync(url, header, req, response)
|
proxyAsync(url, header, req, response)
|
||||||
}
|
}
|
||||||
|
|
@ -216,7 +220,7 @@ object ProxyServer {
|
||||||
fun buildProxyUrl(url: String, headers: Map<String, String>): String {
|
fun buildProxyUrl(url: String, headers: Map<String, String>): String {
|
||||||
return "http://127.0.0.1:$port/proxy?url=${Util.base64Encode(url.toByteArray(Charset.defaultCharset()))}&headers=${
|
return "http://127.0.0.1:$port/proxy?url=${Util.base64Encode(url.toByteArray(Charset.defaultCharset()))}&headers=${
|
||||||
Util.base64Encode(
|
Util.base64Encode(
|
||||||
Gson().toJson(headers).toByteArray(
|
Json.toJson(headers).toByteArray(
|
||||||
Charset.defaultCharset()
|
Charset.defaultCharset()
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -1 +1 @@
|
||||||
d9c6562f45aff98d146a205881095f76
|
70e0ff204c63fb77312eb360c1f2a32a
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"spider": "https://gh.llkk.cc/https://raw.githubusercontent.com/lushunming/AndroidCatVodSpider/multiThreadNew/jar/custom_spider.jar;md5;d9c6562f45aff98d146a205881095f76",
|
"spider": "https://gh.llkk.cc/https://raw.githubusercontent.com/lushunming/AndroidCatVodSpider/multiThreadNew/jar/custom_spider.jar;md5;70e0ff204c63fb77312eb360c1f2a32a",
|
||||||
"lives": [
|
"lives": [
|
||||||
{
|
{
|
||||||
"name": "电视直播",
|
"name": "电视直播",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue