Fix TLS behaviour for some ISPs.
Dadoum

Dadoum commited on 2026-02-13 03:52:02
Showing 11 changed files, with 125 additions and 96 deletions.

... ...
@@ -37,9 +37,9 @@ checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
37 37
 
38 38
 [[package]]
39 39
 name = "aead"
40
-version = "0.6.0-rc.5"
40
+version = "0.6.0-rc.10"
41 41
 source = "registry+https://github.com/rust-lang/crates.io-index"
42
-checksum = "67a578e7d4edaef88aeb9cdd81556f4a62266ce26601317c006a79e8bc58b5af"
42
+checksum = "6b657e772794c6b04730ea897b66a058ccd866c16d1967da05eeeecec39043fe"
43 43
 dependencies = [
44 44
  "crypto-common",
45 45
  "inout",
... ...
@@ -47,20 +47,20 @@ dependencies = [
47 47
 
48 48
 [[package]]
49 49
 name = "aes"
50
-version = "0.9.0-rc.2"
50
+version = "0.9.0-rc.4"
51 51
 source = "registry+https://github.com/rust-lang/crates.io-index"
52
-checksum = "fd9e1c818b25efb32214df89b0ec22f01aa397aaeb718d1022bf0635a3bfd1a8"
52
+checksum = "04097e08a47d9ad181c2e1f4a5fabc9ae06ce8839a333ba9a949bcb0d31fd2a3"
53 53
 dependencies = [
54
- "cfg-if 1.0.4",
55 54
  "cipher",
56
- "cpufeatures",
55
+ "cpubits",
56
+ "cpufeatures 0.2.17",
57 57
 ]
58 58
 
59 59
 [[package]]
60 60
 name = "aes-gcm"
61
-version = "0.11.0-rc.2"
61
+version = "0.11.0-rc.3"
62 62
 source = "registry+https://github.com/rust-lang/crates.io-index"
63
-checksum = "7f5c07f414d7dc0755870f84c7900425360288d24e0eae4836f9dee19a30fa5f"
63
+checksum = "e22c0c90bbe8d4f77c3ca9ddabe41a1f8382d6fc1f7cea89459d0f320371f972"
64 64
 dependencies = [
65 65
  "aead",
66 66
  "aes",
... ...
@@ -429,9 +429,9 @@ checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a"
429 429
 
430 430
 [[package]]
431 431
 name = "cbc"
432
-version = "0.2.0-rc.2"
432
+version = "0.2.0-rc.3"
433 433
 source = "registry+https://github.com/rust-lang/crates.io-index"
434
-checksum = "3c34a745c272d1f6124df3006881364190a8f033ff3857ce196a17aa4a753096"
434
+checksum = "85742c5f1d0dda799d2e582c76b82b817d3e4d6434dd285e48e90ed0c963b667"
435 435
 dependencies = [
436 436
  "cipher",
437 437
 ]
... ...
@@ -496,9 +496,9 @@ dependencies = [
496 496
 
497 497
 [[package]]
498 498
 name = "cipher"
499
-version = "0.5.0-rc.3"
499
+version = "0.5.0"
500 500
 source = "registry+https://github.com/rust-lang/crates.io-index"
501
-checksum = "98d708bac5451350d56398433b19a7889022fa9187df1a769c0edbc3b2c03167"
501
+checksum = "64727038c8c5e2bb503a15b9f5b9df50a1da9a33e83e1f93067d914f2c6604a5"
502 502
 dependencies = [
503 503
  "block-buffer",
504 504
  "crypto-common",
... ...
@@ -611,6 +611,12 @@ version = "0.8.7"
611 611
 source = "registry+https://github.com/rust-lang/crates.io-index"
612 612
 checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
613 613
 
614
+[[package]]
615
+name = "cpubits"
616
+version = "0.1.0"
617
+source = "registry+https://github.com/rust-lang/crates.io-index"
618
+checksum = "5ef0c543070d296ea414df2dd7625d1b24866ce206709d8a4a424f28377f5861"
619
+
614 620
 [[package]]
615 621
 name = "cpufeatures"
616 622
 version = "0.2.17"
... ...
@@ -620,6 +626,15 @@ dependencies = [
620 626
  "libc",
621 627
 ]
622 628
 
629
+[[package]]
630
+name = "cpufeatures"
631
+version = "0.3.0"
632
+source = "registry+https://github.com/rust-lang/crates.io-index"
633
+checksum = "8b2a41393f66f16b0823bb79094d54ac5fbd34ab292ddafb9a0456ac9f87d201"
634
+dependencies = [
635
+ "libc",
636
+]
637
+
623 638
 [[package]]
624 639
 name = "crc32fast"
625 640
 version = "1.5.0"
... ...
@@ -642,28 +657,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
642 657
 checksum = "053c3561863ce55e3226ecc48b08679f4b66cb1b92b9afb42c2c402dfe8b9b51"
643 658
 dependencies = [
644 659
  "ctutils",
645
- "getrandom 0.4.0-rc.1",
660
+ "getrandom 0.4.1",
646 661
  "num-traits",
647
- "rand_core 0.10.0-rc-6",
662
+ "rand_core 0.10.0",
648 663
  "serdect",
649 664
 ]
650 665
 
651 666
 [[package]]
652 667
 name = "crypto-common"
653
-version = "0.2.0-rc.13"
668
+version = "0.2.0"
654 669
 source = "registry+https://github.com/rust-lang/crates.io-index"
655
-checksum = "c7722afd27468475c9b6063dc03a57ef2ca833816981619f8ebe64d38d207eef"
670
+checksum = "211f05e03c7d03754740fd9e585de910a095d6b99f8bcfffdef8319fa02a8331"
656 671
 dependencies = [
657
- "getrandom 0.4.0-rc.1",
672
+ "getrandom 0.4.1",
658 673
  "hybrid-array",
659
- "rand_core 0.10.0-rc-6",
674
+ "rand_core 0.10.0",
660 675
 ]
661 676
 
662 677
 [[package]]
663 678
 name = "ctr"
664
-version = "0.10.0-rc.2"
679
+version = "0.10.0-rc.3"
665 680
 source = "registry+https://github.com/rust-lang/crates.io-index"
666
-checksum = "3d0ec605a95e78815a4c4b8040217d56d5a1ab37043851ee9e7e65b89afa00e3"
681
+checksum = "65ea71550d18331d179854662ab330bb54306b9b56020d0466aae2a58f4e17c1"
667 682
 dependencies = [
668 683
  "cipher",
669 684
 ]
... ...
@@ -717,9 +732,9 @@ dependencies = [
717 732
 
718 733
 [[package]]
719 734
 name = "digest"
720
-version = "0.11.0-rc.9"
735
+version = "0.11.0-rc.12"
721 736
 source = "registry+https://github.com/rust-lang/crates.io-index"
722
-checksum = "bff8de092798697546237a3a701e4174fe021579faec9b854379af9bf1e31962"
737
+checksum = "d4b37eb2004a3548553a44cc1e688aac70f0345b896c9d822b4a0e520bc9183b"
723 738
 dependencies = [
724 739
  "block-buffer",
725 740
  "const-oid",
... ...
@@ -1016,23 +1031,23 @@ dependencies = [
1016 1031
 
1017 1032
 [[package]]
1018 1033
 name = "getrandom"
1019
-version = "0.4.0-rc.1"
1034
+version = "0.4.1"
1020 1035
 source = "registry+https://github.com/rust-lang/crates.io-index"
1021
-checksum = "74f70a332ddf75e5e5e43284304179ba02f391f82f692f030b08a8378adf3c99"
1036
+checksum = "139ef39800118c7683f2fd3c98c1b23c09ae076556b435f8e9064ae108aaeeec"
1022 1037
 dependencies = [
1023 1038
  "cfg-if 1.0.4",
1024 1039
  "libc",
1025 1040
  "r-efi",
1026
- "rand_core 0.10.0-rc-6",
1041
+ "rand_core 0.10.0",
1027 1042
  "wasip2",
1028 1043
  "wasip3",
1029 1044
 ]
1030 1045
 
1031 1046
 [[package]]
1032 1047
 name = "ghash"
1033
-version = "0.6.0-rc.3"
1048
+version = "0.6.0-rc.6"
1034 1049
 source = "registry+https://github.com/rust-lang/crates.io-index"
1035
-checksum = "333de57ed9494a40df4bbb866752b100819dde0d18f2264c48f5a08a85fe673d"
1050
+checksum = "bb9be1ab8718f9d16384cb3626a5a7d7eac4d3fd1b2564e97592f40523dc0228"
1036 1051
 dependencies = [
1037 1052
  "polyval",
1038 1053
 ]
... ...
@@ -1105,7 +1120,6 @@ dependencies = [
1105 1120
  "srp",
1106 1121
  "sys-locale",
1107 1122
  "thiserror 2.0.17",
1108
- "uuid",
1109 1123
 ]
1110 1124
 
1111 1125
 [[package]]
... ...
@@ -1202,9 +1216,9 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
1202 1216
 
1203 1217
 [[package]]
1204 1218
 name = "hmac"
1205
-version = "0.13.0-rc.4"
1219
+version = "0.13.0-rc.5"
1206 1220
 source = "registry+https://github.com/rust-lang/crates.io-index"
1207
-checksum = "d9956e202a691c5c86c60303a421f66f93f44b29433407b7c43cf2bebadc750e"
1221
+checksum = "ef451d73f36d8a3f93ad32c332ea01146c9650e1ec821a9b0e46c01277d544f8"
1208 1222
 dependencies = [
1209 1223
  "digest",
1210 1224
 ]
... ...
@@ -1288,9 +1302,9 @@ dependencies = [
1288 1302
 
1289 1303
 [[package]]
1290 1304
 name = "hybrid-array"
1291
-version = "0.4.5"
1305
+version = "0.4.7"
1292 1306
 source = "registry+https://github.com/rust-lang/crates.io-index"
1293
-checksum = "f471e0a81b2f90ffc0cb2f951ae04da57de8baa46fa99112b062a5173a5088d0"
1307
+checksum = "e1b229d73f5803b562cc26e4da0396c8610a4ee209f4fac8fa4f8d709166dc45"
1294 1308
 dependencies = [
1295 1309
  "typenum",
1296 1310
 ]
... ...
@@ -2035,9 +2049,9 @@ checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f"
2035 2049
 
2036 2050
 [[package]]
2037 2051
 name = "pbkdf2"
2038
-version = "0.13.0-rc.8"
2052
+version = "0.13.0-rc.9"
2039 2053
 source = "registry+https://github.com/rust-lang/crates.io-index"
2040
-checksum = "626220f48328b90cad8393e99e9ef80503970e6e86e77f32f7e42227972e7c2c"
2054
+checksum = "c8dfa4e14084d963d35bfb4cdb38712cde78dcf83054c0e8b9b8e899150f374e"
2041 2055
 dependencies = [
2042 2056
  "digest",
2043 2057
  "hmac",
... ...
@@ -2095,12 +2109,12 @@ dependencies = [
2095 2109
 
2096 2110
 [[package]]
2097 2111
 name = "polyval"
2098
-version = "0.7.0-rc.3"
2112
+version = "0.7.0-rc.9"
2099 2113
 source = "registry+https://github.com/rust-lang/crates.io-index"
2100
-checksum = "1ad60831c19edda4b20878a676595c357e93a9b4e6dca2ba98d75b01066b317b"
2114
+checksum = "0e83fbff7a079b2d37c70aa6bd5eedb9e5d09ceb9b4ecd31e9ea212d00e9b0bc"
2101 2115
 dependencies = [
2102
- "cfg-if 1.0.4",
2103
- "cpufeatures",
2116
+ "cpubits",
2117
+ "cpufeatures 0.3.0",
2104 2118
  "universal-hash",
2105 2119
 ]
2106 2120
 
... ...
@@ -2325,9 +2339,9 @@ dependencies = [
2325 2339
 
2326 2340
 [[package]]
2327 2341
 name = "rand_core"
2328
-version = "0.10.0-rc-6"
2342
+version = "0.10.0"
2329 2343
 source = "registry+https://github.com/rust-lang/crates.io-index"
2330
-checksum = "70765ff7112b0fb2d272d24d9a2f907fc206211304328fe58b2db15a5649ef28"
2344
+checksum = "0c8d0fd677905edcbeedbf2edb6494d676f0e98d54d5cf9bda0b061cb8fb8aba"
2331 2345
 
2332 2346
 [[package]]
2333 2347
 name = "regex"
... ...
@@ -2758,23 +2772,23 @@ dependencies = [
2758 2772
 
2759 2773
 [[package]]
2760 2774
 name = "sha1"
2761
-version = "0.11.0-rc.4"
2775
+version = "0.11.0-rc.5"
2762 2776
 source = "registry+https://github.com/rust-lang/crates.io-index"
2763
-checksum = "9c777f0a122a53fddb0beb6e706771197000b8eb5c9f42b5b850f450ef48c788"
2777
+checksum = "3b167252f3c126be0d8926639c4c4706950f01445900c4b3db0fd7e89fcb750a"
2764 2778
 dependencies = [
2765 2779
  "cfg-if 1.0.4",
2766
- "cpufeatures",
2780
+ "cpufeatures 0.2.17",
2767 2781
  "digest",
2768 2782
 ]
2769 2783
 
2770 2784
 [[package]]
2771 2785
 name = "sha2"
2772
-version = "0.11.0-rc.4"
2786
+version = "0.11.0-rc.5"
2773 2787
 source = "registry+https://github.com/rust-lang/crates.io-index"
2774
-checksum = "7535f94fa3339fe9e5e9be6260a909e62af97f6e14b32345ccf79b92b8b81233"
2788
+checksum = "7c5f3b1e2dc8aad28310d8410bd4d7e180eca65fca176c52ab00d364475d0024"
2775 2789
 dependencies = [
2776 2790
  "cfg-if 1.0.4",
2777
- "cpufeatures",
2791
+ "cpufeatures 0.2.17",
2778 2792
  "digest",
2779 2793
 ]
2780 2794
 
... ...
@@ -3341,9 +3355,9 @@ checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853"
3341 3355
 
3342 3356
 [[package]]
3343 3357
 name = "universal-hash"
3344
-version = "0.6.0-rc.4"
3358
+version = "0.6.0-rc.10"
3345 3359
 source = "registry+https://github.com/rust-lang/crates.io-index"
3346
-checksum = "0386f227888b17b65d3e38219a7d41185035471300855c285667811907bb1677"
3360
+checksum = "058482a494bb3c9c39447d8b40a3a0f38ebb3dccaf02c5a2d681e69035f8da11"
3347 3361
 dependencies = [
3348 3362
  "crypto-common",
3349 3363
  "subtle",
... ...
@@ -3444,11 +3458,11 @@ dependencies = [
3444 3458
 
3445 3459
 [[package]]
3446 3460
 name = "wasip3"
3447
-version = "0.3.1+wasi-0.3.0-rc-2025-09-16"
3461
+version = "0.4.0+wasi-0.3.0-rc-2026-01-06"
3448 3462
 source = "registry+https://github.com/rust-lang/crates.io-index"
3449
-checksum = "87ba4be47b1d11244670d11857eee0758a8f2c39aea64d80b78c1ce29b4642cd"
3463
+checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5"
3450 3464
 dependencies = [
3451
- "wit-bindgen 0.48.1",
3465
+ "wit-bindgen 0.51.0",
3452 3466
 ]
3453 3467
 
3454 3468
 [[package]]
... ...
@@ -3525,9 +3539,9 @@ dependencies = [
3525 3539
 
3526 3540
 [[package]]
3527 3541
 name = "wasm-encoder"
3528
-version = "0.241.2"
3542
+version = "0.244.0"
3529 3543
 source = "registry+https://github.com/rust-lang/crates.io-index"
3530
-checksum = "e01164c9dda68301e34fdae536c23ed6fe90ce6d97213ccc171eebbd3d02d6b8"
3544
+checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319"
3531 3545
 dependencies = [
3532 3546
  "leb128fmt",
3533 3547
  "wasmparser",
... ...
@@ -3535,9 +3549,9 @@ dependencies = [
3535 3549
 
3536 3550
 [[package]]
3537 3551
 name = "wasm-metadata"
3538
-version = "0.241.2"
3552
+version = "0.244.0"
3539 3553
 source = "registry+https://github.com/rust-lang/crates.io-index"
3540
-checksum = "876fe286f2fa416386deedebe8407e6f19e0b5aeaef3d03161e77a15fa80f167"
3554
+checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909"
3541 3555
 dependencies = [
3542 3556
  "anyhow",
3543 3557
  "indexmap 2.12.0",
... ...
@@ -3547,9 +3561,9 @@ dependencies = [
3547 3561
 
3548 3562
 [[package]]
3549 3563
 name = "wasmparser"
3550
-version = "0.241.2"
3564
+version = "0.244.0"
3551 3565
 source = "registry+https://github.com/rust-lang/crates.io-index"
3552
-checksum = "46d90019b1afd4b808c263e428de644f3003691f243387d30d673211ee0cb8e8"
3566
+checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe"
3553 3567
 dependencies = [
3554 3568
  "bitflags 2.10.0",
3555 3569
  "hashbrown 0.15.5",
... ...
@@ -4014,18 +4028,18 @@ checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59"
4014 4028
 
4015 4029
 [[package]]
4016 4030
 name = "wit-bindgen"
4017
-version = "0.48.1"
4031
+version = "0.51.0"
4018 4032
 source = "registry+https://github.com/rust-lang/crates.io-index"
4019
-checksum = "7f8c2adb5f74ac9395bc3121c99a1254bf9310482c27b13f97167aedb5887138"
4033
+checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5"
4020 4034
 dependencies = [
4021 4035
  "wit-bindgen-rust-macro",
4022 4036
 ]
4023 4037
 
4024 4038
 [[package]]
4025 4039
 name = "wit-bindgen-core"
4026
-version = "0.48.1"
4040
+version = "0.51.0"
4027 4041
 source = "registry+https://github.com/rust-lang/crates.io-index"
4028
-checksum = "9b881a098cae03686d7a0587f8f306f8a58102ad8da8b5599100fbe0e7f5800b"
4042
+checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc"
4029 4043
 dependencies = [
4030 4044
  "anyhow",
4031 4045
  "heck 0.5.0",
... ...
@@ -4034,9 +4048,9 @@ dependencies = [
4034 4048
 
4035 4049
 [[package]]
4036 4050
 name = "wit-bindgen-rust"
4037
-version = "0.48.1"
4051
+version = "0.51.0"
4038 4052
 source = "registry+https://github.com/rust-lang/crates.io-index"
4039
-checksum = "69667efa439a453e1d50dac939c6cab6d2c3ac724a9d232b6631dad2472a5b70"
4053
+checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21"
4040 4054
 dependencies = [
4041 4055
  "anyhow",
4042 4056
  "heck 0.5.0",
... ...
@@ -4050,9 +4064,9 @@ dependencies = [
4050 4064
 
4051 4065
 [[package]]
4052 4066
 name = "wit-bindgen-rust-macro"
4053
-version = "0.48.1"
4067
+version = "0.51.0"
4054 4068
 source = "registry+https://github.com/rust-lang/crates.io-index"
4055
-checksum = "eae2e22cceb5d105d52326c07e3e67603a861cc7add70fc467f7cc7ec5265017"
4069
+checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a"
4056 4070
 dependencies = [
4057 4071
  "anyhow",
4058 4072
  "prettyplease",
... ...
@@ -4065,9 +4079,9 @@ dependencies = [
4065 4079
 
4066 4080
 [[package]]
4067 4081
 name = "wit-component"
4068
-version = "0.241.2"
4082
+version = "0.244.0"
4069 4083
 source = "registry+https://github.com/rust-lang/crates.io-index"
4070
-checksum = "1fd0c57df25e7ee612d946d3b7646c1ddb2310f8280aa2c17e543b66e0812241"
4084
+checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2"
4071 4085
 dependencies = [
4072 4086
  "anyhow",
4073 4087
  "bitflags 2.10.0",
... ...
@@ -4084,9 +4098,9 @@ dependencies = [
4084 4098
 
4085 4099
 [[package]]
4086 4100
 name = "wit-parser"
4087
-version = "0.241.2"
4101
+version = "0.244.0"
4088 4102
 source = "registry+https://github.com/rust-lang/crates.io-index"
4089
-checksum = "09ef1c6ad67f35c831abd4039c02894de97034100899614d1c44e2268ad01c91"
4103
+checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736"
4090 4104
 dependencies = [
4091 4105
  "anyhow",
4092 4106
  "id-arena",
... ...
@@ -18,10 +18,10 @@ reqwest = { version = "0.13", features = ["rustls", "query", "gzip"] }
18 18
 thiserror = "2"
19 19
 tokio = { version = "1", features = ["rt", "rt-multi-thread", "macros"] }
20 20
 
21
-aes = "0.9.0-rc.2"
22
-aes-gcm = "0.11.0-rc.2"
23
-cbc = { version = "0.2.0-rc.2", features = ["alloc"] }
24
-hmac = "0.13.0-rc.4"
25
-pbkdf2 = "0.13.0-rc.8"
26
-sha1 = "0.11.0-rc.4"
27
-sha2 = "0.11.0-rc.4"
21
+aes = "0.9.0-rc.4"
22
+aes-gcm = "0.11.0-rc.3"
23
+cbc = { version = "0.2.0-rc.3", features = ["alloc"] }
24
+hmac = "0.13.0-rc.5"
25
+pbkdf2 = "0.13.0-rc.9"
26
+sha1 = "0.11.0-rc.5"
27
+sha2 = "0.11.0-rc.5"
... ...
@@ -1,6 +1,6 @@
1 1
 use proc_macro::TokenStream;
2 2
 use quote::quote;
3
-use syn::{parse_macro_input, ItemFn, Signature, TypeBareFn};
3
+use syn::{parse_macro_input, ItemFn, Signature};
4 4
 
5 5
 #[proc_macro_attribute]
6 6
 pub fn sysv64(_attr: TokenStream, item: TokenStream) -> TokenStream {
... ...
@@ -28,4 +28,3 @@ rand = "0.9.2"
28 28
 hex = "0.4.3"
29 29
 bytes = "1.10.1"
30 30
 log = "0.4.29"
31
-uuid = { version = "1.19.0", features = ["v4"] }
... ...
@@ -1,3 +1,4 @@
1
+#[derive(Clone)]
1 2
 pub struct BundleInformation<'lt> {
2 3
     // Maybe simplify to 'static?
3 4
     pub bundle_name: &'lt str,
... ...
@@ -92,6 +92,8 @@ pub(crate) fn parse_url_bag_response(url_bag_response: Bytes) -> Result<Dictiona
92 92
         .cloned()
93 93
         .ok_or(URLBagError::InvalidUrlBag)?;
94 94
 
95
+    println!("{:#?}", url_bag_plist);
96
+
95 97
     Ok(url_bag_plist)
96 98
 }
97 99
 
... ...
@@ -274,6 +276,7 @@ pub async fn login(
274 276
         .body(dict_to_body(request_plist))
275 277
         .send()
276 278
         .await?
279
+        .error_for_status()?
277 280
         .bytes()
278 281
         .await?;
279 282
 
... ...
@@ -357,9 +360,17 @@ pub async fn login(
357 360
 
358 361
     let response = http_session
359 362
         .anisette_request_builder(Method::POST, gs_service_url)?
363
+        // HACK: On success, Apple apps pass the obtained data to the app,
364
+        // which will then initialize another HTTP client, with a new TLS session.
365
+        // Here, it would not create a new TLS session, and I don't want to force
366
+        // people to use a new HTTP session on success. So instead, I force the connection
367
+        // to be interrupted here. It is important because on some networks, the apptokens
368
+        // request fails if the TLS session is kept alive.
369
+        .header("Connection", "close")
360 370
         .body(dict_to_body(request_plist))
361 371
         .send()
362 372
         .await?
373
+        .error_for_status()?
363 374
         .bytes()
364 375
         .await?;
365 376
 
... ...
@@ -369,7 +380,7 @@ pub async fn login(
369 380
             error,
370 381
         })?;
371 382
 
372
-    trace!("Received: {:#?}", response_plist);
383
+    // trace!("Received: {:#?}", response_plist);
373 384
 
374 385
     let response_dict = response_plist
375 386
         .get("Response")
... ...
@@ -36,7 +36,7 @@ impl TryFrom<&Token> for HeaderValue {
36 36
     }
37 37
 }
38 38
 
39
-#[derive(Debug)]
39
+#[derive(Debug, Clone)]
40 40
 pub struct AuthToken {
41 41
     pub alt_dsid: String,
42 42
     pub idms_token: String,
... ...
@@ -143,6 +143,7 @@ pub enum AuthenticatedRequestError {
143 143
 
144 144
 pub type AuthenticatedRequestResult<T> = Result<T, AuthenticatedRequestError>;
145 145
 
146
+#[derive(Clone)]
146 147
 pub struct AuthenticatedHTTPSession<'lt, 'adi> {
147 148
     pub http_session: AnisetteHTTPSession<'lt, 'adi>,
148 149
     pub auth_token: AuthToken,
... ...
@@ -257,6 +258,7 @@ impl<'a, 'b> AuthenticatedHTTPSession<'a, 'b> {
257 258
             .send()
258 259
             .await
259 260
             .map_err(AppTokenRequestError::Network)?
261
+            .error_for_status()?
260 262
             .bytes()
261 263
             .await
262 264
             .map_err(AppTokenRequestError::Network)?;
... ...
@@ -267,21 +269,21 @@ impl<'a, 'b> AuthenticatedHTTPSession<'a, 'b> {
267 269
         let response_dict = response_plist
268 270
             .get("Response")
269 271
             .and_then(|response| response.as_dictionary())
270
-            .ok_or(AppTokenRequestError::Structure(response_plist.clone()))?;
272
+            .ok_or_else(|| AppTokenRequestError::Structure(response_plist.clone()))?;
271 273
 
272 274
         // println!("Response: {response_dict:?}");
273 275
 
274 276
         let status = response_dict
275 277
             .get("Status")
276 278
             .and_then(|status| status.as_dictionary())
277
-            .ok_or(AppTokenRequestError::Structure(response_plist.clone()))?;
279
+            .ok_or_else(|| AppTokenRequestError::Structure(response_plist.clone()))?;
278 280
 
279 281
         parse_status(status)?;
280 282
 
281 283
         let encrypted_tokens = response_dict
282 284
             .get("et")
283 285
             .and_then(|et| et.as_data())
284
-            .ok_or(AppTokenRequestError::Structure(response_plist.clone()))?;
286
+            .ok_or_else(|| AppTokenRequestError::Structure(response_plist.clone()))?;
285 287
 
286 288
         let associated_data = &encrypted_tokens[0..3];
287 289
         if associated_data != b"XYZ" {
... ...
@@ -9,6 +9,7 @@ use reqwest::header::{HeaderMap, InvalidHeaderValue};
9 9
 use reqwest::{Certificate, Client, Method, RequestBuilder};
10 10
 use std::error::Error;
11 11
 use std::fmt::{Display, Formatter};
12
+use std::sync::Arc;
12 13
 
13 14
 const SIMULATED_AUTHENTICATION_FRAMEWORK_INFORMATION: BundleInformation =
14 15
     AUTH_KIT_BUNDLE_INFORMATION;
... ...
@@ -72,12 +73,14 @@ pub fn parse_status(status_dict: &Dictionary) -> Result<(), AppleError> {
72 73
 }
73 74
 
74 75
 /// Abstracts a session with Apple servers.
76
+#[derive(Clone)]
75 77
 pub struct BasicHTTPSession<'lt> {
76 78
     pub client: Client,
77 79
     pub device: Device,
78 80
     pub application_info: BundleInformation<'lt>,
79 81
 }
80 82
 
83
+#[derive(Clone)]
81 84
 pub struct HTTPSession<'lt> {
82 85
     pub http_session: BasicHTTPSession<'lt>,
83 86
     pub url_bag: URLBag,
... ...
@@ -106,7 +109,7 @@ impl<'lt> BasicHTTPSession<'lt> {
106 109
         client_bundle_info: BundleInformation<'lt>,
107 110
         custom_certificate: Option<Certificate>,
108 111
     ) -> Result<Self, HTTPSessionCreationError> {
109
-        let client_builder = Client::builder().danger_accept_invalid_certs(true);
112
+        let client_builder = Client::builder();
110 113
         let client_builder = match custom_certificate {
111 114
             Some(certificate) => client_builder.add_root_certificate(certificate),
112 115
             None => client_builder,
... ...
@@ -153,8 +156,7 @@ impl<'lt> BasicHTTPSession<'lt> {
153 156
 
154 157
         let client = client_builder
155 158
             .default_headers(headers)
156
-            // .connection_verbose(true)
157
-            // .http1_title_case_headers()
159
+            .connection_verbose(false)
158 160
             .build()
159 161
             .map_err(HTTPSessionCreationError::Reqwest)?;
160 162
 
... ...
@@ -215,6 +217,7 @@ impl<'lt> HTTPSession<'lt> {
215 217
     }
216 218
 }
217 219
 
220
+#[derive(Clone)]
218 221
 pub struct AnisetteHTTPSession<'lt, 'adi> {
219 222
     pub http_session: HTTPSession<'lt>,
220 223
     pub adi_proxy: &'adi dyn ADIProxy,
... ...
@@ -263,12 +266,9 @@ impl<'lt, 'adi> AnisetteHTTPSession<'lt, 'adi> {
263 266
             let mid = BASE64_STANDARD.encode(mid_b);
264 267
             let otp = BASE64_STANDARD.encode(otp_b);
265 268
 
266
-            let rinfo = self.adi_proxy.get_idms_routing(ds_id)?;
267
-
268 269
             request_builder = request_builder
269 270
                 .header("X-Apple-I-AMD", otp)
270
-                .header("X-Apple-I-AMD-M", mid)
271
-                .header("X-Apple-I-AMD-RINFO", rinfo);
271
+                .header("X-Apple-I-AMD-M", mid);
272 272
         }
273 273
 
274 274
         Ok(request_builder)
... ...
@@ -4,8 +4,9 @@ use android_coreadi::AndroidCoreADIProxy;
4 4
 use grandslam::bundle_information::APPLE_TV_BUNDLE_INFORMATION;
5 5
 use grandslam::device::Device;
6 6
 use grandslam::http_session::AnisetteHTTPSession;
7
-use grandslam::{AuthOutcome, AuthenticatedHTTPSession};
7
+use grandslam::{AppTokenRequestError, AuthOutcome, AuthenticatedHTTPSession, AuthenticatedRequestError};
8 8
 use std::{env, fs};
9
+use reqwest::{Method, StatusCode};
9 10
 use xcode::{ViewDeveloperAction, XcodeSession, XCODE_BUNDLE_INFORMATION, XCODE_TOKEN_IDENTIFIER};
10 11
 
11 12
 fn build_device() -> Device {
... ...
@@ -24,7 +25,7 @@ fn build_device() -> Device {
24 25
                 "{}; {}; {}; {}",
25 26
                 operating_system, system_version, system_edition, system_arch
26 27
             ),
27
-            // It shoudl look like a FairPlay GUID.
28
+            // It should look like a FairPlay GUID.
28 29
             // It is built with a certain logic too, but IIRC it's basically hashes all the way.
29 30
             // device_uuid: "00000000.00000000.00000000.00000000.00000000.00000000.00000000".to_string(),
30 31
 
... ...
@@ -33,9 +34,9 @@ fn build_device() -> Device {
33 34
         }
34 35
     } else {
35 36
         Device {
36
-            device_model: "MacBookPro13,2".to_string(),
37
-            operating_system_information: "macOS;15.6.1;24G90".to_string(),
38
-            device_uuid: "A8B31C86-359B-4D95-8950-BA5DD8FFC46F".to_string(),
37
+            device_model: "Mac16,8".to_string(),
38
+            operating_system_information: "macOS;15.7.3;24G419".to_string(),
39
+            device_uuid: "229B41B5-93B0-5632-9E1A-D4EF0669C3C1".to_string(),
39 40
         }
40 41
     }
41 42
 }
... ...
@@ -188,7 +189,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
188 189
 
189 190
     #[cfg(not(any(target_os = "windows", target_os = "macos")))]
190 191
     let proxy = {
191
-        let core_adi_data = fs::read("nodistrib/lib/x86_64/libCoreADI.so")?;
192
+        let core_adi_data = fs::read("nodistrib/lib/arm64-v8a/libCoreADI.so")?;
192 193
         let proxy = AndroidCoreADIProxy::load_library(core_adi_data)?;
193 194
         core_adi::CoreADIADIProxy::initialize(&proxy)?;
194 195
         proxy.set_android_id("0123456789012345")?;
... ...
@@ -129,6 +129,7 @@ impl<'a, 'b> XcodeSession<'a, 'b> {
129 129
             .body(plist_to_body(base_request.into()))
130 130
             .send()
131 131
             .await?
132
+            .error_for_status()?
132 133
             .bytes()
133 134
             .await?;
134 135
 
135 136