aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2024-10-04 18:09:06 +0200
committerGitHub <noreply@github.com>2024-10-04 18:09:06 +0200
commitba2772e31ca062cba5c2b2b881fdb68e0093216e (patch)
tree65b5feb40dd236447742946bbfbe415918d2c559
parentdocs(changelog): resurrection fixes (diff)
downloadsl0ppij-ba2772e31ca062cba5c2b2b881fdb68e0093216e.tar.gz
sl0ppij-ba2772e31ca062cba5c2b2b881fdb68e0093216e.tar.xz
sl0ppij-ba2772e31ca062cba5c2b2b881fdb68e0093216e.zip
fix(http): web requests (#3643)
-rw-r--r--Cargo.lock617
-rw-r--r--zellij-server/src/background_jobs.rs67
-rw-r--r--zellij-utils/Cargo.toml4
-rw-r--r--zellij-utils/src/downloader.rs58
-rw-r--r--zellij-utils/src/lib.rs6
5 files changed, 125 insertions, 627 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 779a9ce0..52dfadc8 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -27,60 +27,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
[[package]]
-name = "aead"
-version = "0.3.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7fc95d1bdb8e6666b2b217308eeeb09f2d6728d104be3e31916cc74d15420331"
-dependencies = [
- "generic-array 0.14.5",
-]
-
-[[package]]
-name = "aes"
-version = "0.6.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "884391ef1066acaa41e766ba8f596341b96e93ce34f9a43e7d24bf0a0eaf0561"
-dependencies = [
- "aes-soft",
- "aesni",
- "cipher",
-]
-
-[[package]]
-name = "aes-gcm"
-version = "0.8.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5278b5fabbb9bd46e24aa69b2fdea62c99088e0a950a9be40e3e0101298f88da"
-dependencies = [
- "aead",
- "aes",
- "cipher",
- "ctr",
- "ghash",
- "subtle",
-]
-
-[[package]]
-name = "aes-soft"
-version = "0.6.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "be14c7498ea50828a38d0e24a765ed2effe92a705885b57d029cd67d45744072"
-dependencies = [
- "cipher",
- "opaque-debug 0.3.0",
-]
-
-[[package]]
-name = "aesni"
-version = "0.10.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ea2e11f5e94c2f7d386164cc2aa1f97823fed6f259e486940a71c174dd01b0ce"
-dependencies = [
- "cipher",
- "opaque-debug 0.3.0",
-]
-
-[[package]]
name = "ahash"
version = "0.8.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -363,12 +309,6 @@ dependencies = [
]
[[package]]
-name = "base-x"
-version = "0.2.11"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4cbbc9d0964165b47557570cce6c952866c2678457aca742aafc9fb771d30270"
-
-[[package]]
name = "base64"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -421,15 +361,6 @@ dependencies = [
[[package]]
name = "block-buffer"
-version = "0.9.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4"
-dependencies = [
- "generic-array 0.14.5",
-]
-
-[[package]]
-name = "block-buffer"
version = "0.10.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
@@ -490,12 +421,6 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
[[package]]
name = "bytes"
-version = "0.5.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38"
-
-[[package]]
-name = "bytes"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9"
@@ -554,7 +479,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "270f1d341a2afc62604f8f688bee4e444d052b7a74c1458dd3aa7efb47d4077f"
dependencies = [
"ambient-authority",
- "rand 0.8.5",
+ "rand",
]
[[package]]
@@ -590,6 +515,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53"
[[package]]
+name = "castaway"
+version = "0.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a2698f953def977c68f935bb0dfa959375ad4638570e969e2f1e9f433cbf1af6"
+
+[[package]]
name = "cc"
version = "1.0.83"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -620,20 +551,11 @@ dependencies = [
"libc",
"num-integer",
"num-traits",
- "time 0.1.44",
+ "time",
"winapi",
]
[[package]]
-name = "cipher"
-version = "0.2.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "12f8e7987cbd042a63249497f41aed09f8e65add917ea6566effbc56578d6801"
-dependencies = [
- "generic-array 0.14.5",
-]
-
-[[package]]
name = "clap"
version = "3.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -774,29 +696,6 @@ dependencies = [
]
[[package]]
-name = "const_fn"
-version = "0.4.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fbdcdcb6d86f71c5e97409ad45898af11cbc995b4ee8112d59095a28d376c935"
-
-[[package]]
-name = "cookie"
-version = "0.14.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "03a5d7b21829bc7b4bf4754a978a241ae54ea55a40f92bb20216e54096f4b951"
-dependencies = [
- "aes-gcm",
- "base64 0.13.0",
- "hkdf",
- "hmac",
- "percent-encoding",
- "rand 0.8.5",
- "sha2 0.9.9",
- "time 0.2.27",
- "version_check",
-]
-
-[[package]]
name = "core-foundation-sys"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -821,12 +720,6 @@ dependencies = [
]
[[package]]
-name = "cpuid-bool"
-version = "0.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dcb25d077389e53838a8158c8e99174c5a9d902dee4904320db714f3c653ffba"
-
-[[package]]
name = "cranelift-bforest"
version = "0.108.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1024,16 +917,6 @@ dependencies = [
]
[[package]]
-name = "crypto-mac"
-version = "0.10.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bff07008ec701e8028e2ceb8f83f0e4274ee62bd2dbdc4fefff2e9a91824081a"
-dependencies = [
- "generic-array 0.14.5",
- "subtle",
-]
-
-[[package]]
name = "csscolorparser"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1054,15 +937,6 @@ dependencies = [
]
[[package]]
-name = "ctr"
-version = "0.6.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fb4a30d54f7443bf3d6191dcd486aca19e67cb3c49fa7a06a319966346707e7f"
-dependencies = [
- "cipher",
-]
-
-[[package]]
name = "curl"
version = "0.4.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1157,15 +1031,6 @@ dependencies = [
[[package]]
name = "digest"
-version = "0.9.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066"
-dependencies = [
- "generic-array 0.14.5",
-]
-
-[[package]]
-name = "digest"
version = "0.10.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
@@ -1237,12 +1102,6 @@ dependencies = [
]
[[package]]
-name = "discard"
-version = "1.0.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0"
-
-[[package]]
name = "dissimilar"
version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1427,17 +1286,6 @@ dependencies = [
]
[[package]]
-name = "flume"
-version = "0.9.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1bebadab126f8120d410b677ed95eee4ba6eb7c6dd8e34a5ec88a08050e26132"
-dependencies = [
- "futures-core",
- "futures-sink",
- "spinning_top",
-]
-
-[[package]]
name = "fnv"
version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1637,17 +1485,6 @@ dependencies = [
[[package]]
name = "getrandom"
-version = "0.1.16"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce"
-dependencies = [
- "cfg-if",
- "libc",
- "wasi 0.9.0+wasi-snapshot-preview1",
-]
-
-[[package]]
-name = "getrandom"
version = "0.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427"
@@ -1658,16 +1495,6 @@ dependencies = [
]
[[package]]
-name = "ghash"
-version = "0.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "97304e4cd182c3846f7575ced3890c53012ce534ad9114046b0a9e00bb30a375"
-dependencies = [
- "opaque-debug 0.3.0",
- "polyval",
-]
-
-[[package]]
name = "ghost"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1787,73 +1614,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3461b968f695ca312b968503261f5a345de0f02a39dbaa3021f20d53b426395d"
[[package]]
-name = "hkdf"
-version = "0.10.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "51ab2f639c231793c5f6114bdb9bbe50a7dbbfcd7c7c6bd8475dec2d991e964f"
-dependencies = [
- "digest 0.9.0",
- "hmac",
-]
-
-[[package]]
-name = "hmac"
-version = "0.10.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c1441c6b1e930e2817404b5046f1f989899143a12bf92de603b69f4e0aee1e15"
-dependencies = [
- "crypto-mac",
- "digest 0.9.0",
-]
-
-[[package]]
name = "http"
version = "0.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482"
dependencies = [
- "bytes 1.6.0",
+ "bytes",
"fnv",
"itoa",
]
[[package]]
-name = "http-client"
-version = "6.5.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1947510dc91e2bf586ea5ffb412caad7673264e14bb39fb9078da114a94ce1a5"
-dependencies = [
- "async-std",
- "async-trait",
- "cfg-if",
- "http-types",
- "isahc",
- "log",
-]
-
-[[package]]
-name = "http-types"
-version = "2.12.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6e9b187a72d63adbfba487f48095306ac823049cb504ee195541e91c7775f5ad"
-dependencies = [
- "anyhow",
- "async-channel",
- "async-std",
- "base64 0.13.0",
- "cookie",
- "futures-lite",
- "infer",
- "pin-project-lite",
- "rand 0.7.3",
- "serde",
- "serde_json",
- "serde_qs",
- "serde_urlencoded",
- "url",
-]
-
-[[package]]
name = "humantime"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1956,12 +1727,6 @@ dependencies = [
]
[[package]]
-name = "infer"
-version = "0.2.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "64e9829a50b42bb782c1df523f78d332fe371b10c661e78b7a3c34b0198e9fac"
-
-[[package]]
name = "inotify"
version = "0.9.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2017,7 +1782,7 @@ dependencies = [
"intmap",
"libc",
"once_cell",
- "rustc_version 0.4.0",
+ "rustc_version",
"spinning",
"thiserror",
"to_method",
@@ -2093,19 +1858,23 @@ checksum = "616cde7c720bb2bb5824a224687d8f77bfd38922027f01d825cd7453be5099fb"
[[package]]
name = "isahc"
-version = "0.9.14"
+version = "1.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e2948a0ce43e2c2ef11d7edf6816508998d99e13badd1150be0914205df9388a"
+checksum = "334e04b4d781f436dc315cb1e7515bd96826426345d498149e4bde36b67f8ee9"
dependencies = [
- "bytes 0.5.6",
+ "async-channel",
+ "castaway",
"crossbeam-utils",
"curl",
"curl-sys",
- "flume",
+ "encoding_rs",
+ "event-listener",
"futures-lite",
"http",
"log",
+ "mime",
"once_cell",
+ "polling",
"slab",
"sluice",
"tracing",
@@ -2477,16 +2246,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
[[package]]
-name = "mime_guess"
-version = "2.0.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef"
-dependencies = [
- "mime",
- "unicase",
-]
-
-[[package]]
name = "minimal-lexical"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2547,7 +2306,7 @@ version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7bddcd3bf5144b6392de80e04c347cd7fab2508f6df16a85fc496ecd5cec39bc"
dependencies = [
- "rand 0.8.5",
+ "rand",
]
[[package]]
@@ -2713,12 +2472,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c"
[[package]]
-name = "opaque-debug"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
-
-[[package]]
name = "openssl-probe"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2937,7 +2690,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1181c94580fa345f50f19d738aaa39c0ed30a600d95cb2d3e23f94266f14fbf"
dependencies = [
"phf_shared",
- "rand 0.8.5",
+ "rand",
]
[[package]]
@@ -3023,17 +2776,6 @@ dependencies = [
]
[[package]]
-name = "polyval"
-version = "0.4.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "eebcc4aa140b9abd2bc40d9c3f7ccec842679cd79045ac3a7ac698c1a064b7cd"
-dependencies = [
- "cpuid-bool",
- "opaque-debug 0.3.0",
- "universal-hash",
-]
-
-[[package]]
name = "postcard"
version = "1.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3095,12 +2837,6 @@ dependencies = [
]
[[package]]
-name = "proc-macro-hack"
-version = "0.5.19"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5"
-
-[[package]]
name = "proc-macro2"
version = "1.0.82"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3115,7 +2851,7 @@ version = "0.11.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd"
dependencies = [
- "bytes 1.6.0",
+ "bytes",
"prost-derive",
]
@@ -3125,7 +2861,7 @@ version = "0.11.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "119533552c9a7ffacc21e099c24a0ac8bb19c2a2a3f363de84cd9b844feab270"
dependencies = [
- "bytes 1.6.0",
+ "bytes",
"heck 0.4.0",
"itertools 0.10.5",
"lazy_static",
@@ -3183,36 +2919,13 @@ dependencies = [
[[package]]
name = "rand"
-version = "0.7.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
-dependencies = [
- "getrandom 0.1.16",
- "libc",
- "rand_chacha 0.2.2",
- "rand_core 0.5.1",
- "rand_hc",
-]
-
-[[package]]
-name = "rand"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
dependencies = [
"libc",
- "rand_chacha 0.3.1",
- "rand_core 0.6.3",
-]
-
-[[package]]
-name = "rand_chacha"
-version = "0.2.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
-dependencies = [
- "ppv-lite86",
- "rand_core 0.5.1",
+ "rand_chacha",
+ "rand_core",
]
[[package]]
@@ -3222,16 +2935,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
dependencies = [
"ppv-lite86",
- "rand_core 0.6.3",
-]
-
-[[package]]
-name = "rand_core"
-version = "0.5.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
-dependencies = [
- "getrandom 0.1.16",
+ "rand_core",
]
[[package]]
@@ -3240,16 +2944,7 @@ version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7"
dependencies = [
- "getrandom 0.2.10",
-]
-
-[[package]]
-name = "rand_hc"
-version = "0.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
-dependencies = [
- "rand_core 0.5.1",
+ "getrandom",
]
[[package]]
@@ -3300,7 +2995,7 @@ version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b"
dependencies = [
- "getrandom 0.2.10",
+ "getrandom",
"redox_syscall 0.2.13",
"thiserror",
]
@@ -3371,15 +3066,6 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
[[package]]
name = "rustc_version"
-version = "0.2.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
-dependencies = [
- "semver 0.9.0",
-]
-
-[[package]]
-name = "rustc_version"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366"
@@ -3448,20 +3134,11 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
[[package]]
name = "semver"
-version = "0.9.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
-dependencies = [
- "semver-parser 0.7.0",
-]
-
-[[package]]
-name = "semver"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6"
dependencies = [
- "semver-parser 0.10.2",
+ "semver-parser",
]
[[package]]
@@ -3472,12 +3149,6 @@ checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed"
[[package]]
name = "semver-parser"
-version = "0.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
-
-[[package]]
-name = "semver-parser"
version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7"
@@ -3527,17 +3198,6 @@ dependencies = [
]
[[package]]
-name = "serde_qs"
-version = "0.8.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c7715380eec75f029a4ef7de39a9200e0a63823176b759d055b613f5a87df6a6"
-dependencies = [
- "percent-encoding",
- "serde",
- "thiserror",
-]
-
-[[package]]
name = "serde_spanned"
version = "0.6.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3547,18 +3207,6 @@ dependencies = [
]
[[package]]
-name = "serde_urlencoded"
-version = "0.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd"
-dependencies = [
- "form_urlencoded",
- "itoa",
- "ryu",
- "serde",
-]
-
-[[package]]
name = "serde_yaml"
version = "0.8.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3592,35 +3240,7 @@ dependencies = [
"block-buffer 0.7.3",
"digest 0.8.1",
"fake-simd",
- "opaque-debug 0.2.3",
-]
-
-[[package]]
-name = "sha1"
-version = "0.6.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c1da05c97445caa12d05e848c4a4fcbbea29e748ac28f7e80e9b010392063770"
-dependencies = [
- "sha1_smol",
-]
-
-[[package]]
-name = "sha1_smol"
-version = "1.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ae1a47186c03a32177042e55dbc5fd5aee900b8e0069a8d70fba96a9375cd012"
-
-[[package]]
-name = "sha2"
-version = "0.9.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800"
-dependencies = [
- "block-buffer 0.9.0",
- "cfg-if",
- "cpufeatures",
- "digest 0.9.0",
- "opaque-debug 0.3.0",
+ "opaque-debug",
]
[[package]]
@@ -3776,15 +3396,6 @@ dependencies = [
]
[[package]]
-name = "spinning_top"
-version = "0.2.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5b9eb1a2f4c41445a3a0ff9abc5221c5fcd28e1f13cd7c0397706f9ac938ddb0"
-dependencies = [
- "lock_api",
-]
-
-[[package]]
name = "sptr"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3809,22 +3420,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
[[package]]
-name = "standback"
-version = "0.2.17"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e113fb6f3de07a243d434a56ec6f186dfd51cb08448239fe7bcae73f87ff28ff"
-dependencies = [
- "version_check",
-]
-
-[[package]]
name = "status-bar"
version = "0.1.0"
dependencies = [
"ansi_term",
"colored",
"lazy_static",
- "rand 0.8.5",
+ "rand",
"regex",
"serde",
"serde_json",
@@ -3835,55 +3437,6 @@ dependencies = [
]
[[package]]
-name = "stdweb"
-version = "0.4.20"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d022496b16281348b52d0e30ae99e01a73d737b2f45d38fed4edf79f9325a1d5"
-dependencies = [
- "discard",
- "rustc_version 0.2.3",
- "stdweb-derive",
- "stdweb-internal-macros",
- "stdweb-internal-runtime",
- "wasm-bindgen",
-]
-
-[[package]]
-name = "stdweb-derive"
-version = "0.5.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef"
-dependencies = [
- "proc-macro2",
- "quote",
- "serde",
- "serde_derive",
- "syn 1.0.96",
-]
-
-[[package]]
-name = "stdweb-internal-macros"
-version = "0.2.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11"
-dependencies = [
- "base-x",
- "proc-macro2",
- "quote",
- "serde",
- "serde_derive",
- "serde_json",
- "sha1",
- "syn 1.0.96",
-]
-
-[[package]]
-name = "stdweb-internal-runtime"
-version = "0.1.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0"
-
-[[package]]
name = "strider"
version = "0.2.0"
dependencies = [
@@ -3933,12 +3486,6 @@ dependencies = [
]
[[package]]
-name = "subtle"
-version = "2.4.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601"
-
-[[package]]
name = "suggest"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3977,27 +3524,6 @@ dependencies = [
]
[[package]]
-name = "surf"
-version = "2.3.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "718b1ae6b50351982dedff021db0def601677f2120938b070eadb10ba4038dd7"
-dependencies = [
- "async-std",
- "async-trait",
- "cfg-if",
- "futures-util",
- "getrandom 0.2.10",
- "http-client",
- "http-types",
- "log",
- "mime_guess",
- "once_cell",
- "pin-project-lite",
- "serde",
- "serde_json",
-]
-
-[[package]]
name = "syn"
version = "1.0.96"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -4146,7 +3672,7 @@ dependencies = [
"pest_derive",
"phf",
"semver 0.11.0",
- "sha2 0.10.8",
+ "sha2",
"signal-hook",
"siphasher",
"tempfile",
@@ -4228,44 +3754,6 @@ dependencies = [
]
[[package]]
-name = "time"
-version = "0.2.27"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4752a97f8eebd6854ff91f1c1824cd6160626ac4bd44287f7f4ea2035a02a242"
-dependencies = [
- "const_fn",
- "libc",
- "standback",
- "stdweb",
- "time-macros",
- "version_check",
- "winapi",
-]
-
-[[package]]
-name = "time-macros"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "957e9c6e26f12cb6d0dd7fc776bb67a706312e7299aed74c8dd5b17ebb27e2f1"
-dependencies = [
- "proc-macro-hack",
- "time-macros-impl",
-]
-
-[[package]]
-name = "time-macros-impl"
-version = "0.1.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fd3c141a1b43194f3f56a1411225df8646c55781d5f26db825b3d98507eb482f"
-dependencies = [
- "proc-macro-hack",
- "proc-macro2",
- "quote",
- "standback",
- "syn 1.0.96",
-]
-
-[[package]]
name = "tinyvec"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -4293,7 +3781,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787"
dependencies = [
"backtrace",
- "bytes 1.6.0",
+ "bytes",
"libc",
"mio 0.8.11",
"num_cpus",
@@ -4434,15 +3922,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c"
[[package]]
-name = "unicase"
-version = "2.6.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6"
-dependencies = [
- "version_check",
-]
-
-[[package]]
name = "unicode-bidi"
version = "0.3.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -4491,16 +3970,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c"
[[package]]
-name = "universal-hash"
-version = "0.4.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9f214e8f697e925001e66ec2c6e37a4ef93f0f78c2eed7814394e10c62025b05"
-dependencies = [
- "generic-array 0.14.5",
- "subtle",
-]
-
-[[package]]
name = "unsafe-any-ors"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -4534,7 +4003,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a"
dependencies = [
"atomic",
- "getrandom 0.2.10",
+ "getrandom",
"serde",
]
@@ -4618,12 +4087,6 @@ dependencies = [
[[package]]
name = "wasi"
-version = "0.9.0+wasi-snapshot-preview1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
-
-[[package]]
-name = "wasi"
version = "0.10.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
@@ -4811,7 +4274,7 @@ dependencies = [
"rustix 0.38.34",
"serde",
"serde_derive",
- "sha2 0.10.8",
+ "sha2",
"toml 0.8.13",
"windows-sys 0.52.0",
"zstd",
@@ -4965,7 +4428,7 @@ dependencies = [
"anyhow",
"async-trait",
"bitflags 2.5.0",
- "bytes 1.6.0",
+ "bytes",
"cap-fs-ext",
"cap-net-ext",
"cap-rand",
@@ -5082,10 +4545,10 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e5a5e0adf7eed68976410def849a4bdab6f6e9f6163f152de9cb89deea9e60b"
dependencies = [
- "getrandom 0.2.10",
+ "getrandom",
"mac_address",
"once_cell",
- "sha2 0.10.8",
+ "sha2",
"thiserror",
"uuid",
]
@@ -5575,7 +5038,7 @@ dependencies = [
"insta",
"log",
"names",
- "rand 0.8.5",
+ "rand",
"regex",
"ssh2",
"suggest",
@@ -5608,7 +5071,7 @@ dependencies = [
"async-trait",
"base64 0.13.0",
"byteorder",
- "bytes 1.6.0",
+ "bytes",
"cassowary",
"chrono",
"close_fds",
@@ -5672,6 +5135,7 @@ dependencies = [
"include_dir",
"insta",
"interprocess",
+ "isahc",
"kdl",
"lazy_static",
"libc",
@@ -5694,7 +5158,6 @@ dependencies = [
"strip-ansi-escapes",
"strum",
"strum_macros",
- "surf",
"tempfile",
"termwiz",
"thiserror",
diff --git a/zellij-server/src/background_jobs.rs b/zellij-server/src/background_jobs.rs
index 1f984536..c293cdb7 100644
--- a/zellij-server/src/background_jobs.rs
+++ b/zellij-server/src/background_jobs.rs
@@ -6,10 +6,10 @@ use zellij_utils::consts::{
use zellij_utils::data::{Event, HttpVerb, SessionInfo};
use zellij_utils::errors::{prelude::*, BackgroundJobContext, ContextType};
use zellij_utils::input::layout::RunPlugin;
-use zellij_utils::surf::{
- http::{Method, Url},
- RequestBuilder,
-};
+
+use zellij_utils::isahc::prelude::*;
+use zellij_utils::isahc::AsyncReadResponseExt;
+use zellij_utils::isahc::{config::RedirectPolicy, HttpClient, Request};
use std::collections::{BTreeMap, HashMap};
use std::fs;
@@ -101,6 +101,12 @@ pub(crate) fn background_jobs_main(
let serialization_interval = serialization_interval.map(|s| s * 1000); // convert to
// milliseconds
+ let http_client = HttpClient::builder()
+ // TODO: timeout?
+ .redirect_policy(RedirectPolicy::Follow)
+ .build()
+ .ok();
+
loop {
let (event, mut err_ctx) = bus.recv().with_context(err_context)?;
err_ctx.add_call(ContextType::BackgroundJob((&event).into()));
@@ -275,41 +281,60 @@ pub(crate) fn background_jobs_main(
BackgroundJob::WebRequest(plugin_id, client_id, url, verb, headers, body, context) => {
task::spawn({
let senders = bus.senders.clone();
+ let http_client = http_client.clone();
async move {
async fn web_request(
url: String,
verb: HttpVerb,
headers: BTreeMap<String, String>,
body: Vec<u8>,
+ http_client: HttpClient,
) -> Result<
(u16, BTreeMap<String, String>, Vec<u8>), // status_code, headers, body
- zellij_utils::surf::Error,
+ zellij_utils::isahc::Error,
> {
- let url = Url::parse(&url)?;
- let http_method = match verb {
- HttpVerb::Get => Method::Get,
- HttpVerb::Post => Method::Post,
- HttpVerb::Put => Method::Put,
- HttpVerb::Delete => Method::Delete,
+ let mut request = match verb {
+ HttpVerb::Get => Request::get(url),
+ HttpVerb::Post => Request::post(url),
+ HttpVerb::Put => Request::put(url),
+ HttpVerb::Delete => Request::delete(url),
};
- let mut req = RequestBuilder::new(http_method, url);
- if !body.is_empty() {
- req = req.body(body);
- }
for (header, value) in headers {
- req = req.header(header.as_str(), value);
+ request = request.header(header.as_str(), value);
}
- let mut res = req.await?;
+ let mut res = if !body.is_empty() {
+ let req = request.body(body)?;
+ http_client.send_async(req).await?
+ } else {
+ let req = request.body(())?;
+ http_client.send_async(req).await?
+ };
+
let status_code = res.status();
let headers: BTreeMap<String, String> = res
+ .headers()
.iter()
- .map(|(name, value)| (name.to_string(), value.to_string()))
+ .filter_map(|(name, value)| match value.to_str() {
+ Ok(value) => Some((name.to_string(), value.to_string())),
+ Err(e) => {
+ log::error!(
+ "Failed to convert header {:?} to string: {:?}",
+ name,
+ e
+ );
+ None
+ },
+ })
.collect();
- let body = res.take_body().into_bytes().await?;
- Ok((status_code as u16, headers, body))
+ let body = res.bytes().await?;
+ Ok((status_code.as_u16(), headers, body))
}
+ let Some(http_client) = http_client else {
+ log::error!("Cannot perform http request, likely due to a misconfigured http client");
+ return;
+ };
- match web_request(url, verb, headers, body).await {
+ match web_request(url, verb, headers, body, http_client).await {
Ok((status, headers, body)) => {
let _ = senders.send_to_plugin(PluginInstruction::Update(vec![(
Some(plugin_id),
diff --git a/zellij-utils/Cargo.toml b/zellij-utils/Cargo.toml
index 94411a15..2fb2d6cb 100644
--- a/zellij-utils/Cargo.toml
+++ b/zellij-utils/Cargo.toml
@@ -56,10 +56,8 @@ async-std = { version = "1.3.0", features = ["unstable", "attributes"] }
notify-debouncer-full = "0.1.0"
humantime = "2.1.0"
futures = "0.3.28"
-surf = { version = "2.3.2", default-features = false, features = [
- "curl-client",
-] }
openssl-sys = { version = "0.9.93", features = ["vendored"] }
+isahc = "1.7.2"
[dev-dependencies]
insta = { version = "1.6.0", features = ["backtrace"] }
diff --git a/zellij-utils/src/downloader.rs b/zellij-utils/src/downloader.rs
index b92a0ff0..e9f447b0 100644
--- a/zellij-utils/src/downloader.rs
+++ b/zellij-utils/src/downloader.rs
@@ -3,15 +3,18 @@ use async_std::{
io::{ReadExt, WriteExt},
stream::StreamExt,
};
+use isahc::prelude::*;
+use isahc::{config::RedirectPolicy, HttpClient, Request};
use std::path::PathBuf;
-use surf::Client;
use thiserror::Error;
use url::Url;
#[derive(Error, Debug)]
pub enum DownloaderError {
#[error("RequestError: {0}")]
- Request(surf::Error),
+ Request(#[from] isahc::Error),
+ #[error("HttpError: {0}")]
+ HttpError(#[from] isahc::http::Error),
#[error("IoError: {0}")]
Io(#[source] std::io::Error),
#[error("File name cannot be found in URL: {0}")]
@@ -22,14 +25,18 @@ pub enum DownloaderError {
#[derive(Debug)]
pub struct Downloader {
- client: Client,
+ client: Option<HttpClient>,
location: PathBuf,
}
impl Default for Downloader {
fn default() -> Self {
Self {
- client: surf::client().with(surf::middleware::Redirect::default()),
+ client: HttpClient::builder()
+ // TODO: timeout?
+ .redirect_policy(RedirectPolicy::Follow)
+ .build()
+ .ok(),
location: PathBuf::from(""),
}
}
@@ -38,7 +45,11 @@ impl Default for Downloader {
impl Downloader {
pub fn new(location: PathBuf) -> Self {
Self {
- client: surf::client().with(surf::middleware::Redirect::default()),
+ client: HttpClient::builder()
+ // TODO: timeout?
+ .redirect_policy(RedirectPolicy::Follow)
+ .build()
+ .ok(),
location,
}
}
@@ -48,17 +59,19 @@ impl Downloader {
url: &str,
file_name: Option<&str>,
) -> Result<(), DownloaderError> {
+ let Some(client) = &self.client else {
+ log::error!("No Http client found, cannot perform requests - this is likely a misconfiguration of isahc::HttpClient");
+ return Ok(());
+ };
let file_name = match file_name {
Some(name) => name.to_string(),
None => self.parse_name(url)?,
};
-
let file_path = self.location.join(file_name.as_str());
if file_path.exists() {
log::debug!("File already exists: {:?}", file_path);
return Ok(());
}
-
let file_part_path = self.location.join(format!("{}.part", file_name));
let (mut target, file_part_size) = {
if file_part_path.exists() {
@@ -86,16 +99,13 @@ impl Downloader {
(file_part, 0)
}
};
-
- let res = self
- .client
- .get(url)
+ let request = Request::get(url)
.header("Content-Type", "application/octet-stream")
.header("Range", format!("bytes={}-", file_part_size))
- .await
- .map_err(|e| DownloaderError::Request(e))?;
-
- let mut stream = res.bytes();
+ .body(())?;
+ let mut res = client.send_async(request).await?;
+ let body = res.body_mut();
+ let mut stream = body.bytes();
while let Some(byte) = stream.next().await {
let byte = byte.map_err(|e| DownloaderError::Io(e))?;
target
@@ -113,17 +123,19 @@ impl Downloader {
Ok(())
}
pub async fn download_without_cache(url: &str) -> Result<String, DownloaderError> {
- // result is the stringified body
- let client = surf::client().with(surf::middleware::Redirect::default());
-
- let res = client
- .get(url)
+ let request = Request::get(url)
.header("Content-Type", "application/octet-stream")
- .await
- .map_err(|e| DownloaderError::Request(e))?;
+ .body(())?;
+ let client = HttpClient::builder()
+ // TODO: timeout?
+ .redirect_policy(RedirectPolicy::Follow)
+ .build()?;
+
+ let mut res = client.send_async(request).await?;
let mut downloaded_bytes: Vec<u8> = vec![];
- let mut stream = res.bytes();
+ let body = res.body_mut();
+ let mut stream = body.bytes();
while let Some(byte) = stream.next().await {
let byte = byte.map_err(|e| DownloaderError::Io(e))?;
downloaded_bytes.push(byte);
diff --git a/zellij-utils/src/lib.rs b/zellij-utils/src/lib.rs
index de5848ec..44d48a5d 100644
--- a/zellij-utils/src/lib.rs
+++ b/zellij-utils/src/lib.rs
@@ -25,9 +25,9 @@ pub mod logging; // Requires log4rs
#[cfg(not(target_family = "wasm"))]
pub use ::{
- anyhow, async_channel, async_std, clap, common_path, humantime, interprocess, lazy_static,
- libc, miette, nix, notify_debouncer_full, regex, serde, signal_hook, surf, tempfile, termwiz,
- url, uuid, vte,
+ anyhow, async_channel, async_std, clap, common_path, humantime, interprocess, isahc,
+ lazy_static, libc, miette, nix, notify_debouncer_full, regex, serde, signal_hook, tempfile,
+ termwiz, url, uuid, vte,
};
pub use ::prost;