summaryrefslogtreecommitdiff
path: root/indexer/src/open.rs
diff options
context:
space:
mode:
Diffstat (limited to 'indexer/src/open.rs')
-rw-r--r--indexer/src/open.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/indexer/src/open.rs b/indexer/src/open.rs
index 5a294cd..9ecdfa4 100644
--- a/indexer/src/open.rs
+++ b/indexer/src/open.rs
@@ -5,7 +5,7 @@ use regex::bytes::Regex;
use ring::digest;
use url::Url;
use url::percent_encoding::percent_decode;
-use hyper;
+use reqwest;
const CACHE_PATH: &'static str = "/var/tmp/manned-indexer";
@@ -33,14 +33,14 @@ fn cache_fn(url: &Url) -> String {
fn fetch(url: &str) -> Result<Box<Read>> {
- let res = try!(hyper::Client::new()
+ let res = try!(reqwest::Client::new()
.get(url)
- .header(hyper::header::UserAgent("Man page crawler (info@manned.org; https://manned.org/)".to_owned()))
+ .header("User-Agent", "Man page crawler (info@manned.org; https://manned.org/)")
.send()
- .map_err(|e| Error::new(ErrorKind::Other, format!("Hyper: {}", e)))
+ .map_err(|e| Error::new(ErrorKind::Other, format!("Reqwest: {}", e)))
);
- if !res.status.is_success() {
- return Err(Error::new(ErrorKind::Other, format!("HTTP: {}", res.status) ));
+ if !res.status().is_success() {
+ return Err(Error::new(ErrorKind::Other, format!("HTTP: {}", res.status()) ));
}
Ok(Box::new(res) as Box<Read>)
}