M5HGUS2TL72TRSUS7NN7ZQND4CDPVBERJQNUQJ4XTZ6GRUEPUIEAC 7DH43OFGO4RVLW3LL23FZDMXRHQLAEMK7VD62T7FZBRHZOF3RRDAC XHDJKZOSBFCZWKPTBFTSLDRDGTUBOJLL6XVKVCGMBJXDOELSGLYQC LSYI2TXC2N33NQF4MG2RNBETSPSO7BRTJVUVVO7P3XN4SRJDEWLAC JBZGFYVOKR3X2GH25SOOW3X7RKY6ZACESYFF5NO26PJFUP3XGXUAC 5II6T7YETYWUIKUMNJIYFUOQHCA26N2YVJDSHLMNO2GR62MP2ORQC BOFUYB6IISDQYT3G5MKVDNWB2WWGHMNYDKTITJBVS5RED6XJLB4QC Y55SCAUN3MQCMRGJQBBMICEO6ARTGICWGGZYA7VB6ZRPK6US4B5AC K37J3USB4DC54L5CFARGQOZYF76I4USNJHYEXCTTRF5D5CTJCN3QC J4PKMKJXBUPG4QFHQVATUOXHWLEWMX3LTGWMNFKFAQUTJHU5GSAAC KP6SZZ346AU4MCK2EZK3WHGGGNDMUGX7AG4CBYKVO4HZMUYRBU6AC 55JQX7NFAQTW7TLU5TE2CJDBWVG6KZ7YI7LUSHAJ735AIZ3XKPIAC #[cfg(test)]mod test {use super::*;#[test]fn test_good_statuses() {let statuses = vec![b"10", b"11", b"20", b"30", b"31", b"40", b"41", b"42", b"43", b"44", b"50", b"51",b"52", b"53", b"59", b"60", b"61", b"62",];for code in statuses {assert!(status(code).is_ok())}}#[test]fn test_bad_statuses() {let base_code = b"70";for i in 0..40 {let mut code = base_code.clone();code[1] += i;assert!(status(&code).is_err())}}}
#[cfg(test)]mod test {use super::*;#[test]fn test_response() {let bytes = b"20 text/gemini\r\n=> gemini://foo.bar.baz/ wow";let res = response(bytes).unwrap().1;assert_eq!(res.body_text().unwrap(), "=> gemini://foo.bar.baz/ wow")}#[test]fn test_response_no_body() {let bytes = b"60 owwwwwwww!\r\ni shouldn't be here";assert!(response(bytes).is_err());let bytes = b"61 this is fine\r\n";assert!(response(bytes).is_ok());}}
#[cfg(test)]mod test {use super::*;#[test]fn test_gemini_request() {let bytes = b"gemini://foo.bar.baz:1966/path\r\n";assert!(request(bytes).unwrap().1.is_gemini_request())}#[test]fn test_gemini_request_no_port() {let bytes = b"gemini://foo.bar.baz/path\r\n";assert!(request(bytes).unwrap().1.is_gemini_request())}#[test]fn test_generic_request() {let bytes = b"http://goggle.com/snoop\r\n";assert!(request(bytes).is_ok())}// NB: looking at this test, im unsure if this behavior is desirable.// maybe there should be a canonical parser that strictly requires// a scheme, since that's what the gemini spec does, along with a uri// parser that tries to read a "link-like-thing" as a gemini link?#[test]fn test_no_scheme() {let bytes = b"foo.bar.baz/path\r\n";assert!(request(bytes).unwrap().1.is_gemini_request())}}
#[cfg(test)]mod test {use super::*;#[test]fn test_success() {let bytes = b"20 text/gemini; charset=utf-8\r\n";assert_eq!(header(bytes).unwrap().1, Header::gemtext())}#[test]fn test_mimetype() {let bytes = b"20 text/json\r\n";assert_eq!(header(bytes).unwrap().1,Header::success("text/json").unwrap())}#[test]fn test_error() {let bytes = b"59 grr! bark! meow!\r\n";assert_eq!(header(bytes).unwrap().1,Header::new(Status::BAD_REQUEST, "grr! bark! meow!".into()).unwrap())}}
}#[cfg(test)]mod test {use super::*;#[test]fn test_document() {assert_eq!(document(DOCUMENT).unwrap().1,Builder::from_docs(vec![Doc::Blank,Doc::Preformatted {alt: Some("logo".to_string()),text: " wooo\n/^^^^\\\n| |\n\\____/".to_string()},Doc::Blank,Doc::Heading(Level::One, "GAZE INTO THE SPHERE!".to_string()),Doc::Blank,Doc::Text("critics are raving".to_string()),Doc::Quote("i love the sphere - bort".to_string()),Doc::Quote("the sphere gives me purpose - frelvin".to_string()),Doc::Blank,Doc::ListItem("always".to_string()),Doc::ListItem("trust".to_string()),Doc::ListItem("the sphere".to_string()),Doc::Link {to: "gemini://sphere.gaze".to_string(),name: Some("gaze more here".to_string())}]))}
[[package]]name = "anyhow"version = "1.0.38"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "afddf7f520a80dbf76e6f50a35bca42a2331ef227a28b3b6dc5c2e2338d114b1"
[[package]]name = "autocfg"version = "1.0.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
name = "bytes"version = "1.0.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040"[[package]]name = "cc"version = "1.0.66"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "4c0496836a84f8d0495758516b8621a622beb77c0fed418570e50764093ced48"[[package]]
[[package]]name = "cfg-if"version = "1.0.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"[[package]]name = "core-foundation"version = "0.9.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "0a89e2ae426ea83155dccf10c0fa6b1463ef6d5fcb44cee0b224a408fa640a62"dependencies = ["core-foundation-sys","libc",][[package]]name = "core-foundation-sys"version = "0.8.2"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "ea221b5284a47e40033bf9b66f35f984ec0ea2931eb03505246cd27a963f981b"
name = "foreign-types"version = "0.3.2"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1"dependencies = ["foreign-types-shared",][[package]]name = "foreign-types-shared"version = "0.1.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"[[package]]
name = "getrandom"version = "0.2.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "4060f4657be78b8e766215b02b18a2e862d83745545de804638e2b545e81aee6"dependencies = ["cfg-if 1.0.0","libc","wasi",][[package]]name = "hermit-abi"version = "0.1.17"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "5aca5565f760fb5b220e499d72710ed156fdb74e631659e99377d9ebfbd13ae8"dependencies = ["libc",][[package]]
name = "instant"version = "0.1.9"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "61124eeebbd69b8190558df225adf7e4caafce0d743919e5d6b19652314ec5ec"dependencies = ["cfg-if 1.0.0",][[package]]name = "lazy_static"version = "1.4.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"[[package]]
][[package]]name = "libc"version = "0.2.81"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "1482821306169ec4d07f6aca392a4681f66c75c9918aa49641a2595db64053cb"[[package]]name = "lock_api"version = "0.4.2"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "dd96ffd135b2fd7b973ac026d28085defbe8983df057ced3eb4f2130b0831312"dependencies = ["scopeguard",
name = "log"version = "0.4.11"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b"dependencies = ["cfg-if 0.1.10",][[package]]
[[package]]name = "mio"version = "0.7.7"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "e50ae3f04d169fcc9bde0b547d1c205219b7157e07ded9c5aff03e0637cb3ed7"dependencies = ["libc","log","miow","ntapi","winapi",][[package]]name = "miow"version = "0.3.6"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "5a33c1b55807fbed163481b5ba66db4b2fa6cde694a5027be10fb724206c5897"dependencies = ["socket2","winapi",][[package]]name = "native-tls"version = "0.2.7"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "b8d96b2e1c8da3957d58100b09f102c6d9cfdfced01b7ec5a8974044bb09dbd4"dependencies = ["lazy_static","libc","log","openssl","openssl-probe","openssl-sys","schannel","security-framework","security-framework-sys","tempfile",]
][[package]]name = "ntapi"version = "0.3.6"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44"dependencies = ["winapi",][[package]]name = "num_cpus"version = "1.13.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3"dependencies = ["hermit-abi","libc",][[package]]name = "once_cell"version = "1.5.2"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "13bd41f508810a131401606d54ac32a467c97172d74ba7662562ebba5ad07fa0"[[package]]name = "openssl"version = "0.10.32"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "038d43985d1ddca7a9900630d8cd031b56e4794eecc2e9ea39dd17aa04399a70"dependencies = ["bitflags","cfg-if 1.0.0","foreign-types","lazy_static","libc","openssl-sys",][[package]]name = "openssl-probe"version = "0.1.2"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de"[[package]]name = "openssl-sys"version = "0.9.60"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "921fc71883267538946025deffb622905ecad223c28efbfdef9bb59a0175f3e6"dependencies = ["autocfg","cc","libc","pkg-config","vcpkg",][[package]]name = "parking_lot"version = "0.11.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb"dependencies = ["instant","lock_api","parking_lot_core",][[package]]name = "parking_lot_core"version = "0.8.2"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "9ccb628cad4f84851442432c60ad8e1f607e29752d0bf072cbd0baf28aa34272"dependencies = ["cfg-if 1.0.0","instant","libc","redox_syscall 0.1.57","smallvec","winapi",
[[package]]name = "pin-project-lite"version = "0.2.4"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "439697af366c49a6d0a010c56a0d97685bc140ce0d377b13a2ea2aa42d64a827"[[package]]name = "pkg-config"version = "0.3.19"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c"
[[package]]name = "rand"version = "0.8.2"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "18519b42a40024d661e1714153e9ad0c3de27cd495760ceb09710920f1098b1e"dependencies = ["libc","rand_chacha","rand_core","rand_hc",][[package]]name = "rand_chacha"version = "0.3.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d"dependencies = ["ppv-lite86","rand_core",]
name = "rand_core"version = "0.6.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "c026d7df8b298d90ccbbc5190bd04d85e159eaf5576caeacf8741da93ccbd2e5"dependencies = ["getrandom",][[package]]name = "rand_hc"version = "0.3.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73"dependencies = ["rand_core",][[package]]name = "redox_syscall"version = "0.1.57"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce"[[package]]name = "redox_syscall"version = "0.2.4"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "05ec8ca9416c5ea37062b502703cd7fcb207736bc294f6e0cf367ac6fc234570"dependencies = ["bitflags",][[package]]name = "remove_dir_all"version = "0.5.3"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"dependencies = ["winapi",][[package]]
[[package]]name = "schannel"version = "0.1.19"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75"dependencies = ["lazy_static","winapi",][[package]]name = "scopeguard"version = "1.1.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"[[package]]name = "security-framework"version = "2.0.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "c1759c2e3c8580017a484a7ac56d3abc5a6c1feadf88db2f3633f12ae4268c69"dependencies = ["bitflags","core-foundation","core-foundation-sys","libc","security-framework-sys",][[package]]name = "security-framework-sys"version = "2.0.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "f99b9d5e26d2a71633cc4f2ebae7cc9f874044e0c351a27e17892d76dce5678b"dependencies = ["core-foundation-sys","libc",][[package]]name = "signal-hook-registry"version = "1.3.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "16f1d0fef1604ba8f7a073c7e701f213e056707210e9020af4528e0101ce11a6"dependencies = ["libc",][[package]]name = "smallvec"version = "1.6.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e"
name = "socket2"version = "0.3.19"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "122e570113d28d773067fab24266b66753f6ea915758651696b6e35e49f88d6e"dependencies = ["cfg-if 1.0.0","libc","winapi",][[package]]
[[package]]name = "tempfile"version = "3.2.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22"dependencies = ["cfg-if 1.0.0","libc","rand","redox_syscall 0.2.4","remove_dir_all","winapi",]
name = "tokio"version = "1.0.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "d258221f566b6c803c7b4714abadc080172b272090cdc5e244a6d4dd13c3a6bd"dependencies = ["autocfg","bytes","libc","memchr","mio","num_cpus","once_cell","parking_lot","pin-project-lite","signal-hook-registry","tokio-macros","winapi",][[package]]name = "tokio-macros"version = "1.0.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "42517d2975ca3114b22a16192634e8241dc5cc1f130be194645970cc1c371494"dependencies = ["proc-macro2","quote","syn",][[package]]name = "tokio-native-tls"version = "0.3.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b"dependencies = ["native-tls","tokio",][[package]]
[[package]]name = "vcpkg"version = "0.2.11"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "b00bca6106a5e23f3eee943593759b7fcddb00554332e856d990c893966879fb"
name = "voskhod"version = "0.1.0"dependencies = ["anyhow","gemini","tokio","tokio-native-tls",][[package]]name = "wasi"version = "0.10.1+wasi-snapshot-preview1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "93c6c3420963c5c64bca373b25e77acb562081b9bb4dd5bb864187742186cea9"[[package]]name = "winapi"version = "0.3.9"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"dependencies = ["winapi-i686-pc-windows-gnu","winapi-x86_64-pc-windows-gnu",][[package]]name = "winapi-i686-pc-windows-gnu"version = "0.4.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"[[package]]name = "winapi-x86_64-pc-windows-gnu"version = "0.4.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"[[package]]