From ca76ffc0e6af5c5270f0ea92ddd278ddf0ede918 Mon Sep 17 00:00:00 2001 From: Justin Geibel Date: Mon, 30 Apr 2018 20:19:20 -0400 Subject: [PATCH] Replace `civet` with `conduit-hyper` --- Cargo.lock | 43 ++++++++++++++++++++----------------------- Cargo.toml | 2 +- src/bin/server.rs | 13 +++++-------- 3 files changed, 26 insertions(+), 32 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 600ade6115..007b399bf7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -123,12 +123,12 @@ dependencies = [ "ammonia 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "cargo-registry-s3 0.2.0", "chrono 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "civet 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "comrak 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "conduit 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "conduit-conditional-get 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "conduit-cookie 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", "conduit-git-http-backend 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "conduit-hyper 0.1.0 (git+https://github.com/jtgeibel/conduit-hyper?branch=stable-1.26)", "conduit-json-parser 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "conduit-middleware 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "conduit-router 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -148,7 +148,7 @@ dependencies = [ "git2 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", "hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "htmlescape 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "hyper 0.11.21 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.11.25 (registry+https://github.com/rust-lang/crates.io-index)", "hyper-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "lettre 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -199,22 +199,6 @@ dependencies = [ "time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "civet" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "civet-sys 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "conduit 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", - "semver 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "civet-sys" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "cmake" version = "0.1.26" @@ -283,6 +267,20 @@ dependencies = [ "flate2 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "conduit-hyper" +version = "0.1.0" +source = "git+https://github.com/jtgeibel/conduit-hyper?branch=stable-1.26#d24e6cb7ba89654b9fb81f6736095a2885c88b3d" +dependencies = [ + "conduit 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-cpupool 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.11.25 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "semver 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "unicase 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "conduit-json-parser" version = "0.8.0" @@ -739,7 +737,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "hyper" -version = "0.11.21" +version = "0.11.25" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "base64 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -767,7 +765,7 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", - "hyper 0.11.21 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.11.25 (registry+https://github.com/rust-lang/crates.io-index)", "native-tls 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-core 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1865,8 +1863,6 @@ dependencies = [ "checksum cc 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a9b13a57efd6b30ecd6598ebdb302cca617930b5470647570468a65d12ef9719" "checksum cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c819a1287eb618df47cc647173c5c4c66ba19d888a6e50d605672aed3140de" "checksum chrono 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7c20ebe0b2b08b0aeddba49c609fe7957ba2e33449882cb186a180bc60682fa9" -"checksum civet 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6263e7af767a5bf9e4d3d0a6c3ceb5f3940ec85cf2fbfee59024b8a264be180f" -"checksum civet-sys 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "958d15372bf28b7983cb35e1d4bf36dd843b0d42e507c1c73aad7150372c5936" "checksum cmake 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)" = "357c07e7a1fc95732793c1edb5901e1a1f305cfcf63a90eb12dbd22bdb6b789d" "checksum coco 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c06169f5beb7e31c7c67ebf5540b8b472d23e3eade3b2ec7d1f5b504a85f91bd" "checksum comrak 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d6e2837c1814c4dc781f73697fdaaf9d5e2f2b137735dda2baad3d73dc684980" @@ -1874,6 +1870,7 @@ dependencies = [ "checksum conduit-conditional-get 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "614f67083e437fd0b8fb9f13067203f358f1c6f52989eb6539292fde007fc6d6" "checksum conduit-cookie 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)" = "2ed0c16befdfbb983fa822470af5480a150401824ed9f2fb928df440781f7e35" "checksum conduit-git-http-backend 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "027a1900afd70becd52b5061afc85a24de6af0d9199f39d4e1af8b7ac55fbe6e" +"checksum conduit-hyper 0.1.0 (git+https://github.com/jtgeibel/conduit-hyper?branch=stable-1.26)" = "" "checksum conduit-json-parser 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc93bc19e39022dabb4b9ee18dfb71c039622aa4f4bf3487967ebb4c8de23432" "checksum conduit-middleware 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "19b4b5a3a60b976f9219490e895cf573a6d17547e009e3c0e9f01a584b5b74d0" "checksum conduit-mime-types 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "95ca30253581af809925ef68c2641cc140d6183f43e12e0af4992d53768bd7b8" @@ -1926,7 +1923,7 @@ dependencies = [ "checksum html5ever 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ba3a1fd1857a714d410c191364c5d7bf8a6487c0ab5575146d37dd7eb17ef523" "checksum htmlescape 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e9025058dae765dee5070ec375f591e2ba14638c63feff74f13805a72e523163" "checksum httparse 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "af2f2dd97457e8fb1ae7c5a420db346af389926e36f43768b96f101546b04a07" -"checksum hyper 0.11.21 (registry+https://github.com/rust-lang/crates.io-index)" = "a3a77dea5dccbf32ba4e9ddd7d80a5a3bb3b9f1f3835e18daf5dbea6bee0efbf" +"checksum hyper 0.11.25 (registry+https://github.com/rust-lang/crates.io-index)" = "549dbb86397490ce69d908425b9beebc85bbaad25157d67479d4995bb56fdf9a" "checksum hyper-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c81fa95203e2a6087242c38691a0210f23e9f3f8f944350bd676522132e2985" "checksum idna 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "014b298351066f1512874135335d62a789ffe78a9974f94b43ed5621951eaf7d" "checksum iovec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b6e8b9c2247fcf6c6a1151f1156932be5606c9fd6f55a2d7f9fc1cb29386b2f7" diff --git a/Cargo.toml b/Cargo.toml index bced85c082..37b7f07ef5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -68,7 +68,7 @@ conduit-middleware = "0.8" conduit-router = "0.8" conduit-static = "0.8" conduit-git-http-backend = "0.8" -civet = "0.9" +conduit-hyper = { git = "https://github.com/jtgeibel/conduit-hyper", branch = "stable-1.26" } [dev-dependencies] conduit-test = "0.8" diff --git a/src/bin/server.rs b/src/bin/server.rs index 2a5d85b282..984e5e2fa9 100644 --- a/src/bin/server.rs +++ b/src/bin/server.rs @@ -1,16 +1,15 @@ #![deny(warnings)] extern crate cargo_registry; -extern crate civet; +extern crate conduit_hyper; extern crate env_logger; extern crate git2; use cargo_registry::{env, Env}; -use civet::Server; +use conduit_hyper::Server; use std::env; use std::fs::{self, File}; use std::sync::Arc; -use std::sync::mpsc::channel; fn main() { // Initialize logging @@ -66,9 +65,8 @@ fn main() { } else { 50 }; - let mut cfg = civet::Config::new(); - cfg.port(port).threads(threads).keep_alive(true); - let _a = Server::start(cfg, app); + let addr = ([127, 0, 0, 1], port).into(); + let server = Server::http(addr, app, threads).unwrap(); println!("listening on port {}", port); @@ -79,6 +77,5 @@ fn main() { } // TODO: handle a graceful shutdown by just waiting for a SIG{INT,TERM} - let (_tx, rx) = channel::<()>(); - rx.recv().unwrap(); + server.run().unwrap(); }