Skip to content

Update to rust-url 1.0 #115

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 4 additions & 12 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,18 @@ impl CredentialHelper {
};

// Parse out the (protocol, host) if one is available
let parsed_url = UrlParser::new().scheme_type_mapper(mapper).parse(url);
let parsed_url = url::Url::parse(url);
match parsed_url {
Ok(url) => {
match url.host() {
Some(&url::Host::Domain(ref s)) => ret.host = Some(s.clone()),
Some(url::Host::Domain(s)) => ret.host = Some(s.to_owned()),
_ => {}
}
ret.protocol = Some(url.scheme)
ret.protocol = Some(url.scheme().to_owned())
}
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),
}
}
}

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