diff --git a/Cargo.lock b/Cargo.lock index 87b9a07..faa1cb9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -132,6 +132,19 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +[[package]] +name = "async-compression" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a116f46a969224200a0a97f29cfd4c50e7534e4b4826bd23ea2c3c533039c82c" +dependencies = [ + "flate2", + "futures-core", + "memchr", + "pin-project-lite", + "tokio", +] + [[package]] name = "async-trait" version = "0.1.68" @@ -140,7 +153,7 @@ checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.48", ] [[package]] @@ -306,7 +319,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.48", ] [[package]] @@ -459,7 +472,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.15", + "syn 2.0.48", ] [[package]] @@ -470,7 +483,7 @@ checksum = "29a358ff9f12ec09c3e61fef9b5a9902623a695a46a917b07f269bff1445611a" dependencies = [ "darling_core", "quote", - "syn 2.0.15", + "syn 2.0.48", ] [[package]] @@ -479,6 +492,16 @@ version = "2.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23d8666cb01533c39dde32bcbab8e227b4ed6679b2c925eba05feabea39508fb" +[[package]] +name = "deranged" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +dependencies = [ + "powerfmt", + "serde", +] + [[package]] name = "difflib" version = "0.4.0" @@ -506,6 +529,8 @@ dependencies = [ "futures", "gemini", "gix", + "gix-hash 0.14.1", + "gix-object 0.41.0", "handlebars", "hex", "http", @@ -520,7 +545,7 @@ dependencies = [ "rand 0.8.5", "reqwest", "rust-embed", - "rustls 0.21.1", + "rustls 0.21.10", "serde", "serde_json", "serde_urlencoded", @@ -582,6 +607,18 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "enum-as-inner" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ffccbb6966c05b32ef8fbac435df276c4ae4d3dc55a8cd0eb9745e6c12f546a" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.48", +] + [[package]] name = "env_logger" version = "0.10.0" @@ -622,6 +659,15 @@ dependencies = [ "libc", ] +[[package]] +name = "faster-hex" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2a2b11eda1d40935b26cf18f6833c526845ae8c41e58d09af6adeb6f0269183" +dependencies = [ + "serde", +] + [[package]] name = "fastrand" version = "1.9.0" @@ -685,9 +731,9 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "form_urlencoded" -version = "1.1.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" dependencies = [ "percent-encoding", ] @@ -766,7 +812,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.48", ] [[package]] @@ -844,23 +890,23 @@ version = "0.44.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6bf41b61f7df395284f7a579c0fa1a7e012c5aede655174d4e91299ef1cac643" dependencies = [ - "gix-actor", + "gix-actor 0.20.0", "gix-attributes", "gix-config", "gix-credentials", - "gix-date", + "gix-date 0.5.0", "gix-diff", "gix-discover", - "gix-features", + "gix-features 0.29.0", "gix-fs", "gix-glob", - "gix-hash", + "gix-hash 0.11.1", "gix-hashtable", "gix-ignore", "gix-index", "gix-lock", "gix-mailmap", - "gix-object", + "gix-object 0.29.1", "gix-odb", "gix-pack", "gix-path", @@ -875,7 +921,7 @@ dependencies = [ "gix-traverse", "gix-url", "gix-utils", - "gix-validate", + "gix-validate 0.7.4", "gix-worktree", "log", "once_cell", @@ -894,12 +940,26 @@ checksum = "848efa0f1210cea8638f95691c82a46f98a74b9e3524f01d4955ebc25a8f84f3" dependencies = [ "bstr", "btoi", - "gix-date", + "gix-date 0.5.0", "itoa", "nom 7.1.3", "thiserror", ] +[[package]] +name = "gix-actor" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a7bb9fad6125c81372987c06469601d37e1a2d421511adb69971b9083517a8a" +dependencies = [ + "bstr", + "btoi", + "gix-date 0.8.3", + "itoa", + "thiserror", + "winnow", +] + [[package]] name = "gix-attributes" version = "0.12.0" @@ -952,7 +1012,7 @@ checksum = "1d252a0eddb6df74600d3d8872dc9fe98835a7da43110411d705b682f49d4ac1" dependencies = [ "bstr", "gix-config-value", - "gix-features", + "gix-features 0.29.0", "gix-glob", "gix-path", "gix-ref", @@ -1007,14 +1067,26 @@ dependencies = [ "time", ] +[[package]] +name = "gix-date" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb7f3dfb72bebe3449b5e642be64e3c6ccbe9821c8b8f19f487cf5bfbbf4067e" +dependencies = [ + "bstr", + "itoa", + "thiserror", + "time", +] + [[package]] name = "gix-diff" version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "644a0f2768bc42d7a69289ada80c9e15c589caefc6a315d2307202df83ed1186" dependencies = [ - "gix-hash", - "gix-object", + "gix-hash 0.11.1", + "gix-object 0.29.1", "imara-diff", "thiserror", ] @@ -1027,7 +1099,7 @@ checksum = "1a6b61363e63e7cdaa3e6f96acb0257ebdb3d8883e21eba5930c99f07f0a5fc0" dependencies = [ "bstr", "dunce", - "gix-hash", + "gix-hash 0.11.1", "gix-path", "gix-ref", "gix-sec", @@ -1045,24 +1117,37 @@ dependencies = [ "crc32fast", "crossbeam-channel", "flate2", - "gix-hash", + "gix-hash 0.11.1", "jwalk", "libc", "once_cell", "parking_lot", - "prodash", + "prodash 23.1.2", "sha1_smol", "thiserror", "walkdir", ] +[[package]] +name = "gix-features" +version = "0.38.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "184f7f7d4e45db0e2a362aeaf12c06c5e84817d0ef91d08e8e90170dad9f0b07" +dependencies = [ + "gix-hash 0.14.1", + "gix-trace", + "libc", + "prodash 28.0.0", + "sha1_smol", +] + [[package]] name = "gix-fs" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b37a1832f691fdc09910bd267f9a2e413737c1f9ec68c6e31f9e802616278a9" dependencies = [ - "gix-features", + "gix-features 0.29.0", ] [[package]] @@ -1073,7 +1158,7 @@ checksum = "c07c98204529ac3f24b34754540a852593d2a4c7349008df389240266627a72a" dependencies = [ "bitflags 2.2.1", "bstr", - "gix-features", + "gix-features 0.29.0", "gix-path", ] @@ -1087,13 +1172,23 @@ dependencies = [ "thiserror", ] +[[package]] +name = "gix-hash" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0ed89cdc1dce26685c80271c4287077901de3c3dd90234d5fa47c22b2268653" +dependencies = [ + "faster-hex", + "thiserror", +] + [[package]] name = "gix-hashtable" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "afebb85691c6a085b114e01a27f4a61364519298c5826cb87a45c304802299bc" dependencies = [ - "gix-hash", + "gix-hash 0.11.1", "hashbrown 0.13.2", "parking_lot", ] @@ -1121,10 +1216,10 @@ dependencies = [ "btoi", "filetime", "gix-bitmap", - "gix-features", - "gix-hash", + "gix-features 0.29.0", + "gix-hash 0.11.1", "gix-lock", - "gix-object", + "gix-object 0.29.1", "gix-traverse", "itoa", "memmap2", @@ -1150,7 +1245,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8856cec3bdc3610c06970d28b6cb20a0c6621621cf9a8ec48cbd23f2630f362" dependencies = [ "bstr", - "gix-actor", + "gix-actor 0.20.0", "thiserror", ] @@ -1162,10 +1257,10 @@ checksum = "c9bb30ce0818d37096daa29efe361a4bc6dd0b51a5726598898be7e9a40a01e1" dependencies = [ "bstr", "btoi", - "gix-actor", - "gix-features", - "gix-hash", - "gix-validate", + "gix-actor 0.20.0", + "gix-features 0.29.0", + "gix-hash 0.11.1", + "gix-validate 0.7.4", "hex", "itoa", "nom 7.1.3", @@ -1173,6 +1268,25 @@ dependencies = [ "thiserror", ] +[[package]] +name = "gix-object" +version = "0.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "693ce9d30741506cb082ef2d8b797415b48e032cce0ab23eff894c19a7e4777b" +dependencies = [ + "bstr", + "btoi", + "gix-actor 0.30.0", + "gix-date 0.8.3", + "gix-features 0.38.0", + "gix-hash 0.14.1", + "gix-validate 0.8.3", + "itoa", + "smallvec", + "thiserror", + "winnow", +] + [[package]] name = "gix-odb" version = "0.45.0" @@ -1180,9 +1294,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bca2f324aa67672b6d0f2c0fa93f96eb6a7029d260e4c1df5dce3c015f5e5add" dependencies = [ "arc-swap", - "gix-features", - "gix-hash", - "gix-object", + "gix-features 0.29.0", + "gix-hash 0.11.1", + "gix-object 0.29.1", "gix-pack", "gix-path", "gix-quote", @@ -1200,10 +1314,10 @@ dependencies = [ "clru", "gix-chunk", "gix-diff", - "gix-features", - "gix-hash", + "gix-features 0.29.0", + "gix-hash 0.11.1", "gix-hashtable", - "gix-object", + "gix-object 0.29.1", "gix-path", "gix-tempfile", "gix-traverse", @@ -1259,8 +1373,8 @@ dependencies = [ "bstr", "btoi", "gix-credentials", - "gix-features", - "gix-hash", + "gix-features 0.29.0", + "gix-hash 0.11.1", "gix-transport", "maybe-async", "nom 7.1.3", @@ -1284,15 +1398,15 @@ version = "0.29.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e03989e9d49954368e1b526578230fc7189d1634acdfbe79e9ba1de717e15d5" dependencies = [ - "gix-actor", - "gix-features", + "gix-actor 0.20.0", + "gix-features 0.29.0", "gix-fs", - "gix-hash", + "gix-hash 0.11.1", "gix-lock", - "gix-object", + "gix-object 0.29.1", "gix-path", "gix-tempfile", - "gix-validate", + "gix-validate 0.7.4", "memmap2", "nom 7.1.3", "thiserror", @@ -1305,9 +1419,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0a6ea733820df67e4cd7797deb12727905824d8f5b7c59d943c456d314475892" dependencies = [ "bstr", - "gix-hash", + "gix-hash 0.11.1", "gix-revision", - "gix-validate", + "gix-validate 0.7.4", "smallvec", "thiserror", ] @@ -1319,10 +1433,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "810f35e9afeccca999d5d348b239f9c162353127d2e13ff3240e31b919e35476" dependencies = [ "bstr", - "gix-date", - "gix-hash", + "gix-date 0.5.0", + "gix-hash 0.11.1", "gix-hashtable", - "gix-object", + "gix-object 0.29.1", "thiserror", ] @@ -1353,6 +1467,12 @@ dependencies = [ "tempfile", ] +[[package]] +name = "gix-trace" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02b202d766a7fefc596e2cc6a89cda8ad8ad733aed82da635ac120691112a9b1" + [[package]] name = "gix-transport" version = "0.31.0" @@ -1363,7 +1483,7 @@ dependencies = [ "bstr", "gix-command", "gix-credentials", - "gix-features", + "gix-features 0.29.0", "gix-packetline", "gix-quote", "gix-sec", @@ -1378,9 +1498,9 @@ version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a5be1e807f288c33bb005075111886cceb43ed8a167b3182a0f62c186e2a0dd1" dependencies = [ - "gix-hash", + "gix-hash 0.11.1", "gix-hashtable", - "gix-object", + "gix-object 0.29.1", "thiserror", ] @@ -1391,7 +1511,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dfc77f89054297cc81491e31f1bab4027e554b5ef742a44bd7035db9a0f78b76" dependencies = [ "bstr", - "gix-features", + "gix-features 0.29.0", "gix-path", "home", "thiserror", @@ -1417,6 +1537,16 @@ dependencies = [ "thiserror", ] +[[package]] +name = "gix-validate" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac7cc36f496bd5d96cdca0f9289bb684480725d40db60f48194aa7723b883854" +dependencies = [ + "bstr", + "thiserror", +] + [[package]] name = "gix-worktree" version = "0.17.1" @@ -1426,13 +1556,13 @@ dependencies = [ "bstr", "filetime", "gix-attributes", - "gix-features", + "gix-features 0.29.0", "gix-fs", "gix-glob", - "gix-hash", + "gix-hash 0.11.1", "gix-ignore", "gix-index", - "gix-object", + "gix-object 0.29.1", "gix-path", "io-close", "thiserror", @@ -1629,7 +1759,7 @@ dependencies = [ "rustls 0.20.9", "tokio", "tokio-rustls 0.23.4", - "webpki-roots", + "webpki-roots 0.22.6", ] [[package]] @@ -1641,7 +1771,7 @@ dependencies = [ "futures-util", "http", "hyper", - "rustls 0.21.1", + "rustls 0.21.10", "tokio", "tokio-rustls 0.24.1", ] @@ -1668,7 +1798,7 @@ dependencies = [ "hyper", "hyper-rustls 0.23.2", "tokio", - "trust-dns-resolver", + "trust-dns-resolver 0.22.0", ] [[package]] @@ -1713,9 +1843,19 @@ dependencies = [ [[package]] name = "idna" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "idna" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -1791,7 +1931,7 @@ dependencies = [ "socket2 0.4.9", "widestring", "winapi", - "winreg", + "winreg 0.10.1", ] [[package]] @@ -2138,9 +2278,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "openssl" @@ -2165,7 +2305,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.48", ] [[package]] @@ -2227,9 +2367,9 @@ dependencies = [ [[package]] name = "percent-encoding" -version = "2.2.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pest" @@ -2261,7 +2401,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.48", ] [[package]] @@ -2292,7 +2432,7 @@ checksum = "39407670928234ebc5e6e580247dd567ad73a3578460c5990f9503df207e8f07" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.48", ] [[package]] @@ -2313,6 +2453,12 @@ version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + [[package]] name = "ppv-lite86" version = "0.2.17" @@ -2351,9 +2497,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.66" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" dependencies = [ "unicode-ident", ] @@ -2368,6 +2514,12 @@ dependencies = [ "human_format", ] +[[package]] +name = "prodash" +version = "28.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "744a264d26b88a6a7e37cbad97953fa233b94d585236310bcbc88474b4092d79" + [[package]] name = "quick-error" version = "1.2.3" @@ -2376,9 +2528,9 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quote" -version = "1.0.26" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] @@ -2540,10 +2692,11 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.18" +version = "0.11.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cde824a14b7c14f85caff81225f411faacc04a2013f41670f41443742b1c1c55" +checksum = "37b1ae8d9ac08420c66222fb9096fc5de435c3c48542bc5336c51892cffafb41" dependencies = [ + "async-compression", "base64 0.21.0", "bytes", "encoding_rs", @@ -2563,22 +2716,24 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", - "rustls 0.21.1", + "rustls 0.21.10", "rustls-pemfile", "serde", "serde_json", "serde_urlencoded", + "system-configuration", "tokio", "tokio-native-tls", "tokio-rustls 0.24.1", + "tokio-util", "tower-service", - "trust-dns-resolver", + "trust-dns-resolver 0.23.2", "url", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "webpki-roots", - "winreg", + "webpki-roots 0.25.3", + "winreg 0.50.0", ] [[package]] @@ -2600,12 +2755,26 @@ dependencies = [ "cc", "libc", "once_cell", - "spin", - "untrusted", + "spin 0.5.2", + "untrusted 0.7.1", "web-sys", "winapi", ] +[[package]] +name = "ring" +version = "0.17.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9babe80d5c16becf6594aa32ad2be8fe08498e7ae60b77de8df700e67f191d7e" +dependencies = [ + "cc", + "getrandom", + "libc", + "spin 0.9.8", + "untrusted 0.9.0", + "windows-sys 0.48.0", +] + [[package]] name = "rust-embed" version = "6.6.1" @@ -2666,19 +2835,19 @@ version = "0.20.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b80e3dec595989ea8510028f30c408a4630db12c9cbb8de34203b89d6577e99" dependencies = [ - "ring", + "ring 0.16.20", "sct", "webpki", ] [[package]] name = "rustls" -version = "0.21.1" +version = "0.21.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c911ba11bc8433e811ce56fde130ccf32f5127cab0e0194e9c68c5a5b671791e" +checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" dependencies = [ "log", - "ring", + "ring 0.17.3", "rustls-webpki", "sct", ] @@ -2694,12 +2863,12 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.100.1" +version = "0.101.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6207cd5ed3d8dca7816f8f3725513a34609c0c765bf652b8c3cb4cfd87db46b" +checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" dependencies = [ - "ring", - "untrusted", + "ring 0.17.3", + "untrusted 0.9.0", ] [[package]] @@ -2738,8 +2907,8 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" dependencies = [ - "ring", - "untrusted", + "ring 0.16.20", + "untrusted 0.7.1", ] [[package]] @@ -2767,22 +2936,22 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.162" +version = "1.0.195" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71b2f6e1ab5c2b98c05f0f35b236b22e8df7ead6ffbf51d7808da7f8817e7ab6" +checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.162" +version = "1.0.195" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2a0814352fd64b58489904a44ea8d90cb1a91dcb6b4f5ebabc32c8318e93cb6" +checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.48", ] [[package]] @@ -2833,7 +3002,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.48", ] [[package]] @@ -2926,6 +3095,12 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" + [[package]] name = "static_assertions" version = "1.1.0" @@ -2951,15 +3126,36 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.15" +version = "2.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a34fcf3e8b60f57e6a14301a2e916d323af98b0ea63c599441eec8558660c822" +checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] +[[package]] +name = "system-configuration" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "tap" version = "1.0.1" @@ -3021,18 +3217,20 @@ checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.48", ] [[package]] name = "time" -version = "0.3.20" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd0cbfecb4d19b5ea75bb31ad904eb5b9fa13f21079c3b92017ebdf4999a5890" +checksum = "f657ba42c3f86e7680e53c8cd3af8abbe56b5491790b46e22e19c0d57463583e" dependencies = [ + "deranged", "itoa", "libc", "num_threads", + "powerfmt", "serde", "time-core", "time-macros", @@ -3040,15 +3238,15 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.0" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.8" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd80a657e71da814b8e5d60d3374fc6d35045062245d80224748ae522dd76f36" +checksum = "26197e33420244aeb70c3e8c78376ca46571bc4e701e4791c2cd9f57dcb3a43f" dependencies = [ "time-core", ] @@ -3109,7 +3307,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.48", ] [[package]] @@ -3138,7 +3336,7 @@ name = "tokio-rustls" version = "0.24.1" source = "git+https://code.betamike.com/micropelago/tokio-rustls.git?branch=start-handshake-into-inner#3d462a1d97836cdb0600f0bc69c5e3b3310f6d8c" dependencies = [ - "rustls 0.21.1", + "rustls 0.21.10", "tokio", ] @@ -3182,7 +3380,7 @@ checksum = "0f57e3ca2a01450b1a921183a9c9cbfda207fd822cef4ccb00a65402cbba7a74" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.48", ] [[package]] @@ -3221,7 +3419,7 @@ dependencies = [ "time", "tokio", "tracing", - "trust-dns-proto", + "trust-dns-proto 0.22.0", ] [[package]] @@ -3233,7 +3431,7 @@ dependencies = [ "async-trait", "cfg-if", "data-encoding", - "enum-as-inner", + "enum-as-inner 0.5.1", "futures-channel", "futures-io", "futures-util", @@ -3249,6 +3447,31 @@ dependencies = [ "url", ] +[[package]] +name = "trust-dns-proto" +version = "0.23.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3119112651c157f4488931a01e586aa459736e9d6046d3bd9105ffb69352d374" +dependencies = [ + "async-trait", + "cfg-if", + "data-encoding", + "enum-as-inner 0.6.0", + "futures-channel", + "futures-io", + "futures-util", + "idna 0.4.0", + "ipnet", + "once_cell", + "rand 0.8.5", + "smallvec", + "thiserror", + "tinyvec", + "tokio", + "tracing", + "url", +] + [[package]] name = "trust-dns-resolver" version = "0.22.0" @@ -3257,16 +3480,35 @@ checksum = "aff21aa4dcefb0a1afbfac26deb0adc93888c7d295fb63ab273ef276ba2b7cfe" dependencies = [ "cfg-if", "futures-util", - "ipconfig", "lazy_static", "lru-cache", "parking_lot", + "smallvec", + "thiserror", + "tokio", + "tracing", + "trust-dns-proto 0.22.0", +] + +[[package]] +name = "trust-dns-resolver" +version = "0.23.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10a3e6c3aff1718b3c73e395d1f35202ba2ffa847c6a62eea0db8fb4cfe30be6" +dependencies = [ + "cfg-if", + "futures-util", + "ipconfig", + "lru-cache", + "once_cell", + "parking_lot", + "rand 0.8.5", "resolv-conf", "smallvec", "thiserror", "tokio", "tracing", - "trust-dns-proto", + "trust-dns-proto 0.23.2", ] [[package]] @@ -3344,14 +3586,20 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + [[package]] name = "url" -version = "2.3.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" +checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" dependencies = [ "form_urlencoded", - "idna 0.3.0", + "idna 0.5.0", "percent-encoding", ] @@ -3481,8 +3729,8 @@ version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" dependencies = [ - "ring", - "untrusted", + "ring 0.16.20", + "untrusted 0.7.1", ] [[package]] @@ -3494,6 +3742,12 @@ dependencies = [ "webpki", ] +[[package]] +name = "webpki-roots" +version = "0.25.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1778a42e8b3b90bff8d0f5032bf22250792889a5cdc752aa0020c84abe3aaf10" + [[package]] name = "widestring" version = "0.5.1" @@ -3672,6 +3926,15 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" +[[package]] +name = "winnow" +version = "0.5.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7cf47b659b318dccbd69cc4797a39ae128f533dce7902a1096044d1967b9c16" +dependencies = [ + "memchr", +] + [[package]] name = "winreg" version = "0.10.1" @@ -3681,6 +3944,16 @@ dependencies = [ "winapi", ] +[[package]] +name = "winreg" +version = "0.50.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + [[package]] name = "wyz" version = "0.2.0" diff --git a/Cargo.toml b/Cargo.toml index 6b3d3cd..bf8e706 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,11 +42,13 @@ log = "0.4.19" env_logger = "0.10.0" serde_yaml = "0.9.22" rand = "0.8.5" -reqwest = "0.11.18" hyper-reverse-proxy = "0.5.2-dev" gemini = "0.0.5" bytes = "1.4.0" hyper-trust-dns = "0.5.0" +gix-hash = "0.14.1" +reqwest = { version = "0.11.23", features = ["gzip", "deflate"] } +gix-object = "0.41.0" [patch.crates-io] diff --git a/src/origin/git_proxy.rs b/src/origin/git_proxy.rs new file mode 100644 index 0000000..75a092b --- /dev/null +++ b/src/origin/git_proxy.rs @@ -0,0 +1,188 @@ +use crate::error::unexpected::{self, Mappable}; +use crate::{origin, util}; +use std::{collections, sync}; + +struct DescrState { + current_tree: gix_hash::ObjectId, +} + +#[derive(Default)] +pub struct Proxy { + client: reqwest::Client, + state: sync::RwLock>, + + // to prevent syncing the same origin more than once at a time, but still allow hitting that + // origin in during a sync. + sync_guard: sync::Mutex>, +} + +impl Proxy { + pub fn new() -> Proxy { + Proxy::default() + } + + fn deconstruct_descr(descr: &origin::Descr) -> (&origin::descr::GitUrl, &str) { + let origin::Descr::Git { + ref url, + ref branch_name, + } = descr; + (url, branch_name) + } + + fn construct_url( + url: &origin::descr::GitUrl, + sub_path: &str, + ) -> unexpected::Result { + let mut url: reqwest::Url = { + url.parsed + .to_string() + .parse() + .or_unexpected_while("parsing url as reqwest url")? + }; + + let base_path = match url.to_file_path() { + Ok(path) => path, + Err(()) => return Err(unexpected::Error::from("extracting path from url")), + }; + + let new_path = base_path.join(sub_path); + + url.set_path( + new_path + .to_str() + .or_unexpected_while("converting new path to string")?, + ); + + Ok(url) + } + + async fn get_tip_commit_hash( + &self, + descr: &origin::Descr, + ) -> Result { + let (url, branch_name) = Self::deconstruct_descr(&descr); + + let refs_url = + Self::construct_url(&url, "/info/refs").or_unexpected_while("constructing refs url")?; + + // when fetching refs we assume that any issue indicates that the origin itself + // (and therefore the URL) has some kind of issue. + let refs = self + .client + .get(refs_url) + .send() + .await + .or(Err(origin::SyncError::InvalidURL))? + .error_for_status() + .or(Err(origin::SyncError::InvalidURL))? + .text() + .await + .or(Err(origin::SyncError::InvalidURL))?; + + let full_ref = format!("refs/heads/{}", branch_name); + for line in refs.lines() { + if !line.ends_with(full_ref.as_str()) { + continue; + } + + return gix_hash::ObjectId::from_hex( + line.split_ascii_whitespace() + .next() + .ok_or(origin::SyncError::InvalidURL)? + .as_bytes(), + ) + .or(Err(origin::SyncError::InvalidURL)); + } + + Err(origin::SyncError::InvalidBranchName) + } + + async fn get_commit_tree( + &self, + descr: &origin::Descr, + commit_hash: &gix_hash::ObjectId, + ) -> Result { + let hex = commit_hash.to_string(); + let (url, _) = Self::deconstruct_descr(&descr); + + let commit_object_url = Self::construct_url( + &url, + format!("/objects/{}/{}", &hex[..2], &hex[2..]).as_str(), + ) + .or_unexpected_while("constructing refs url")?; + + let commit_object_bytes = self + .client + .get(commit_object_url) + .send() + .await + .or(Err(origin::SyncError::InvalidURL))? + .error_for_status() + .or(Err(origin::SyncError::InvalidURL))? + .bytes() + .await + .or(Err(origin::SyncError::InvalidURL))?; + + let commit_object = gix_object::ObjectRef::from_loose(commit_object_bytes.as_ref()) + .or(Err(origin::SyncError::InvalidURL))? + .into_commit() + .ok_or(origin::SyncError::InvalidURL)?; + + Ok(commit_object.tree()) + } +} + +impl origin::Store for Proxy { + fn sync(&self, descr: &origin::Descr) -> util::BoxFuture<'_, Result<(), origin::SyncError>> { + let descr = descr.clone(); + Box::pin(async move { + // attempt to lock this descr for syncing, doing so within a new scope so the mutex + // isn't actually being held for the whole method duration. + let is_already_syncing = { + self.sync_guard + .lock() + .unwrap() + .insert(descr.clone(), ()) + .is_some() + }; + + if is_already_syncing { + return Err(origin::SyncError::AlreadyInProgress); + } + + // perform the rest of the work within this closure, so we can be sure that the guard + // lock is released no matter what. + let res: Result<(), origin::SyncError> = (|| async { + let commit_hash = self.get_tip_commit_hash(&descr).await?; + let current_tree = self.get_commit_tree(&descr, &commit_hash).await?; + self.state + .write() + .unwrap() + .insert(descr.clone(), DescrState { current_tree }); + Ok(()) + })() + .await; + + self.sync_guard.lock().unwrap().remove(&descr); + res + }) + } + + fn all_descrs(&self) -> Result, origin::AllDescrsError> { + Ok(self + .state + .read() + .unwrap() + .keys() + .map(|d| d.clone()) + .collect()) + } + + fn get_file( + &self, + _descr: &origin::Descr, + _path: &str, + ) -> Result { + panic!("TODO") + } +}