Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

follow rules by ITC to obtain the ac_id #12

Merged
merged 2 commits into from
Apr 26, 2024

Conversation

YDX-2147483647
Copy link
Contributor

@YDX-2147483647 YDX-2147483647 commented Apr 10, 2024

Resolves #11

Relates-to: BITNP/bitsrun#49

已知的问题

用了or而非or_else,有多余网络请求

无论是否登录,都会为了ac_id发送两个网络请求。

原因:or_elseasync八字不合(How to run async code within Option / Result function chain? - help - The Rust Programming Language Forum),这样写更易理解。况且 Python 那边也有多余网络请求。

ARBITRARY_HTTP_SITE可能要换成校外网站

网信中心推荐 http://www.bit.edu.cn ,但我实测(dbg!())发现每次都回落,并没起到效果。似乎换成校外网站(例如 http://b23.tv )才会跳转。

[src\client.rs:165:5] get_acid_by_url(client, ARBITRARY_HTTP_SITE).await = Err(
    failed to get ac_id from `http://www.bit.edu.cn/`,
)
[src\client.rs:168:13] get_acid_by_url(client, SRUN_PORTAL).await = Ok(
    "1",
)

@spencerwooo
Copy link
Owner

网信中心推荐 http://www.bit.edu.cn/ ,但我实测(dbg!())发现每次都回落,并没起到效果。似乎换成校外网站(例如 http://b23.tv/ )才会跳转。

可以考虑一下几个 HTTP 网址用来跳转:

@YDX-2147483647
Copy link
Contributor Author

YDX-2147483647 commented Apr 11, 2024

我认为还是用 www.bit.edu.cn 比较好,毕竟是网信中心推荐的。

因为我刚才再试,未登录时访问校外网站会卡住(ping 域名超时)或者 502 Bad Gateway,并不能跳转;也许和校区、位置、时间、DNS缓存有关吧。

(除了你提到的,我还试了 https://support.mozilla.org/kb/captive-portal 介绍的 http://detectportal.firefox.com/canonical.html 以及 https://en.wikipedia.org/wiki/Captive_portal#Detection 列出的。)

@YDX-2147483647
Copy link
Contributor Author

我又试了下,这回Firefox、Apple的能跳转,微软的不行。

@spencerwooo spencerwooo merged commit 04a5ccd into spencerwooo:main Apr 26, 2024
1 check passed
@YDX-2147483647 YDX-2147483647 deleted the itc branch April 26, 2024 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update ac_id acquire method
2 participants