Bump version to 0.4.3

Signed-off-by: messense <messense@icloud.com>
This commit is contained in:
messense 2016-04-25 12:33:15 +08:00
parent 74fddfd5cb
commit 77b604d2af
No known key found for this signature in database
GPG key ID: BB41A8A2C716CCA9
2 changed files with 7 additions and 7 deletions

View file

@ -8,12 +8,12 @@ license = "MIT"
name = "robotparser" name = "robotparser"
readme = "README.md" readme = "README.md"
repository = "https://github.com/messense/robotparser-rs" repository = "https://github.com/messense/robotparser-rs"
version = "0.4.2" version = "0.4.3"
[dependencies] [dependencies]
hyper = "0.8" hyper = "0.9"
time = "0.1" time = "0.1"
url = "0.5" url = "1.0"
[dependencies.clippy] [dependencies.clippy]
optional = true optional = true

View file

@ -192,7 +192,7 @@ impl RobotFileParser {
allow_all: Cell::new(false), allow_all: Cell::new(false),
url: parsed_url.clone(), url: parsed_url.clone(),
host: parsed_url.domain().unwrap().to_owned(), host: parsed_url.domain().unwrap().to_owned(),
path: parsed_url.path().unwrap().join("/"), path: parsed_url.path().to_owned(),
last_checked: Cell::new(0i64), last_checked: Cell::new(0i64),
} }
} }
@ -218,7 +218,7 @@ impl RobotFileParser {
let parsed_url = Url::parse(url.as_ref()).unwrap(); let parsed_url = Url::parse(url.as_ref()).unwrap();
self.url = parsed_url.clone(); self.url = parsed_url.clone();
self.host = parsed_url.domain().unwrap().to_owned(); self.host = parsed_url.domain().unwrap().to_owned();
self.path = parsed_url.path().unwrap().join("/"); self.path = parsed_url.path().to_owned();
self.last_checked.set(0i64); self.last_checked.set(0i64);
} }
@ -306,7 +306,7 @@ impl RobotFileParser {
let parts: Vec<&str> = ln.splitn(2, ':').collect(); let parts: Vec<&str> = ln.splitn(2, ':').collect();
if parts.len() == 2 { if parts.len() == 2 {
let part0 = parts[0].trim().to_lowercase(); let part0 = parts[0].trim().to_lowercase();
let part1 = String::from_utf8(percent_decode(parts[1].trim().as_bytes())).unwrap_or("".to_owned()); let part1 = String::from_utf8(percent_decode(parts[1].trim().as_bytes()).collect()).unwrap_or("".to_owned());
match part0 { match part0 {
ref x if x == "user-agent" => { ref x if x == "user-agent" => {
if state == 2 { if state == 2 {
@ -376,7 +376,7 @@ impl RobotFileParser {
} }
// search for given user agent matches // search for given user agent matches
// the first match counts // the first match counts
let decoded_url = String::from_utf8(percent_decode(url.trim().as_bytes())).unwrap_or("".to_owned()); let decoded_url = String::from_utf8(percent_decode(url.trim().as_bytes()).collect()).unwrap_or("".to_owned());
let url_str = match decoded_url { let url_str = match decoded_url {
ref u if !u.is_empty() => u.to_owned(), ref u if !u.is_empty() => u.to_owned(),
_ => "/".to_owned(), _ => "/".to_owned(),