Accept str instead of char* in read_autoconf_file

This commit is contained in:
Alexander Krotov
2019-09-07 19:52:12 +03:00
parent 0a6e540394
commit 81cabd08a9
3 changed files with 5 additions and 7 deletions

View File

@@ -39,9 +39,7 @@ pub unsafe fn moz_autoconfigure(
tag_config: 0, tag_config: 0,
}; };
let url_c = url.strdup(); let xml_raw = read_autoconf_file(context, url);
let xml_raw = read_autoconf_file(context, url_c);
free(url_c as *mut libc::c_void);
if xml_raw.is_null() { if xml_raw.is_null() {
return None; return None;
} }

View File

@@ -50,7 +50,7 @@ pub unsafe fn outlk_autodiscover(
0, 0,
::std::mem::size_of::<outlk_autodiscover_t>(), ::std::mem::size_of::<outlk_autodiscover_t>(),
); );
xml_raw = read_autoconf_file(context, url); xml_raw = read_autoconf_file(context, as_str(url));
if xml_raw.is_null() { if xml_raw.is_null() {
ok_to_continue = false; ok_to_continue = false;
break; break;

View File

@@ -663,11 +663,11 @@ pub fn dc_stop_ongoing_process(context: &Context) {
}; };
} }
pub fn read_autoconf_file(context: &Context, url: *const libc::c_char) -> *mut libc::c_char { pub fn read_autoconf_file(context: &Context, url: &str) -> *mut libc::c_char {
info!(context, 0, "Testing {} ...", to_string(url)); info!(context, 0, "Testing {} ...", url);
match reqwest::Client::new() match reqwest::Client::new()
.get(as_str(url)) .get(url)
.send() .send()
.and_then(|mut res| res.text()) .and_then(|mut res| res.text())
{ {