Skip to content

Commit 5eecb9d

Browse files
committed
perf: reuse BiliBili range connections
1 parent 15dc17e commit 5eecb9d

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/main/kotlin/dev/typetype/server/services/OkHttpProxyService.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ class OkHttpProxyService(
6262
if (bilibili) {
6363
builder.header("Referer", BILIBILI_REFERER)
6464
builder.header("Accept", ACCEPT_ANY)
65-
if (rangeHeader != null) builder.header("Connection", "close")
6665
}
6766
if (resolvedDomandBid != null && isNicoNico(cleanUrl)) builder.header("Cookie", "domand_bid=$resolvedDomandBid")
6867
if (rangeHeader != null) builder.header("Range", rangeHeader)

src/test/kotlin/dev/typetype/server/BilibiliRangeProxyTest.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import okhttp3.Response
1010
import okhttp3.ResponseBody.Companion.toResponseBody
1111
import org.junit.jupiter.api.Assertions.assertArrayEquals
1212
import org.junit.jupiter.api.Assertions.assertEquals
13+
import org.junit.jupiter.api.Assertions.assertNull
1314
import org.junit.jupiter.api.Test
1415
import java.io.IOException
1516
import java.net.InetAddress
@@ -28,7 +29,7 @@ class BilibiliRangeProxyTest {
2829
assertEquals(OkHttpProxyService.BILIBILI_USER_AGENT, request.header("User-Agent"))
2930
assertEquals("https://www.bilibili.com", request.header("Referer"))
3031
assertEquals("*/*", request.header("Accept"))
31-
assertEquals("close", request.header("Connection"))
32+
assertNull(request.header("Connection"))
3233
assertEquals("bytes=0-3", request.header("Range"))
3334
if (calls == 1) throw IOException("unexpected end of stream")
3435
Response.Builder()

0 commit comments

Comments
 (0)