Skip to content

Commit 72e66f2

Browse files
authored
Merge pull request #492 from DanXi-Dev/webvpn-examlist-fix
fix: 403 issue in ExamList page temporarily by deleting some cookies
2 parents ef57b17 + d603dd9 commit 72e66f2

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

lib/repository/cookie/independent_cookie_jar.dart

+17
Original file line numberDiff line numberDiff line change
@@ -192,4 +192,21 @@ class IndependentCookieJar implements CookieJar {
192192

193193
@override
194194
final bool ignoreExpires;
195+
196+
void deleteCookiesByName(String name) {
197+
for (final domain in hostCookies.keys) {
198+
final cookies = hostCookies[domain]!;
199+
for (final path in cookies.keys) {
200+
final values = cookies[path]!;
201+
values.remove(name);
202+
}
203+
}
204+
for (final domain in domainCookies.keys) {
205+
final cookies = domainCookies[domain]!;
206+
for (final path in cookies.keys) {
207+
final values = cookies[path]!;
208+
values.remove(name);
209+
}
210+
}
211+
}
195212
}

lib/repository/fdu/uis_login_tool.dart

+3
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ class UISLoginTool {
120120
workDio.interceptors.add(CookieManager(workJar));
121121
workDio.interceptors.add(DioLogInterceptor());
122122

123+
// fixme: workaround by deleting `CASTGC` cookie before requesting the UIS page
124+
// See https://github.com/DanXi-Dev/DanXi/issues/491 for details.
125+
workJar.deleteCookiesByName("CASTGC");
123126
Map<String?, String?> data = {};
124127
Response<String> res = await workDio.get(serviceUrl);
125128
BeautifulSoup(res.data!).findAll("input").forEach((element) {

0 commit comments

Comments
 (0)