itsi-server 0.2.13 → 0.2.15

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a511f7da334b54141cfacb97b1dc47f21c88dc2f3942843a39bb113f254c970b
4
- data.tar.gz: d6d0fab60a963cceffabaf545bb31d5b0400dcd966ae33ff280288da9dfb380c
3
+ metadata.gz: 839060ed768988b5230a345dc4820dd16f025d95a0e0392eb01e9e446aa912bb
4
+ data.tar.gz: ddc0c5c09b6d883094b6bfcf62d31a66493928aec61bc9cf4cb82f742f3f99e1
5
5
  SHA512:
6
- metadata.gz: 180375c8dbd4841da13bca51a86d3f28e131cc8e0209935a64d3e8e474bd388b43b4582bc5abf44eea309fe93cd924795509af1122e46cd455081f9c50b03433
7
- data.tar.gz: c9e41ad7eeffc356b9522585ed1709d670419f573e0d1384704365e5ea48d28e5f2c7cd470cae9c4f438f787bc3619f865f19b8b1318da70504c5fa55d8e18ec
6
+ metadata.gz: da0187a1d822b7da1b30ac352fe1914a9f1f791f33674c19511e491576c87c665cba9b86d4f7699bf2c3acc9cf797a457d6b2e273a8831da24ad3f05b60c0e8e
7
+ data.tar.gz: 6e7a8a000821d26e438b2c750ad87011176e75f6341311aeb41dbdc6ef952c70733a3c9d7ddbc9fd500e70287718760e95140b43b2657c6ad23413470d9aa1bf
data/Cargo.lock CHANGED
@@ -17,6 +17,19 @@ version = "2.0.0"
17
17
  source = "registry+https://github.com/rust-lang/crates.io-index"
18
18
  checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627"
19
19
 
20
+ [[package]]
21
+ name = "ahash"
22
+ version = "0.8.11"
23
+ source = "registry+https://github.com/rust-lang/crates.io-index"
24
+ checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011"
25
+ dependencies = [
26
+ "cfg-if",
27
+ "getrandom 0.2.15",
28
+ "once_cell",
29
+ "version_check",
30
+ "zerocopy 0.7.35",
31
+ ]
32
+
20
33
  [[package]]
21
34
  name = "aho-corasick"
22
35
  version = "1.1.3"
@@ -1080,19 +1093,6 @@ dependencies = [
1080
1093
  "slab",
1081
1094
  ]
1082
1095
 
1083
- [[package]]
1084
- name = "generator"
1085
- version = "0.8.4"
1086
- source = "registry+https://github.com/rust-lang/crates.io-index"
1087
- checksum = "cc6bd114ceda131d3b1d665eba35788690ad37f5916457286b32ab6fd3c438dd"
1088
- dependencies = [
1089
- "cfg-if",
1090
- "libc",
1091
- "log",
1092
- "rustversion",
1093
- "windows 0.58.0",
1094
- ]
1095
-
1096
1096
  [[package]]
1097
1097
  name = "generic-array"
1098
1098
  version = "0.14.7"
@@ -1644,7 +1644,7 @@ checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c"
1644
1644
 
1645
1645
  [[package]]
1646
1646
  name = "itsi-server"
1647
- version = "0.2.13"
1647
+ version = "0.2.15"
1648
1648
  dependencies = [
1649
1649
  "argon2",
1650
1650
  "async-channel",
@@ -1674,13 +1674,15 @@ dependencies = [
1674
1674
  "jsonwebtoken",
1675
1675
  "magnus",
1676
1676
  "md5",
1677
- "moka",
1677
+ "memchr",
1678
1678
  "nix",
1679
1679
  "notify",
1680
1680
  "num_cpus",
1681
1681
  "parking_lot",
1682
1682
  "percent-encoding",
1683
+ "phf",
1683
1684
  "pin-project",
1685
+ "quick_cache",
1684
1686
  "rand 0.9.1",
1685
1687
  "rcgen",
1686
1688
  "redis",
@@ -1852,7 +1854,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1852
1854
  checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34"
1853
1855
  dependencies = [
1854
1856
  "cfg-if",
1855
- "windows-targets 0.48.5",
1857
+ "windows-targets 0.52.6",
1856
1858
  ]
1857
1859
 
1858
1860
  [[package]]
@@ -1900,19 +1902,6 @@ version = "0.4.27"
1900
1902
  source = "registry+https://github.com/rust-lang/crates.io-index"
1901
1903
  checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
1902
1904
 
1903
- [[package]]
1904
- name = "loom"
1905
- version = "0.7.2"
1906
- source = "registry+https://github.com/rust-lang/crates.io-index"
1907
- checksum = "419e0dc8046cb947daa77eb95ae174acfbddb7673b4151f56d1eed8e93fbfaca"
1908
- dependencies = [
1909
- "cfg-if",
1910
- "generator",
1911
- "scoped-tls",
1912
- "tracing",
1913
- "tracing-subscriber",
1914
- ]
1915
-
1916
1905
  [[package]]
1917
1906
  name = "magnus"
1918
1907
  version = "0.7.1"
@@ -2016,25 +2005,6 @@ dependencies = [
2016
2005
  "windows-sys 0.52.0",
2017
2006
  ]
2018
2007
 
2019
- [[package]]
2020
- name = "moka"
2021
- version = "0.12.10"
2022
- source = "registry+https://github.com/rust-lang/crates.io-index"
2023
- checksum = "a9321642ca94a4282428e6ea4af8cc2ca4eac48ac7a6a4ea8f33f76d0ce70926"
2024
- dependencies = [
2025
- "crossbeam-channel",
2026
- "crossbeam-epoch",
2027
- "crossbeam-utils",
2028
- "loom",
2029
- "parking_lot",
2030
- "portable-atomic",
2031
- "rustc_version",
2032
- "smallvec",
2033
- "tagptr",
2034
- "thiserror 1.0.69",
2035
- "uuid",
2036
- ]
2037
-
2038
2008
  [[package]]
2039
2009
  name = "multer"
2040
2010
  version = "2.1.0"
@@ -2271,6 +2241,48 @@ version = "2.3.1"
2271
2241
  source = "registry+https://github.com/rust-lang/crates.io-index"
2272
2242
  checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
2273
2243
 
2244
+ [[package]]
2245
+ name = "phf"
2246
+ version = "0.11.3"
2247
+ source = "registry+https://github.com/rust-lang/crates.io-index"
2248
+ checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078"
2249
+ dependencies = [
2250
+ "phf_macros",
2251
+ "phf_shared",
2252
+ ]
2253
+
2254
+ [[package]]
2255
+ name = "phf_generator"
2256
+ version = "0.11.3"
2257
+ source = "registry+https://github.com/rust-lang/crates.io-index"
2258
+ checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d"
2259
+ dependencies = [
2260
+ "phf_shared",
2261
+ "rand 0.8.5",
2262
+ ]
2263
+
2264
+ [[package]]
2265
+ name = "phf_macros"
2266
+ version = "0.11.3"
2267
+ source = "registry+https://github.com/rust-lang/crates.io-index"
2268
+ checksum = "f84ac04429c13a7ff43785d75ad27569f2951ce0ffd30a3321230db2fc727216"
2269
+ dependencies = [
2270
+ "phf_generator",
2271
+ "phf_shared",
2272
+ "proc-macro2",
2273
+ "quote",
2274
+ "syn 2.0.100",
2275
+ ]
2276
+
2277
+ [[package]]
2278
+ name = "phf_shared"
2279
+ version = "0.11.3"
2280
+ source = "registry+https://github.com/rust-lang/crates.io-index"
2281
+ checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5"
2282
+ dependencies = [
2283
+ "siphasher",
2284
+ ]
2285
+
2274
2286
  [[package]]
2275
2287
  name = "pin-project"
2276
2288
  version = "1.1.10"
@@ -2309,12 +2321,6 @@ version = "0.3.32"
2309
2321
  source = "registry+https://github.com/rust-lang/crates.io-index"
2310
2322
  checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c"
2311
2323
 
2312
- [[package]]
2313
- name = "portable-atomic"
2314
- version = "1.11.0"
2315
- source = "registry+https://github.com/rust-lang/crates.io-index"
2316
- checksum = "350e9b48cbc6b0e028b0473b114454c6316e57336ee184ceab6e53f72c178b3e"
2317
-
2318
2324
  [[package]]
2319
2325
  name = "powerfmt"
2320
2326
  version = "0.2.0"
@@ -2327,7 +2333,7 @@ version = "0.2.21"
2327
2333
  source = "registry+https://github.com/rust-lang/crates.io-index"
2328
2334
  checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9"
2329
2335
  dependencies = [
2330
- "zerocopy",
2336
+ "zerocopy 0.8.24",
2331
2337
  ]
2332
2338
 
2333
2339
  [[package]]
@@ -2373,6 +2379,18 @@ dependencies = [
2373
2379
  "unicode-ident",
2374
2380
  ]
2375
2381
 
2382
+ [[package]]
2383
+ name = "quick_cache"
2384
+ version = "0.6.13"
2385
+ source = "registry+https://github.com/rust-lang/crates.io-index"
2386
+ checksum = "287e56aac5a2b4fb25a6fb050961d157635924c8696305a5c937a76f29841a0f"
2387
+ dependencies = [
2388
+ "ahash",
2389
+ "equivalent",
2390
+ "hashbrown",
2391
+ "parking_lot",
2392
+ ]
2393
+
2376
2394
  [[package]]
2377
2395
  name = "quinn"
2378
2396
  version = "0.11.7"
@@ -2745,15 +2763,6 @@ version = "2.1.1"
2745
2763
  source = "registry+https://github.com/rust-lang/crates.io-index"
2746
2764
  checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d"
2747
2765
 
2748
- [[package]]
2749
- name = "rustc_version"
2750
- version = "0.4.1"
2751
- source = "registry+https://github.com/rust-lang/crates.io-index"
2752
- checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92"
2753
- dependencies = [
2754
- "semver",
2755
- ]
2756
-
2757
2766
  [[package]]
2758
2767
  name = "rusticata-macros"
2759
2768
  version = "4.1.0"
@@ -2921,12 +2930,6 @@ dependencies = [
2921
2930
  "libc",
2922
2931
  ]
2923
2932
 
2924
- [[package]]
2925
- name = "semver"
2926
- version = "1.0.26"
2927
- source = "registry+https://github.com/rust-lang/crates.io-index"
2928
- checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0"
2929
-
2930
2933
  [[package]]
2931
2934
  name = "seq-macro"
2932
2935
  version = "0.3.6"
@@ -3092,6 +3095,12 @@ dependencies = [
3092
3095
  "windows-sys 0.48.0",
3093
3096
  ]
3094
3097
 
3098
+ [[package]]
3099
+ name = "siphasher"
3100
+ version = "1.0.1"
3101
+ source = "registry+https://github.com/rust-lang/crates.io-index"
3102
+ checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d"
3103
+
3095
3104
  [[package]]
3096
3105
  name = "slab"
3097
3106
  version = "0.4.9"
@@ -3224,15 +3233,9 @@ dependencies = [
3224
3233
  "memchr",
3225
3234
  "ntapi",
3226
3235
  "rayon",
3227
- "windows 0.57.0",
3236
+ "windows",
3228
3237
  ]
3229
3238
 
3230
- [[package]]
3231
- name = "tagptr"
3232
- version = "0.2.0"
3233
- source = "registry+https://github.com/rust-lang/crates.io-index"
3234
- checksum = "7b2093cf4c8eb1e67749a6762251bc9cd836b6fc171623bd0a9d324d37af2417"
3235
-
3236
3239
  [[package]]
3237
3240
  name = "tap"
3238
3241
  version = "1.0.1"
@@ -3662,15 +3665,6 @@ version = "0.2.2"
3662
3665
  source = "registry+https://github.com/rust-lang/crates.io-index"
3663
3666
  checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
3664
3667
 
3665
- [[package]]
3666
- name = "uuid"
3667
- version = "1.16.0"
3668
- source = "registry+https://github.com/rust-lang/crates.io-index"
3669
- checksum = "458f7a779bf54acc9f347480ac654f68407d3aab21269a6e3c9f922acd9e2da9"
3670
- dependencies = [
3671
- "getrandom 0.3.2",
3672
- ]
3673
-
3674
3668
  [[package]]
3675
3669
  name = "valuable"
3676
3670
  version = "0.1.1"
@@ -3918,16 +3912,6 @@ dependencies = [
3918
3912
  "windows-targets 0.52.6",
3919
3913
  ]
3920
3914
 
3921
- [[package]]
3922
- name = "windows"
3923
- version = "0.58.0"
3924
- source = "registry+https://github.com/rust-lang/crates.io-index"
3925
- checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6"
3926
- dependencies = [
3927
- "windows-core 0.58.0",
3928
- "windows-targets 0.52.6",
3929
- ]
3930
-
3931
3915
  [[package]]
3932
3916
  name = "windows-core"
3933
3917
  version = "0.57.0"
@@ -3940,19 +3924,6 @@ dependencies = [
3940
3924
  "windows-targets 0.52.6",
3941
3925
  ]
3942
3926
 
3943
- [[package]]
3944
- name = "windows-core"
3945
- version = "0.58.0"
3946
- source = "registry+https://github.com/rust-lang/crates.io-index"
3947
- checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99"
3948
- dependencies = [
3949
- "windows-implement 0.58.0",
3950
- "windows-interface 0.58.0",
3951
- "windows-result 0.2.0",
3952
- "windows-strings 0.1.0",
3953
- "windows-targets 0.52.6",
3954
- ]
3955
-
3956
3927
  [[package]]
3957
3928
  name = "windows-core"
3958
3929
  version = "0.61.0"
@@ -3977,17 +3948,6 @@ dependencies = [
3977
3948
  "syn 2.0.100",
3978
3949
  ]
3979
3950
 
3980
- [[package]]
3981
- name = "windows-implement"
3982
- version = "0.58.0"
3983
- source = "registry+https://github.com/rust-lang/crates.io-index"
3984
- checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b"
3985
- dependencies = [
3986
- "proc-macro2",
3987
- "quote",
3988
- "syn 2.0.100",
3989
- ]
3990
-
3991
3951
  [[package]]
3992
3952
  name = "windows-implement"
3993
3953
  version = "0.60.0"
@@ -4010,17 +3970,6 @@ dependencies = [
4010
3970
  "syn 2.0.100",
4011
3971
  ]
4012
3972
 
4013
- [[package]]
4014
- name = "windows-interface"
4015
- version = "0.58.0"
4016
- source = "registry+https://github.com/rust-lang/crates.io-index"
4017
- checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515"
4018
- dependencies = [
4019
- "proc-macro2",
4020
- "quote",
4021
- "syn 2.0.100",
4022
- ]
4023
-
4024
3973
  [[package]]
4025
3974
  name = "windows-interface"
4026
3975
  version = "0.59.1"
@@ -4058,15 +4007,6 @@ dependencies = [
4058
4007
  "windows-targets 0.52.6",
4059
4008
  ]
4060
4009
 
4061
- [[package]]
4062
- name = "windows-result"
4063
- version = "0.2.0"
4064
- source = "registry+https://github.com/rust-lang/crates.io-index"
4065
- checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e"
4066
- dependencies = [
4067
- "windows-targets 0.52.6",
4068
- ]
4069
-
4070
4010
  [[package]]
4071
4011
  name = "windows-result"
4072
4012
  version = "0.3.2"
@@ -4076,16 +4016,6 @@ dependencies = [
4076
4016
  "windows-link",
4077
4017
  ]
4078
4018
 
4079
- [[package]]
4080
- name = "windows-strings"
4081
- version = "0.1.0"
4082
- source = "registry+https://github.com/rust-lang/crates.io-index"
4083
- checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10"
4084
- dependencies = [
4085
- "windows-result 0.2.0",
4086
- "windows-targets 0.52.6",
4087
- ]
4088
-
4089
4019
  [[package]]
4090
4020
  name = "windows-strings"
4091
4021
  version = "0.3.1"
@@ -4388,13 +4318,33 @@ dependencies = [
4388
4318
  "synstructure",
4389
4319
  ]
4390
4320
 
4321
+ [[package]]
4322
+ name = "zerocopy"
4323
+ version = "0.7.35"
4324
+ source = "registry+https://github.com/rust-lang/crates.io-index"
4325
+ checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0"
4326
+ dependencies = [
4327
+ "zerocopy-derive 0.7.35",
4328
+ ]
4329
+
4391
4330
  [[package]]
4392
4331
  name = "zerocopy"
4393
4332
  version = "0.8.24"
4394
4333
  source = "registry+https://github.com/rust-lang/crates.io-index"
4395
4334
  checksum = "2586fea28e186957ef732a5f8b3be2da217d65c5969d4b1e17f973ebbe876879"
4396
4335
  dependencies = [
4397
- "zerocopy-derive",
4336
+ "zerocopy-derive 0.8.24",
4337
+ ]
4338
+
4339
+ [[package]]
4340
+ name = "zerocopy-derive"
4341
+ version = "0.7.35"
4342
+ source = "registry+https://github.com/rust-lang/crates.io-index"
4343
+ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e"
4344
+ dependencies = [
4345
+ "proc-macro2",
4346
+ "quote",
4347
+ "syn 2.0.100",
4398
4348
  ]
4399
4349
 
4400
4350
  [[package]]
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "itsi-scheduler"
3
- version = "0.2.13"
3
+ version = "0.2.15"
4
4
  edition = "2021"
5
5
  authors = ["Wouter Coppieters <wc@pico.net.nz>"]
6
6
  license = "MIT"
@@ -111,7 +111,7 @@ checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
111
111
 
112
112
  [[package]]
113
113
  name = "atty"
114
- version = "0.2.14"
114
+ version = "0.2.15"
115
115
  source = "registry+https://github.com/rust-lang/crates.io-index"
116
116
  checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
117
117
  dependencies = [
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "itsi-server"
3
- version = "0.2.13"
3
+ version = "0.2.15"
4
4
  edition = "2021"
5
5
  authors = ["Wouter Coppieters <wc@pico.net.nz>"]
6
6
  license = "MIT"
@@ -43,7 +43,6 @@ itsi_tracing = { path = "../itsi_tracing" }
43
43
  itsi_acme = { path = "../itsi_acme" }
44
44
  jsonwebtoken = "9.3.1"
45
45
  magnus = { version = "0.7.1", features = ["bytes", "rb-sys"] }
46
- moka = { version = "0.12.10", features = ["sync"] }
47
46
  notify = { version = "8.0.0" }
48
47
  nix = { version = "0.29.0", features = [
49
48
  "socket",
@@ -55,6 +54,7 @@ nix = { version = "0.29.0", features = [
55
54
  num_cpus = "1.16.0"
56
55
  parking_lot = "0.12.3"
57
56
  pin-project = "1.1.9"
57
+ phf = { version = "0.11.3", features = ["macros"] }
58
58
  rand = "0.9.0"
59
59
  rcgen = { version = "0.13.2", features = ["x509-parser", "pem"] }
60
60
  regex = "1.11.1"
@@ -88,3 +88,5 @@ percent-encoding = "2.3.1"
88
88
  sha-crypt = "0.5.0"
89
89
  argon2 = "0.5.3"
90
90
  core_affinity = "0.8.3"
91
+ memchr = "2.7.4"
92
+ quick_cache = "0.6.13"
@@ -1,4 +1,4 @@
1
- use bytes::{Bytes, BytesMut};
1
+ use bytes::{Buf, Bytes, BytesMut};
2
2
  use derive_more::Debug;
3
3
  use futures::stream::{unfold, StreamExt};
4
4
  use http::{
@@ -12,6 +12,7 @@ use hyper_util::rt::TokioIo;
12
12
  use itsi_error::Result;
13
13
  use itsi_tracing::error;
14
14
  use magnus::error::Result as MagnusResult;
15
+ use memchr::{memchr, memchr_iter};
15
16
  use parking_lot::RwLock;
16
17
  use std::{
17
18
  collections::HashMap,
@@ -345,13 +346,54 @@ impl ItsiHttpResponse {
345
346
  let header_name: HeaderName = HeaderName::from_bytes(&name).map_err(|e| {
346
347
  itsi_error::ItsiError::InvalidInput(format!("Invalid header name {:?}: {:?}", name, e))
347
348
  })?;
348
- let header_value = unsafe { HeaderValue::from_maybe_shared_unchecked(value) };
349
349
  if let Some(ref mut resp) = *self.data.response.write() {
350
- resp.headers_mut().append(header_name, header_value);
350
+ let headers_mut = resp.headers_mut();
351
+ self.insert_header(headers_mut, &header_name, value);
351
352
  }
352
353
  Ok(())
353
354
  }
354
355
 
356
+ pub fn insert_header(
357
+ &self,
358
+ headers_mut: &mut HeaderMap,
359
+ header_name: &HeaderName,
360
+ value: Bytes,
361
+ ) {
362
+ static MAX_SPLIT_HEADERS: usize = 100;
363
+
364
+ let mut start = 0usize;
365
+ let mut emitted = 0usize;
366
+
367
+ for idx in memchr_iter(b'\n', &value).chain(std::iter::once(value.len())) {
368
+ if idx == start {
369
+ start += 1;
370
+ continue;
371
+ }
372
+
373
+ let mut part = value.slice(start..idx);
374
+ if part.ends_with(b"\r") {
375
+ part.truncate(part.len() - 1);
376
+ }
377
+ if let Some(&(b' ' | b'\t')) = part.first() {
378
+ part.advance(1);
379
+ }
380
+ if memchr(0, &part).is_some() || part.iter().any(|&b| b < 0x20) {
381
+ warn!("stripped control char from header {:?}", header_name);
382
+ start = idx + 1;
383
+ continue;
384
+ }
385
+
386
+ emitted += 1;
387
+ if emitted > MAX_SPLIT_HEADERS {
388
+ break;
389
+ }
390
+
391
+ let hv = unsafe { HeaderValue::from_maybe_shared_unchecked(part) };
392
+ headers_mut.append(header_name, hv);
393
+ start = idx + 1;
394
+ }
395
+ }
396
+
355
397
  pub fn add_headers(&self, headers: HashMap<Bytes, Vec<Bytes>>) -> MagnusResult<()> {
356
398
  if let Some(ref mut resp) = *self.data.response.write() {
357
399
  let headers_mut = resp.headers_mut();
@@ -363,8 +405,7 @@ impl ItsiHttpResponse {
363
405
  ))
364
406
  })?;
365
407
  for value in values {
366
- let header_value = unsafe { HeaderValue::from_maybe_shared_unchecked(value) };
367
- headers_mut.append(&header_name, header_value);
408
+ self.insert_header(headers_mut, &header_name, value);
368
409
  }
369
410
  }
370
411
  }
@@ -16,10 +16,15 @@ use http::{
16
16
  };
17
17
  use itsi_error::ItsiError;
18
18
  use magnus::error::Result;
19
- use moka::sync::Cache;
19
+ use quick_cache::sync::Cache;
20
20
  use regex::Regex;
21
21
  use serde::Deserialize;
22
- use std::{collections::HashMap, path::PathBuf, sync::OnceLock, time::Duration};
22
+ use std::{
23
+ collections::HashMap,
24
+ path::PathBuf,
25
+ sync::{Arc, OnceLock},
26
+ time::Duration,
27
+ };
23
28
  use tracing::debug;
24
29
 
25
30
  #[derive(Debug, Deserialize)]
@@ -76,10 +81,7 @@ impl MiddlewareLayer for StaticAssets {
76
81
  recheck_interval: Duration::from_secs(self.file_check_interval),
77
82
  serve_hidden_files: self.serve_hidden_files,
78
83
  allowed_extensions: self.allowed_extensions.clone(),
79
- miss_cache: Cache::builder()
80
- .max_capacity(self.max_files_in_memory)
81
- .time_to_live(Duration::from_secs(self.file_check_interval))
82
- .build(),
84
+ miss_cache: Arc::new(Cache::new(self.max_files_in_memory as usize)),
83
85
  })?)
84
86
  .map_err(ItsiError::new)?;
85
87
  Ok(())