wreq 1.3.2.1 → 1.3.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Cargo.lock +40 -52
- data/Cargo.toml +11 -8
- data/README.md +12 -5
- data/VERSION +1 -1
- data/crates/README.md +5 -0
- data/crates/wreq-util/Cargo.toml +1 -0
- data/crates/wreq-util/src/emulate/macros.rs +31 -197
- data/crates/wreq-util/src/emulate/profile/chromium/chrome.rs +731 -0
- data/crates/wreq-util/src/emulate/profile/chromium/edge.rs +418 -0
- data/crates/wreq-util/src/emulate/profile/chromium/header.rs +74 -0
- data/crates/wreq-util/src/emulate/profile/chromium/http2.rs +59 -0
- data/crates/wreq-util/src/emulate/profile/chromium/opera.rs +312 -0
- data/crates/wreq-util/src/emulate/profile/{chrome → chromium}/tls.rs +146 -137
- data/crates/wreq-util/src/emulate/profile/chromium.rs +9 -0
- data/crates/wreq-util/src/emulate/profile/firefox/header.rs +48 -54
- data/crates/wreq-util/src/emulate/profile/firefox/http2.rs +92 -102
- data/crates/wreq-util/src/emulate/profile/firefox/tls.rs +155 -146
- data/crates/wreq-util/src/emulate/profile/firefox.rs +312 -440
- data/crates/wreq-util/src/emulate/profile.rs +5 -7
- data/crates/wreq-util/src/emulate.rs +34 -1
- data/crates/wreq-util/tests/client.rs +187 -46
- data/crates/wreq-util/tests/emulate_chrome.rs +17 -0
- data/crates/wreq-util/tests/emulate_firefox.rs +15 -0
- data/crates/wreq-util/tests/emulate_opera.rs +24 -0
- data/lib/wreq_ruby/emulate.rb +28 -0
- data/src/emulate.rs +28 -5
- data/test/emulation_client_hello_test.rb +142 -0
- data/test/emulation_test.rb +21 -104
- data/wreq.gemspec +1 -1
- metadata +11 -10
- data/crates/wreq-util/src/emulate/profile/chrome/header.rs +0 -116
- data/crates/wreq-util/src/emulate/profile/chrome/http2.rs +0 -65
- data/crates/wreq-util/src/emulate/profile/chrome.rs +0 -2269
- data/crates/wreq-util/src/emulate/profile/opera/header.rs +0 -29
- data/crates/wreq-util/src/emulate/profile/opera/http2.rs +0 -50
- data/crates/wreq-util/src/emulate/profile/opera/tls.rs +0 -103
- data/crates/wreq-util/src/emulate/profile/opera.rs +0 -299
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cc190acbbd70c1403c163513ddb2f581ad545fda507b8cf883d61b5788de548d
|
|
4
|
+
data.tar.gz: 976514bd19cc1fa386219ab267e1cc2b219e6c0b38f09d91d9d559e7013bf27d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: be30774979b7bb61ab6dd1b12a76013566fd967e41a62060075f6058b4dcfb7975caa3b310e2b55e99cfc194b6bd1645d7938939b71b3a450e931153f0c49a9a
|
|
7
|
+
data.tar.gz: 7b9d1d54f1b736c39e0c5122f01e77965d4d2972ee8555185782e96dd608ddf0d6f82d1869533c941a6f81e129e14080be086984d1bbc9d354a2f4d406ef3cfc
|
data/Cargo.lock
CHANGED
|
@@ -124,7 +124,7 @@ dependencies = [
|
|
|
124
124
|
[[package]]
|
|
125
125
|
name = "btls"
|
|
126
126
|
version = "0.5.6"
|
|
127
|
-
source = "git+https://github.com/0x676e67/btls?
|
|
127
|
+
source = "git+https://github.com/0x676e67/btls?branch=main#8879c026b548c25441f83ff58b39d7e22ba1b5b1"
|
|
128
128
|
dependencies = [
|
|
129
129
|
"bitflags",
|
|
130
130
|
"btls-sys",
|
|
@@ -136,7 +136,7 @@ dependencies = [
|
|
|
136
136
|
[[package]]
|
|
137
137
|
name = "btls-sys"
|
|
138
138
|
version = "0.5.6"
|
|
139
|
-
source = "git+https://github.com/0x676e67/btls?
|
|
139
|
+
source = "git+https://github.com/0x676e67/btls?branch=main#8879c026b548c25441f83ff58b39d7e22ba1b5b1"
|
|
140
140
|
dependencies = [
|
|
141
141
|
"bindgen 0.73.2",
|
|
142
142
|
"cmake",
|
|
@@ -483,7 +483,7 @@ dependencies = [
|
|
|
483
483
|
[[package]]
|
|
484
484
|
name = "http2"
|
|
485
485
|
version = "0.5.20"
|
|
486
|
-
source = "git+https://github.com/0x676e67/http2?
|
|
486
|
+
source = "git+https://github.com/0x676e67/http2?branch=master#3219d38910c22105ea7fc5464696f26589432e9c"
|
|
487
487
|
dependencies = [
|
|
488
488
|
"atomic-waker",
|
|
489
489
|
"bytes",
|
|
@@ -610,9 +610,9 @@ dependencies = [
|
|
|
610
610
|
|
|
611
611
|
[[package]]
|
|
612
612
|
name = "indexmap"
|
|
613
|
-
version = "2.14.
|
|
613
|
+
version = "2.14.2"
|
|
614
614
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
615
|
-
checksum = "
|
|
615
|
+
checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855"
|
|
616
616
|
dependencies = [
|
|
617
617
|
"equivalent",
|
|
618
618
|
"hashbrown",
|
|
@@ -699,9 +699,9 @@ dependencies = [
|
|
|
699
699
|
|
|
700
700
|
[[package]]
|
|
701
701
|
name = "magnus"
|
|
702
|
-
version = "0.
|
|
702
|
+
version = "0.9.4"
|
|
703
703
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
704
|
-
checksum = "
|
|
704
|
+
checksum = "3c5f2dd2017d172e2fde9969a35f10f1374a4dd79b37a17f1847f83201883de7"
|
|
705
705
|
dependencies = [
|
|
706
706
|
"bytes",
|
|
707
707
|
"magnus-macros",
|
|
@@ -712,9 +712,9 @@ dependencies = [
|
|
|
712
712
|
|
|
713
713
|
[[package]]
|
|
714
714
|
name = "magnus-macros"
|
|
715
|
-
version = "0.
|
|
715
|
+
version = "0.9.1"
|
|
716
716
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
717
|
-
checksum = "
|
|
717
|
+
checksum = "9dafde2eeb66f090e0f326112323eb8324b12cb32b5d1210e541d3df6b0ce77e"
|
|
718
718
|
dependencies = [
|
|
719
719
|
"proc-macro2",
|
|
720
720
|
"quote",
|
|
@@ -760,6 +760,25 @@ dependencies = [
|
|
|
760
760
|
"windows-sys",
|
|
761
761
|
]
|
|
762
762
|
|
|
763
|
+
[[package]]
|
|
764
|
+
name = "netty"
|
|
765
|
+
version = "0.2.5"
|
|
766
|
+
source = "git+https://github.com/0x676e67/netty?branch=main#314db585d85e7ea9c15535f458e7324b800fc702"
|
|
767
|
+
dependencies = [
|
|
768
|
+
"bytes",
|
|
769
|
+
"futures-channel",
|
|
770
|
+
"futures-util",
|
|
771
|
+
"http",
|
|
772
|
+
"http-body",
|
|
773
|
+
"http2",
|
|
774
|
+
"httparse",
|
|
775
|
+
"pin-project-lite",
|
|
776
|
+
"smallvec",
|
|
777
|
+
"tokio",
|
|
778
|
+
"tokio-util",
|
|
779
|
+
"want",
|
|
780
|
+
]
|
|
781
|
+
|
|
763
782
|
[[package]]
|
|
764
783
|
name = "nom"
|
|
765
784
|
version = "7.1.3"
|
|
@@ -869,18 +888,18 @@ checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"
|
|
|
869
888
|
|
|
870
889
|
[[package]]
|
|
871
890
|
name = "rb-sys"
|
|
872
|
-
version = "0.9.
|
|
891
|
+
version = "0.9.130"
|
|
873
892
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
874
|
-
checksum = "
|
|
893
|
+
checksum = "02faf625bb10ba893e3ae620f19c9fb1b5f8fcae0fe4eb86bb3f2230fad75edb"
|
|
875
894
|
dependencies = [
|
|
876
895
|
"rb-sys-build",
|
|
877
896
|
]
|
|
878
897
|
|
|
879
898
|
[[package]]
|
|
880
899
|
name = "rb-sys-build"
|
|
881
|
-
version = "0.9.
|
|
900
|
+
version = "0.9.130"
|
|
882
901
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
883
|
-
checksum = "
|
|
902
|
+
checksum = "05be6f9c86fe5482808162826f6c047d093b3670582296c770de1d94f8066694"
|
|
884
903
|
dependencies = [
|
|
885
904
|
"bindgen 0.72.1",
|
|
886
905
|
"lazy_static",
|
|
@@ -1020,10 +1039,11 @@ dependencies = [
|
|
|
1020
1039
|
|
|
1021
1040
|
[[package]]
|
|
1022
1041
|
name = "serde_json"
|
|
1023
|
-
version = "1.0.
|
|
1042
|
+
version = "1.0.154"
|
|
1024
1043
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1025
|
-
checksum = "
|
|
1044
|
+
checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6"
|
|
1026
1045
|
dependencies = [
|
|
1046
|
+
"foldhash",
|
|
1027
1047
|
"indexmap",
|
|
1028
1048
|
"itoa",
|
|
1029
1049
|
"memchr",
|
|
@@ -1209,9 +1229,9 @@ dependencies = [
|
|
|
1209
1229
|
|
|
1210
1230
|
[[package]]
|
|
1211
1231
|
name = "tokio"
|
|
1212
|
-
version = "1.
|
|
1232
|
+
version = "1.54.1"
|
|
1213
1233
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1214
|
-
checksum = "
|
|
1234
|
+
checksum = "b52fd3255258d26fac7264ab5a76b53c13367136dc011d3d6ad4f8ed070396a3"
|
|
1215
1235
|
dependencies = [
|
|
1216
1236
|
"bytes",
|
|
1217
1237
|
"libc",
|
|
@@ -1227,7 +1247,7 @@ dependencies = [
|
|
|
1227
1247
|
[[package]]
|
|
1228
1248
|
name = "tokio-btls"
|
|
1229
1249
|
version = "0.5.6"
|
|
1230
|
-
source = "git+https://github.com/0x676e67/btls?
|
|
1250
|
+
source = "git+https://github.com/0x676e67/btls?branch=main#8879c026b548c25441f83ff58b39d7e22ba1b5b1"
|
|
1231
1251
|
dependencies = [
|
|
1232
1252
|
"btls",
|
|
1233
1253
|
"btls-sys",
|
|
@@ -1430,7 +1450,7 @@ dependencies = [
|
|
|
1430
1450
|
[[package]]
|
|
1431
1451
|
name = "wreq"
|
|
1432
1452
|
version = "0.16.1"
|
|
1433
|
-
source = "git+https://github.com/0x676e67/wreq?
|
|
1453
|
+
source = "git+https://github.com/0x676e67/wreq?branch=main#85d0528f10ceba32ca444d3343b61c291ef8c1d4"
|
|
1434
1454
|
dependencies = [
|
|
1435
1455
|
"btls",
|
|
1436
1456
|
"btls-sys",
|
|
@@ -1448,6 +1468,7 @@ dependencies = [
|
|
|
1448
1468
|
"libc",
|
|
1449
1469
|
"lru",
|
|
1450
1470
|
"mime",
|
|
1471
|
+
"netty",
|
|
1451
1472
|
"percent-encoding",
|
|
1452
1473
|
"pin-project-lite",
|
|
1453
1474
|
"serde",
|
|
@@ -1462,39 +1483,6 @@ dependencies = [
|
|
|
1462
1483
|
"tower",
|
|
1463
1484
|
"tower-http",
|
|
1464
1485
|
"url",
|
|
1465
|
-
"wreq-proto",
|
|
1466
|
-
"wreq-rt",
|
|
1467
|
-
]
|
|
1468
|
-
|
|
1469
|
-
[[package]]
|
|
1470
|
-
name = "wreq-proto"
|
|
1471
|
-
version = "0.2.5"
|
|
1472
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1473
|
-
checksum = "a43942f024bb303f1042c9aa3c87fa1d9149f507c65db6e5220a11ccdb207387"
|
|
1474
|
-
dependencies = [
|
|
1475
|
-
"bytes",
|
|
1476
|
-
"futures-channel",
|
|
1477
|
-
"futures-util",
|
|
1478
|
-
"http",
|
|
1479
|
-
"http-body",
|
|
1480
|
-
"http2",
|
|
1481
|
-
"httparse",
|
|
1482
|
-
"pin-project-lite",
|
|
1483
|
-
"smallvec",
|
|
1484
|
-
"tokio",
|
|
1485
|
-
"tokio-util",
|
|
1486
|
-
"want",
|
|
1487
|
-
]
|
|
1488
|
-
|
|
1489
|
-
[[package]]
|
|
1490
|
-
name = "wreq-rt"
|
|
1491
|
-
version = "0.2.2-rc.4"
|
|
1492
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1493
|
-
checksum = "99e9bce67a3fa3dd3f1503f066d86661c9caf399a763d3bd184da7afaf886c8b"
|
|
1494
|
-
dependencies = [
|
|
1495
|
-
"pin-project-lite",
|
|
1496
|
-
"tokio",
|
|
1497
|
-
"wreq-proto",
|
|
1498
1486
|
]
|
|
1499
1487
|
|
|
1500
1488
|
[[package]]
|
data/Cargo.toml
CHANGED
|
@@ -6,7 +6,7 @@ homepage = "https://github.com/SearchApi/wreq-ruby"
|
|
|
6
6
|
repository = "https://github.com/SearchApi/wreq-ruby"
|
|
7
7
|
edition = "2024"
|
|
8
8
|
version = "1.3.2"
|
|
9
|
-
rust-version = "1.
|
|
9
|
+
rust-version = "1.100"
|
|
10
10
|
|
|
11
11
|
[lib]
|
|
12
12
|
crate-type = ["cdylib"]
|
|
@@ -14,12 +14,13 @@ doc = false
|
|
|
14
14
|
name = "wreq_ruby"
|
|
15
15
|
|
|
16
16
|
[dependencies]
|
|
17
|
-
magnus = { version = "0.
|
|
17
|
+
magnus = { version = "0.9.0", features = ["bytes"] }
|
|
18
18
|
rb-sys = { version = "0.9.128", default-features = false }
|
|
19
19
|
tokio = { version = "1.53.1", features = ["full"] }
|
|
20
20
|
# Keep the existing trust store independent of wreq's default feature selection.
|
|
21
21
|
wreq = { version = "0.16.1", default-features = false, features = [
|
|
22
22
|
"tokio-rt",
|
|
23
|
+
"http2",
|
|
23
24
|
"chromium-roots",
|
|
24
25
|
"query",
|
|
25
26
|
"form",
|
|
@@ -53,7 +54,7 @@ futures-util = { version = "0.3.33", default-features = false }
|
|
|
53
54
|
forkguard = { version = "0.1.3", features = ["atfork"] }
|
|
54
55
|
|
|
55
56
|
[dev-dependencies]
|
|
56
|
-
magnus = { version = "0.
|
|
57
|
+
magnus = { version = "0.9.0", features = ["embed"] }
|
|
57
58
|
|
|
58
59
|
[build-dependencies]
|
|
59
60
|
rb-sys-env = "0.2.2"
|
|
@@ -67,9 +68,11 @@ opt-level = 3
|
|
|
67
68
|
strip = true
|
|
68
69
|
|
|
69
70
|
[patch.crates-io]
|
|
70
|
-
|
|
71
|
-
btls = { git = "https://github.com/0x676e67/btls",
|
|
72
|
-
btls-sys = { git = "https://github.com/0x676e67/btls",
|
|
73
|
-
tokio-btls = { git = "https://github.com/0x676e67/btls",
|
|
74
|
-
|
|
71
|
+
# Match the Git patches used by wreq main; Cargo.lock pins the exact revisions.
|
|
72
|
+
btls = { git = "https://github.com/0x676e67/btls", branch = "main" }
|
|
73
|
+
btls-sys = { git = "https://github.com/0x676e67/btls", branch = "main" }
|
|
74
|
+
tokio-btls = { git = "https://github.com/0x676e67/btls", branch = "main" }
|
|
75
|
+
http2 = { git = "https://github.com/0x676e67/http2", branch = "master" }
|
|
76
|
+
netty = { git = "https://github.com/0x676e67/netty", branch = "main" }
|
|
77
|
+
wreq = { git = "https://github.com/0x676e67/wreq", branch = "main" }
|
|
75
78
|
wreq-util = { path = "crates/wreq-util" }
|
data/README.md
CHANGED
|
@@ -89,14 +89,21 @@ Most browser device models share identical TLS and HTTP/2 configurations, differ
|
|
|
89
89
|
- <details>
|
|
90
90
|
<summary>Available browser emulations</summary>
|
|
91
91
|
|
|
92
|
+
Edge 149–158 provide request-header presets for Windows, macOS, Linux, Android, and iOS.
|
|
93
|
+
Firefox 153–160 provide Android and iPhone presets for `User-Agent` and `Accept-Language`.
|
|
94
|
+
Both use the same TLS and HTTP/2 settings as the corresponding desktop Firefox preset.
|
|
95
|
+
Opera 116–140 provide desktop request-header presets for Windows, macOS, and Linux.
|
|
96
|
+
|
|
92
97
|
| **Browser** | **Versions** |
|
|
93
98
|
| ----------- | ------------ |
|
|
94
|
-
| **Chrome** | `Chrome100`, `Chrome101`, `Chrome104`, `Chrome105`, `Chrome106`, `Chrome107`, `Chrome108`, `Chrome109`, `Chrome110`, `Chrome114`, `Chrome116`, `Chrome117`, `Chrome118`, `Chrome119`, `Chrome120`, `Chrome123`, `Chrome124`, `Chrome126`, `Chrome127`, `Chrome128`, `Chrome129`, `Chrome130`, `Chrome131`, `Chrome132`, `Chrome133`, `Chrome134`, `Chrome135`, `Chrome136`, `Chrome137`, `Chrome138`, `Chrome139`, `Chrome140`, `Chrome141`, `Chrome142`, `Chrome143`, `Chrome144`, `Chrome145`, `Chrome146`, `Chrome147`, `Chrome148`, `Chrome149`, `Chrome150`, `Chrome151`, `Chrome152`, `Chrome153`, `Chrome154`, `Chrome155`, `Chrome156`, `Chrome157` |
|
|
95
|
-
| **Edge** | `Edge101`, `Edge122`, `Edge127`, `Edge131`, `Edge134
|
|
96
|
-
| **Firefox** | `Firefox109`, `Firefox117`, `Firefox128`, `Firefox133`, `Firefox135`, `FirefoxPrivate135`, `FirefoxAndroid135`, `Firefox136`, `FirefoxPrivate136`, `Firefox139`, `Firefox142`, `Firefox143`, `Firefox144`, `Firefox145`, `Firefox146`, `Firefox147`, `Firefox148`, `Firefox149`, `Firefox150`, `Firefox151`, `Firefox152` |
|
|
99
|
+
| **Chrome** | `Chrome100`, `Chrome101`, `Chrome104`, `Chrome105`, `Chrome106`, `Chrome107`, `Chrome108`, `Chrome109`, `Chrome110`, `Chrome114`, `Chrome116`, `Chrome117`, `Chrome118`, `Chrome119`, `Chrome120`, `Chrome123`, `Chrome124`, `Chrome126`, `Chrome127`, `Chrome128`, `Chrome129`, `Chrome130`, `Chrome131`, `Chrome132`, `Chrome133`, `Chrome134`, `Chrome135`, `Chrome136`, `Chrome137`, `Chrome138`, `Chrome139`, `Chrome140`, `Chrome141`, `Chrome142`, `Chrome143`, `Chrome144`, `Chrome145`, `Chrome146`, `Chrome147`, `Chrome148`, `Chrome149`, `Chrome150`, `Chrome151`, `Chrome152`, `Chrome153`, `Chrome154`, `Chrome155`, `Chrome156`, `Chrome157`, `Chrome158` |
|
|
100
|
+
| **Edge** | `Edge101`, `Edge122`, `Edge127`, `Edge131`, `Edge134`–`Edge158` |
|
|
101
|
+
| **Firefox** | `Firefox109`, `Firefox117`, `Firefox128`, `Firefox133`, `Firefox135`, `FirefoxPrivate135`, `FirefoxAndroid135`, `Firefox136`, `FirefoxPrivate136`, `Firefox139`, `Firefox142`, `Firefox143`, `Firefox144`, `Firefox145`, `Firefox146`, `Firefox147`, `Firefox148`, `Firefox149`, `Firefox150`, `Firefox151`, `Firefox152`, `Firefox153`–`Firefox160` |
|
|
97
102
|
| **Safari** | `Safari15_3`, `Safari15_5`, `Safari15_6_1`, `Safari16`, `Safari16_5`, `Safari17_0`, `Safari17_2_1`, `Safari17_4_1`, `Safari17_5`, `Safari17_6`, `Safari18`, `Safari18_2`, `Safari18_3`, `Safari18_3_1`, `Safari18_5`, `Safari26`, `Safari26_1`, `Safari26_2`, `SafariIos16_5`, `SafariIos17_2`, `SafariIos17_4_1`, `SafariIos18_1_1`, `SafariIos26`, `SafariIos26_2`, `SafariIPad18`, `SafariIPad26`, `SafariIpad26_2` |
|
|
98
|
-
| **OkHttp** | `
|
|
99
|
-
| **Opera** | `Opera116
|
|
103
|
+
| **OkHttp** | `OkHttp3_9`, `OkHttp3_11`, `OkHttp3_13`, `OkHttp3_14`, `OkHttp4_9`, `OkHttp4_10`, `OkHttp4_12`, `OkHttp5` |
|
|
104
|
+
| **Opera** | `Opera116`–`Opera140` |
|
|
105
|
+
|
|
106
|
+
Opera 132–140 use the corresponding Chromium desktop TLS and HTTP/2 defaults with Opera-branded request headers.
|
|
100
107
|
|
|
101
108
|
</details>
|
|
102
109
|
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.3.2.
|
|
1
|
+
1.3.2.3
|
data/crates/README.md
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# Local Rust dependencies
|
|
2
|
+
|
|
3
|
+
- [`wreq-util`](wreq-util/) is a local copy of [0x676e67/wreq-util](https://github.com/0x676e67/wreq-util). The root [`Cargo.toml`](../Cargo.toml) resolves it from `crates/wreq-util` through `[patch.crates-io]`.
|
|
4
|
+
|
|
5
|
+
When building or testing `wreq-util` on its own, use the Git dependency patches from the root manifest of the same branch. Cargo does not inherit those patches from the parent package.
|
data/crates/wreq-util/Cargo.toml
CHANGED
|
@@ -84,103 +84,6 @@ macro_rules! define_enum {
|
|
|
84
84
|
};
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
macro_rules! header_chrome_sec_ch_ua {
|
|
88
|
-
($headers:expr, $ua:expr, $platform:expr, $is_mobile:expr) => {
|
|
89
|
-
let mobile = if $is_mobile { "?1" } else { "?0" };
|
|
90
|
-
$headers.insert("sec-ch-ua", HeaderValue::from_static($ua));
|
|
91
|
-
$headers.insert("sec-ch-ua-mobile", HeaderValue::from_static(mobile));
|
|
92
|
-
$headers.insert("sec-ch-ua-platform", HeaderValue::from_static($platform));
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
macro_rules! header_chrome_sec_fetch {
|
|
97
|
-
($headers:expr) => {
|
|
98
|
-
$headers.insert("sec-fetch-site", HeaderValue::from_static("none"));
|
|
99
|
-
$headers.insert("sec-fetch-mode", HeaderValue::from_static("navigate"));
|
|
100
|
-
$headers.insert("sec-fetch-user", HeaderValue::from_static("?1"));
|
|
101
|
-
$headers.insert("sec-fetch-dest", HeaderValue::from_static("document"));
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
macro_rules! header_chrome_ua {
|
|
106
|
-
($headers:expr, $ua:expr) => {
|
|
107
|
-
$headers.insert(USER_AGENT, HeaderValue::from_static($ua));
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
macro_rules! header_chrome_accept {
|
|
112
|
-
($headers:expr) => {
|
|
113
|
-
$headers.insert(ACCEPT, HeaderValue::from_static("text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"));
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
macro_rules! header_chrome_accept_encoding {
|
|
118
|
-
($headers:expr) => {
|
|
119
|
-
#[cfg(feature = "emulation-compression")]
|
|
120
|
-
$headers.insert(
|
|
121
|
-
ACCEPT_ENCODING,
|
|
122
|
-
HeaderValue::from_static("gzip, deflate, br"),
|
|
123
|
-
);
|
|
124
|
-
$headers.insert(ACCEPT_LANGUAGE, HeaderValue::from_static("en-US,en;q=0.9"));
|
|
125
|
-
};
|
|
126
|
-
(zstd, $headers:expr) => {
|
|
127
|
-
#[cfg(feature = "emulation-compression")]
|
|
128
|
-
$headers.insert(
|
|
129
|
-
ACCEPT_ENCODING,
|
|
130
|
-
HeaderValue::from_static("gzip, deflate, br, zstd"),
|
|
131
|
-
);
|
|
132
|
-
$headers.insert(ACCEPT_LANGUAGE, HeaderValue::from_static("en-US,en;q=0.9"));
|
|
133
|
-
};
|
|
134
|
-
(zstd_only, $headers:expr) => {
|
|
135
|
-
#[cfg(feature = "emulation-compression")]
|
|
136
|
-
$headers.insert(
|
|
137
|
-
ACCEPT_ENCODING,
|
|
138
|
-
HeaderValue::from_static("gzip, deflate, br, zstd"),
|
|
139
|
-
);
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
macro_rules! header_firefox_sec_fetch {
|
|
144
|
-
($headers:expr) => {
|
|
145
|
-
$headers.insert("sec-fetch-dest", HeaderValue::from_static("document"));
|
|
146
|
-
$headers.insert("sec-fetch-mode", HeaderValue::from_static("navigate"));
|
|
147
|
-
$headers.insert("sec-fetch-site", HeaderValue::from_static("none"));
|
|
148
|
-
$headers.insert("sec-fetch-user", HeaderValue::from_static("?1"));
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
macro_rules! header_firefox_accept {
|
|
153
|
-
($headers:expr) => {
|
|
154
|
-
header_firefox_accept!(@build $headers, "en-US,en;q=0.5", "gzip, deflate, br");
|
|
155
|
-
};
|
|
156
|
-
(zstd, $headers:expr) => {
|
|
157
|
-
header_firefox_accept!(@build $headers, "en-US,en;q=0.5", "gzip, deflate, br, zstd");
|
|
158
|
-
};
|
|
159
|
-
// Firefox 147 changed the generated q-value from dividing 1.0 across the list to
|
|
160
|
-
// decrementing by 0.1 per entry, so a two-entry list became q=0.9 (Bugzilla 2000765,
|
|
161
|
-
// landed in 0e050ae5116d).
|
|
162
|
-
(zstd_q09, $headers:expr) => {
|
|
163
|
-
header_firefox_accept!(@build $headers, "en-US,en;q=0.9", "gzip, deflate, br, zstd");
|
|
164
|
-
};
|
|
165
|
-
(@build $headers:expr, $accept_language:expr, $accept_encoding:expr) => {
|
|
166
|
-
$headers.insert(
|
|
167
|
-
ACCEPT,
|
|
168
|
-
HeaderValue::from_static(
|
|
169
|
-
"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
|
170
|
-
),
|
|
171
|
-
);
|
|
172
|
-
$headers.insert(ACCEPT_LANGUAGE, HeaderValue::from_static($accept_language));
|
|
173
|
-
#[cfg(feature = "emulation-compression")]
|
|
174
|
-
$headers.insert(ACCEPT_ENCODING, HeaderValue::from_static($accept_encoding));
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
macro_rules! header_firefox_ua {
|
|
179
|
-
($headers:expr, $ua:expr) => {
|
|
180
|
-
$headers.insert(USER_AGENT, HeaderValue::from_static($ua));
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
|
|
184
87
|
macro_rules! join {
|
|
185
88
|
($sep:expr, $first:expr $(, $rest:expr)*) => {
|
|
186
89
|
concat!($first $(, $sep, $rest)*)
|
|
@@ -231,84 +134,22 @@ macro_rules! fixed_headers {
|
|
|
231
134
|
macro_rules! platform_headers {
|
|
232
135
|
(
|
|
233
136
|
$emulation:expr,
|
|
234
|
-
$
|
|
235
|
-
|
|
137
|
+
$header_preset:path,
|
|
138
|
+
$brands:literal,
|
|
139
|
+
[($default_os:ident, $default_ua:literal) $(, ($other_os:ident, $other_ua:literal))* $(,)?]
|
|
236
140
|
) => {{
|
|
237
141
|
#[allow(unreachable_patterns)]
|
|
238
142
|
$emulation.headers.then(|| {
|
|
239
|
-
match $emulation.platform {
|
|
240
|
-
$(
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
$emulation.platform,
|
|
245
|
-
),
|
|
246
|
-
)*
|
|
247
|
-
_ => $header_initializer(
|
|
248
|
-
$default_sec_ch_ua,
|
|
249
|
-
$default_ua,
|
|
250
|
-
Platform::$default_os,
|
|
251
|
-
),
|
|
252
|
-
}
|
|
253
|
-
})
|
|
254
|
-
}};
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
macro_rules! firefox_platform_headers {
|
|
258
|
-
($emulation:expr, $header_initializer:ident, [($default_os:ident, $default_ua:tt) $(, ($other_os:ident, $other_ua:tt))*]) => {{
|
|
259
|
-
#[allow(unreachable_patterns)]
|
|
260
|
-
$emulation.headers.then(|| {
|
|
261
|
-
match $emulation.platform {
|
|
262
|
-
$(
|
|
263
|
-
Platform::$other_os => $header_initializer($other_ua),
|
|
264
|
-
)*
|
|
265
|
-
_ => $header_initializer($default_ua),
|
|
266
|
-
}
|
|
143
|
+
let (ua, platform) = match $emulation.platform {
|
|
144
|
+
$( Platform::$other_os => ($other_ua, Platform::$other_os), )*
|
|
145
|
+
_ => ($default_ua, Platform::$default_os),
|
|
146
|
+
};
|
|
147
|
+
($header_preset).build($brands, ua, platform)
|
|
267
148
|
})
|
|
268
149
|
}};
|
|
269
150
|
}
|
|
270
151
|
|
|
271
152
|
macro_rules! mod_generator {
|
|
272
|
-
(
|
|
273
|
-
$mod_name:ident,
|
|
274
|
-
$tls_options:expr,
|
|
275
|
-
$http2_options:expr,
|
|
276
|
-
$header_initializer:ident,
|
|
277
|
-
[($default_os:ident, $default_sec_ch_ua:tt, $default_ua:tt) $(, ($other_os:ident, $other_sec_ch_ua:tt, $other_ua:tt))*]
|
|
278
|
-
) => {
|
|
279
|
-
standard_mod_generator!(
|
|
280
|
-
$mod_name,
|
|
281
|
-
$tls_options,
|
|
282
|
-
$http2_options,
|
|
283
|
-
|emulation: &Emulation| {
|
|
284
|
-
platform_headers!(
|
|
285
|
-
emulation,
|
|
286
|
-
$header_initializer,
|
|
287
|
-
[($default_os, $default_sec_ch_ua, $default_ua) $(, ($other_os, $other_sec_ch_ua, $other_ua))*]
|
|
288
|
-
)
|
|
289
|
-
}
|
|
290
|
-
);
|
|
291
|
-
};
|
|
292
|
-
(
|
|
293
|
-
$mod_name:ident,
|
|
294
|
-
$tls_options:expr,
|
|
295
|
-
$http2_options:expr,
|
|
296
|
-
$header_initializer:ident,
|
|
297
|
-
[($default_os:ident, $default_ua:tt) $(, ($other_os:ident, $other_ua:tt))*]
|
|
298
|
-
) => {
|
|
299
|
-
standard_mod_generator!(
|
|
300
|
-
$mod_name,
|
|
301
|
-
$tls_options,
|
|
302
|
-
$http2_options,
|
|
303
|
-
|emulation: &Emulation| {
|
|
304
|
-
firefox_platform_headers!(
|
|
305
|
-
emulation,
|
|
306
|
-
$header_initializer,
|
|
307
|
-
[($default_os, $default_ua) $(, ($other_os, $other_ua))*]
|
|
308
|
-
)
|
|
309
|
-
}
|
|
310
|
-
);
|
|
311
|
-
};
|
|
312
153
|
(
|
|
313
154
|
$mod_name:ident,
|
|
314
155
|
$tls_options:expr,
|
|
@@ -327,48 +168,41 @@ macro_rules! mod_generator {
|
|
|
327
168
|
$mod_name:ident,
|
|
328
169
|
$build_emulation:expr,
|
|
329
170
|
$header_initializer:ident,
|
|
330
|
-
|
|
171
|
+
$ua:expr
|
|
331
172
|
) => {
|
|
332
173
|
standard_mod_generator!(
|
|
333
174
|
$mod_name,
|
|
334
175
|
$build_emulation,
|
|
335
|
-
|emulation: &Emulation|
|
|
336
|
-
platform_headers!(
|
|
337
|
-
emulation,
|
|
338
|
-
$header_initializer,
|
|
339
|
-
[($default_os, $default_sec_ch_ua, $default_ua) $(, ($other_os, $other_sec_ch_ua, $other_ua))*]
|
|
340
|
-
)
|
|
341
|
-
}
|
|
176
|
+
|emulation: &Emulation| fixed_headers!(emulation, $header_initializer, $ua)
|
|
342
177
|
);
|
|
343
178
|
};
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
macro_rules! chromium_profile {
|
|
344
182
|
(
|
|
345
|
-
$
|
|
346
|
-
$
|
|
347
|
-
$
|
|
348
|
-
|
|
183
|
+
$name:ident,
|
|
184
|
+
tls: $tls:path,
|
|
185
|
+
http2: $http2:path,
|
|
186
|
+
headers: $headers:path,
|
|
187
|
+
brands: $brands:literal,
|
|
188
|
+
$platforms:tt $(,)?
|
|
349
189
|
) => {
|
|
350
190
|
standard_mod_generator!(
|
|
351
|
-
$
|
|
352
|
-
$
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
emulation,
|
|
356
|
-
$header_initializer,
|
|
357
|
-
[($default_os, $default_ua) $(, ($other_os, $other_ua))*]
|
|
358
|
-
)
|
|
359
|
-
}
|
|
191
|
+
$name,
|
|
192
|
+
($tls).build(),
|
|
193
|
+
($http2).build(),
|
|
194
|
+
|emulation: &Emulation| platform_headers!(emulation, $headers, $brands, $platforms)
|
|
360
195
|
);
|
|
361
196
|
};
|
|
362
197
|
(
|
|
363
|
-
$
|
|
364
|
-
$
|
|
365
|
-
$
|
|
366
|
-
$
|
|
198
|
+
$name:ident,
|
|
199
|
+
transport: $transport:path,
|
|
200
|
+
headers: $headers:path,
|
|
201
|
+
brands: $brands:literal,
|
|
202
|
+
$platforms:tt $(,)?
|
|
367
203
|
) => {
|
|
368
|
-
standard_mod_generator!(
|
|
369
|
-
$
|
|
370
|
-
|
|
371
|
-
|emulation: &Emulation| fixed_headers!(emulation, $header_initializer, $ua)
|
|
372
|
-
);
|
|
204
|
+
standard_mod_generator!($name, $transport, |emulation: &Emulation| {
|
|
205
|
+
platform_headers!(emulation, $headers, $brands, $platforms)
|
|
206
|
+
});
|
|
373
207
|
};
|
|
374
208
|
}
|