UjuiUjuMandan / EhViewer

EhViewer overhauled with censorship circumvention and no more
GNU General Public License v3.0
852 stars 18 forks source link

Cronet 随机回退到 TCP 连接导致被重置 #1

Closed iiikunn closed 12 months ago

iiikunn commented 12 months ago

复现步骤 / Step to reproduce

如上

预期行为 / Expected behaviour

直连ex

实际行为 / Actual Behaviour

出现“奇怪的错误”提示

应用日志 / App logs

No response

备注 / Addition details

No response

EhViewer 版本号 / EhViewer version code

1.8.9.7

EhViewer CI 版本 / EhViewer CI Version

8e8706b

Android 系统版本 / Android version

miui14

设备型号 / Device model

红米12turbo

SoC 型号 / Soc model

7gen2

自查步骤 / Verify steps

UjuiUjuMandan commented 12 months ago

我想要帮忙,但是你提供的信息有点少。

  1. 画廊站点切到 e-hentai 能访问吗?
  2. 浏览器能否访问 https://skk.moe
  3. 什么运营商?
  4. MIUI 14 的 Android 版本为何?
UjuiUjuMandan commented 12 months ago

我刚才使用了一个没有 exhentai 权限的帐号来测试:画廊站点为 exhentai 时,访问收藏会显示“奇怪的错误”、其他页面会显示“空页面”。

错误在于,此处应该显示“Sad Panda”来提示用户其没有权限,而不是显示如上所述的内容。

我觉得你的帐号是否只是简单地没有 exhentai 权限呢?你在浏览器登陆后能够访问 exhentai 呢?

iiikunn commented 12 months ago

感谢。 1、可以 2、可以 3、联通 4、安卓13 刚刚尝试了一下,使用联通的流量进入成功,但是更换网络后就无法访问了(比如在不关闭流量的情况下连接WIFI,并且刷新页面,就会在短暂转圈后提示奇怪的错误。此时,关闭WIFI,切换回流量也无法访问,重启软件也是。但是随意挂一个区域的梯子,哪怕是香港,可以访问)。 具体触发条件似乎是 进入EHviewer→更换网络→刷新页面,之后就会转圈然后提示奇怪的错误。但是似乎过一段时间就会恢复?如果需要log文件我可以提供。

iiikunn commented 12 months ago

比较奇怪的是,刚刚在反馈过程中,我再次尝试进入里站,成功了。十分钟前我刚刚尝试更换网络操作并出现奇怪的错误,现在却又可以借助流量访问了。中途没有再切换网络。

iiikunn commented 12 months ago

呃,刚刚打字过程中再切回去,又变成了奇怪的错误🧐

UjuiUjuMandan commented 12 months ago

@iiikunn 麻烦提供日志,复现一次“奇怪的错误”之后使用 设置-高级-导出日志 。 另外请试试这个版本看报错为何: https://github.com/UjuiUjuMandan/EhViewer/actions/runs/6464693427

iiikunn commented 12 months ago

感谢。 不管是更新前还是更新后,都是根本进不去 然后提示奇怪的错误。 联通直连。 1log是更新前的log 2log是更新后的log

通过百度网盘分享的文件

UjuiUjuMandan commented 12 months ago

1log-2023-10-10-12-41-20-812.zip 2log-2023-10-10-12-44-12-786.zip

10-10 12:43:58.694 18693 29603 D EhEngine: https://exhentai.org/
10-10 12:43:59.127 18693 18693 W System.err: java.io.IOException: java.util.concurrent.ExecutionException: zj0: Exception in CronetUrlRequest: net::ERR_CONNECTION_RESET, ErrorCode=8, InternalErrorCode=-101, Retryable=true

@FooIBar 来看看为啥会这样呢?addQuicHint 里有 exhentai.org ,用了 QUIC 还能被 RESET ?

UjuiUjuMandan commented 12 months ago

@iiikunn 你有电脑吗?对 Chromium 内核的浏览器,在其快捷方式的“目标” 后加入

 --enable-quic --origin-to-force-quic-on="exhentai.org:443, forums.e-hentai.org:443" --host-resolver-rules="MAP forums.e-hentai.org skk.moe, MAP exhentai.org skk.moe" 

然后打开它,访问 https://exhentai.org 。看看能正常看到白屏还是有别的错误。

lukemin commented 12 months ago

logcat-2023-10-10-13-33-15-877.txt 我的也是显示奇怪的错误。用的最新版的ci版本

lukemin commented 12 months ago

@iiikunn 你有电脑吗?对 Chromium 内核的浏览器,在其快捷方式的“目标” 后加入

 --enable-quic --origin-to-force-quic-on="exhentai.org:443, forums.e-hentai.org:443" --host-resolver-rules="MAP forums.e-hentai.org skk.moe, MAP exhentai.org skk.moe" 

然后打开它,访问 https://exhentai.org 。看看能正常看到白屏还是有别的错误。

结果是 ERR_CONNECTION_TIMED_OUT

UjuiUjuMandan commented 12 months ago

结果是 ERR_CONNECTION_TIMED_OUT

那应该是访问 skk.moe 的 IP 时超时罢,把 2 个 skk.moe 更换为比如 dash.cloudflare.com 或者 cdn.sstatic.net 呢?

lukemin commented 12 months ago

cdn.sstatic.net

"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" --enable-quic --origin-to-force-quic-on="exhentai.org:443, forums.e-hentai.org:443" --host-resolver-rules="MAP forums.e-hentai.org cdn.sstatic.net, MAP exhentai.org cdn.sstatic.net"

"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" --enable-quic --origin-to-force-quic-on="exhentai.org:443, forums.e-hentai.org:443" --host-resolver-rules="MAP forums.e-hentai.org dash.cloudflare.com, MAP exhentai.org dash.cloudflare.com"

都试了,一样的结果

UjuiUjuMandan commented 12 months ago

都试了,一样的结果

绷...难不成所有 Cloudflare 的 IP 在你地区都被封锁了...还是因为对 Edge 所以这些参数不生效...

lukemin commented 12 months ago

没有,我可以直连 Cloudflare.com和skk.moe

iiikunn commented 12 months ago

@iiikunn 你有电脑吗?对 Chromium 内核的浏览器,在其快捷方式的“目标” 后加入

 --enable-quic --origin-to-force-quic-on="exhentai.org:443, forums.e-hentai.org:443" --host-resolver-rules="MAP forums.e-hentai.org skk.moe, MAP exhentai.org skk.moe" 

然后打开它,访问 https://exhentai.org 。看看能正常看到白屏还是有别的错误。

我在上课,稍等,谷歌浏览器可以吗

iiikunn commented 12 months ago

@iiikunn 你有电脑吗?对 Chromium 内核的浏览器,在其快捷方式的“目标” 后加入

 --enable-quic --origin-to-force-quic-on="exhentai.org:443, forums.e-hentai.org:443" --host-resolver-rules="MAP forums.e-hentai.org skk.moe, MAP exhentai.org skk.moe" 

然后打开它,访问 https://exhentai.org 。看看能正常看到白屏还是有别的错误。

尝试过了,无论是否使用VPN,可以加载出白屏。还没登录账号尝试能不能进入

iiikunn commented 12 months ago

@iiikunn 你有电脑吗?对 Chromium 内核的浏览器,在其快捷方式的“目标” 后加入

 --enable-quic --origin-to-force-quic-on="exhentai.org:443, forums.e-hentai.org:443" --host-resolver-rules="MAP forums.e-hentai.org skk.moe, MAP exhentai.org skk.moe" 

然后打开它,访问 https://exhentai.org 。看看能正常看到白屏还是有别的错误。

我使用的是谷歌浏览器

iiikunn commented 12 months ago

请问还需要别的支持吗?

UjuiUjuMandan commented 12 months ago

请问还需要别的支持吗?

我复现不了,所以修不了。

iiikunn commented 12 months ago

请问还需要别的支持吗?

我复现不了,所以修不了。

感谢。就这样吧。 另外,或许作者您可以通过上一位维护者寻求支持。听说他的版本依旧可用。

UjuiUjuMandan commented 12 months ago

已经复现此现象,exhentai 和 e-hentai 都会出现。目前原因我猜测是 QUIC 连接失败一次或多次导致 cronet 回退到了 TCP 连接,后者导致连接被 GFW 重置。

必须让 QUIC 连接失败一次才能复现。方法:

  1. 连接到特定的 WLAN ,并关闭蜂窝网络。
  2. 我此处的 WLAN 要求登陆,未登陆时无法访问互联网,对 HTTP 连接会劫持到登录页面,对 HTTPS 也会使用自签证书劫持。在 EhViewer 中刷新会看到 ERR_AUTHORITY_INVALID ,说明已经回退到 TCP 连接。
  3. 恢复网络连接(要么在 WLAN 中登陆要么恢复蜂窝网络),此时 EhViewer 仍会使用 TCP 连接,不再尝试 QUIC ,这导致所有连接都被 GFW 重置。
UjuiUjuMandan commented 12 months ago

QUIC 只在第一次连接时被使用,失败就会回退 TCP ,被重置。查了没有禁用回退的方法。

UjuiUjuMandan commented 12 months ago

那么为什么会失败呢?肯定是指定的 Cloudflare IP 连通性不够好。目前是硬编码了 skk.moe ,未来可能会让使用者自定要 MAP 到什么 域名/IP 。

现在可以设定 Cloudflare IP 了:https://github.com/UjuiUjuMandan/EhViewer/commit/0f397dace2efac66889384970cafb464d95c397c

Pantyhose-X commented 10 months ago

感谢。 1、可以 2、可以 3、联通 4、安卓13 刚刚尝试了一下,使用联通的流量进入成功,但是更换网络后就无法访问了(比如在不关闭流量的情况下连接WIFI,并且刷新页面,就会在短暂转圈后提示奇怪的错误。此时,关闭WIFI,切换回流量也无法访问,重启软件也是。但是随意挂一个区域的梯子,哪怕是香港,可以访问)。 具体触发条件似乎是 进入EHviewer→更换网络→刷新页面,之后就会转圈然后提示奇怪的错误。但是似乎过一段时间就会恢复?如果需要log文件我可以提供。

WiFi更改DNS SIM卡修改APN設置

我修改hosts 使用台灣谷歌服務器, 直連Google , f-droid twitch element等 也經常會 ERR_AUTHORITY_INVALID

UjuiUjuMandan commented 10 months ago

@Pantyhose-X 你说错误和我提到的没有任何关系。

EhViewer 内置 Hosts 和 DoH 应对 DNS 污染,不需要修改 APN 和 WiFi 设置。

UjuiUjuMandan commented 9 months ago

自定要 MAP 到什么 域名/IP 。

除了在 Cloudflare IP Override 中自选 IP 之外,也可以直接不用 Cronet ,选择 OkHttp ,这会让他回到域前置。