Skip to content

Commit

Permalink
Update to url 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcrichton committed Apr 28, 2016
1 parent 8b439df commit 93b4684
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ repositories.
"""

[dependencies]
url = "0.5"
url = "1.0"
bitflags = "0.1"
libc = "0.2"
libgit2-sys = { path = "libgit2-sys", version = "0.4.0" }
Expand Down
25 changes: 6 additions & 19 deletions src/cred.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::io::Write;
use std::mem;
use std::path::Path;
use std::process::{Command, Stdio};
use url::{self, UrlParser};
use url;

use {raw, Error, Config, IntoCString};
use util::Binding;
Expand Down Expand Up @@ -168,26 +168,13 @@ impl CredentialHelper {
};

// Parse out the (protocol, host) if one is available
let parsed_url = UrlParser::new().scheme_type_mapper(mapper).parse(url);
match parsed_url {
Ok(url) => {
match url.host() {
Some(&url::Host::Domain(ref s)) => ret.host = Some(s.clone()),
_ => {}
}
ret.protocol = Some(url.scheme)
}
Err(..) => {}
};
return ret;

fn mapper(s: &str) -> url::SchemeType {
match s {
"git" => url::SchemeType::Relative(9418),
"ssh" => url::SchemeType::Relative(22),
s => url::whatwg_scheme_type_mapper(s),
if let Ok(url) = url::Url::parse(url) {
if let Some(url::Host::Domain(s)) = url.host() {
ret.host = Some(s.to_string());
}
ret.protocol = Some(url.scheme().to_string())
}
return ret;
}

/// Set the username that this credential helper will query with.
Expand Down

0 comments on commit 93b4684

Please sign in to comment.