Resolve host names

This commit is contained in:
Brian Anderson 2013-09-06 17:37:11 -07:00
parent af1e951a16
commit afb2eedbcf
2 changed files with 2 additions and 10 deletions

View file

@ -11,7 +11,6 @@ use http::client::RequestWriter;
use http::method::Get; use http::method::Get;
use http::headers::HeaderEnum; use http::headers::HeaderEnum;
use std::rt::io::Reader; use std::rt::io::Reader;
use std::rt::io::net::ip::SocketAddr;
pub fn factory() -> LoaderTask { pub fn factory() -> LoaderTask {
let f: LoaderTask = |url, progress_chan| { let f: LoaderTask = |url, progress_chan| {
@ -27,8 +26,7 @@ fn load(url: Url, progress_chan: Chan<ProgressMsg>) {
info!("requesting %s", url.to_str()); info!("requesting %s", url.to_str());
let mut request = ~RequestWriter::new(Get, url.clone()); let request = ~RequestWriter::new(Get, url.clone());
request.remote_addr = Some(url_to_socket_addr(&url));
let mut response = match request.read_response() { let mut response = match request.read_response() {
Ok(r) => r, Ok(r) => r,
Err(_) => { Err(_) => {
@ -57,9 +55,3 @@ fn load(url: Url, progress_chan: Chan<ProgressMsg>) {
progress_chan.send(Payload(buf)); progress_chan.send(Payload(buf));
} }
} }
// FIXME: Quick hack to convert ip addresses to SocketAddr
fn url_to_socket_addr(url: &Url) -> SocketAddr {
let host_and_port = fmt!("%s:%s", url.host, url.port.clone().unwrap_or_default(~"80"));
FromStr::from_str(host_and_port).expect("couldn't parse host as IP address")
}

@ -1 +1 @@
Subproject commit a391c127b00128b81127621720d2e361c8d9070e Subproject commit 3359d73650614921718b84d6c680cd7898b35df7